Java 8 Certificate - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Certificate class.

This code example shows how to use the following methods:getEncoded, getPublicKey, verify
    public void testVerifyPublicKey() throws InvalidKeyException,
            NoSuchAlgorithmException, NoSuchProviderException,
            SignatureException, CertificateException {
 
        // Preconditions 
        assertNotNull(javaxCert.getPublicKey());
        assertNotNull(javaxSSCert.getPublicKey());
        //precondition for self signed certificates 
        /*assertEquals(((X509Certificate) javaxSSCert).getIssuerDN().getName(), 
                ((X509Certificate) javaxSSCert).getSubjectDN());*/ 
 
        // must always evaluate true for self signed 
        // here not self signed: 
        try { 
            javaxCert.verify(javaxCert.getPublicKey());
        } catch (SignatureException e) {
            // ok 
        } 
 
        PublicKey k = javaxCert.getPublicKey();

5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getEncoded
 
    public static String toPem(final X509Certificate certificate) throws CertificateEncodingException {
        final StringBuilder builder = new StringBuilder();
        builder.append(BEGIN_CERT);
        builder.append('\n');
        builder.append(FlexBase64.encodeString(certificate.getEncoded(), true));
        builder.append('\n');
        builder.append(END_CERT);
        return builder.toString();
    } 
 
    private Certificates() { 
 
    } 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getPublicKey
        } 
 
        @Override 
        public void verify(PublicKey key) throws CertificateException,
                NoSuchAlgorithmException, InvalidKeyException, 
                NoSuchProviderException, SignatureException { 
        } 
 
        @Override 
        public void verify(PublicKey key, String sigProvider)
                throws CertificateException, NoSuchAlgorithmException, 
                InvalidKeyException, NoSuchProviderException, 
                SignatureException { 
        } 
    } 
     
    public class MyModifiablePublicKey implements PublicKey {
        
        private PublicKey key;
        private boolean modifiedAlgo;
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Java 8 Certificate Methods: