Code example for CertificateException

        throws CertificateException, NoSuchAlgorithmException,  
            SignatureException, InvalidKeyException 
        if (!isAlgIdEqual(c.getSignatureAlgorithm(), c.getTBSCertificate().getSignature()))
            throw new CertificateException("signature algorithm in TBS cert not same as outer cert");
        DEREncodable params = c.getSignatureAlgorithm().getParameters();
        // TODO This should go after the initVerify? 
        X509SignatureUtil.setSignatureParameters(signature, params);
        if (!signature.verify(this.getSignature()))
            throw new InvalidKeyException("Public key presented not for certificate signature");
Stop searching for code, let great code find you!  Add Codota to your java IDE