Code example for X509Certificate

Methods: getEncoded

     * Returns true if the given certificate is found in the trusted key 
     * store. 
    public boolean isDirectlyTrusted(X509Certificate cert) {
        try { 
            Bytes encoded = new Bytes(cert.getEncoded());
            return encodings.containsKey(encoded);
        } catch (Exception e) {
                    Level.WARNING, "Error encoding cert.", e);
            return false; 
     * Wraps a byte[] and adds equals() and hashCode() support. 
    static class Bytes { 
        final byte[] bytes;
        final int hash;
Experience pair programming with AI  Get Codota for Java