/** Create a X509CertificatePair from its encoding. Uses cache lookup if possible. */ public static synchronized X509CertificatePair generateCertificatePair(byte[] encoded) throws CertificateException { Object key = new Cache.EqualByteArray(encoded); X509CertificatePair pair = (X509CertificatePair) cache.get(key); if (pair != null) { return pair; } pair = new X509CertificatePair(encoded); key = new Cache.EqualByteArray(pair.encoded); cache.put(key, pair); return pair; }
/** Get the X509CertImpl or X509CRLImpl from the cache. */ private static synchronized <K, V> V getFromCache(Cache<K, V> cache, byte[] encoding) { Object key = new Cache.EqualByteArray(encoding); return cache.get(key); }