Code example for X509Certificate

Methods: getEncoded

0
     * 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) {
            Logger.getLogger(IndexedPKIXParameters.class.getName()).log(
                    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;
        Bytes(byte[] bytes) {