/** * @see java.security.cert.CertificateFactorySpi#engineGenerateCertPath(List) * method documentation for more info */ public CertPath engineGenerateCertPath(List<? extends Certificate> certificates) throws CertificateException { return new X509CertPathImpl(certificates); }
/** * Returns in PkiPath format which is our default encoding. * * @see java.security.cert.CertPath#getEncoded() */ @Override public byte[] getEncoded() throws CertificateEncodingException { return getEncoded(Encoding.PKI_PATH); }
/** * @see java.security.cert.CRL#isRevoked(Certificate) * method documentation for more info */ public boolean isRevoked(Certificate cert) { if (!(cert instanceof X509Certificate)) { return false; } return getRevokedCertificate((X509Certificate) cert) != null; }
/** * Returns the CRL object corresponding to the provided encoding. * Resulting object is retrieved from the cache * if it contains such correspondence * and is constructed on the base of encoding * and stored in the cache otherwise. * @throws IOException if some decoding errors occur * (in the case of cache miss). */ private static CRL getCRL(byte[] encoding) throws CRLException, IOException { if (encoding.length < CRL_CACHE_SEED_LENGTH) { throw new CRLException("encoding.length < CRL_CACHE_SEED_LENGTH"); } synchronized (CRL_CACHE) { long hash = CRL_CACHE.getHash(encoding); if (CRL_CACHE.contains(hash)) { X509CRL res = (X509CRL) CRL_CACHE.get(hash, encoding); if (res != null) { return res; } } X509CRL res = new X509CRLImpl(encoding); CRL_CACHE.put(hash, encoding, res); return res; } }
/** * @see java.security.cert.CertPath#getEncoded(String) */ @Override public byte[] getEncoded(String encoding) throws CertificateEncodingException { final Encoding encType = Encoding.findByApiName(encoding); if (encType == null) { throw new CertificateEncodingException("Unsupported encoding: " + encoding); } return getEncoded(encType); }
public void checkValidity(Date date) throws CertificateExpiredException, CertificateNotYetValidException { checkValidity(date.getTime()); }
/** * Constructs the instance of the certificate factory provider. */ public DRLCertFactory() { // specification of the provider name, version, and description. super("DRLCertFactory", 1.0, "ASN.1, DER, PkiPath, PKCS7"); // register the service put("CertificateFactory.X509", "org.apache.harmony.security.provider.cert.X509CertFactoryImpl"); // mapping the alias put("Alg.Alias.CertificateFactory.X.509", "X509"); } }
@Override public int read(byte[] b, int off, int len) throws IOException { int read_b; int i; for (i=0; i<len; i++) { if ((read_b = read()) == -1) { return (i == 0) ? -1 : i; } b[off+i] = (byte) read_b; } return i; }
public Principal getIssuerDN() { return getIssuerX500Principal(); }
public Principal getSubjectDN() { return getSubjectX500Principal(); }
static Encoding findByApiName(String apiName) throws CertificateEncodingException { for (Encoding element : values()) { if (element.apiName.equals(apiName)) { return element; } } return null; } }
/** * @see java.security.cert.X509CRL#getRevokedCertificates() * method documentation for more info */ public Set<? extends X509CRLEntry> getRevokedCertificates() { if (!entriesRetrieved) { retrieveEntries(); } if (entries == null) { return null; } return new HashSet(entries); }
/** * @see java.security.cert.CertificateFactorySpi#engineGenerateCertPath(InputStream) * method documentation for more info */ public CertPath engineGenerateCertPath(InputStream inStream) throws CertificateException { if (inStream == null) { throw new CertificateException("inStream == null"); } return engineGenerateCertPath(inStream, "PkiPath"); }
public Date getNotBefore() { return new Date(getNotBeforeInternal()); }
public Date getNotAfter() { return new Date(getNotAfterInternal()); }
@Override public byte[] getEncoded() throws CertificateEncodingException { return getEncodedInternal().clone(); } private byte[] getEncodedInternal() throws CertificateEncodingException {
public byte[] getTBSCertificate() throws CertificateEncodingException { return getTbsCertificateInternal().clone(); }
public String getSigAlgName() { String result = sigAlgName; if (result == null) { String sigAlgOIDLocal = getSigAlgOID(); // retrieve the name of the signing algorithm result = AlgNameMapper.map2AlgName(sigAlgOIDLocal); if (result == null) { // if could not be found, use OID as a name result = sigAlgOIDLocal; } sigAlgName = result; } return result; }
public byte[] getSignature() { return getSignatureInternal().clone(); }
public void checkValidity() throws CertificateExpiredException, CertificateNotYetValidException { checkValidity(System.currentTimeMillis()); }