Code example for Certificate

Methods: getPublicKeyverify

0
    public final void testVerifyPublicKeyString2() throws InvalidKeyException, 
            CertificateException, NoSuchAlgorithmException, 
            NoSuchProviderException, SignatureException { 
 
        // real test 
        cert.verify(cert.getPublicKey(), usefulProvider.getName());
 
        // Exception tests 
 
        try { 
            cert.verify(cert.getPublicKey(), "UnknownProvider");
            fail();
        } catch (NoSuchProviderException expected) {
        } 
 
        // This test has side effects affecting all other tests running later 
        // on in the same vm instance. Maybe a better way would be to first add 
        // a new provider, test if it works, then remove it and test if the 
        // exception is thrown. 
        // 
Connect your IDE to all the code out there  Get Codota for Java