Search in sources :

Example 16 with X509CRLImpl

use of sun.security.x509.X509CRLImpl in project Bytecoder by mirkosertic.

the class X509Factory method engineGenerateCRL.

/**
 * Generates an X.509 certificate revocation list (CRL) object and
 * initializes it with the data read from the given input stream
 * <code>is</code>.
 *
 * @param is an input stream with the CRL data.
 *
 * @return an X.509 CRL object initialized with the data
 * from the input stream.
 *
 * @exception CRLException on parsing errors.
 */
@Override
public CRL engineGenerateCRL(InputStream is) throws CRLException {
    if (is == null) {
        // clear the cache (for debugging)
        crlCache.clear();
        throw new CRLException("Missing input stream");
    }
    try {
        byte[] encoding = readOneBlock(is);
        if (encoding != null) {
            X509CRLImpl crl = getFromCache(crlCache, encoding);
            if (crl != null) {
                return crl;
            }
            crl = new X509CRLImpl(encoding);
            addToCache(crlCache, crl.getEncodedInternal(), crl);
            return crl;
        } else {
            throw new IOException("Empty input");
        }
    } catch (IOException ioe) {
        throw new CRLException(ioe.getMessage());
    }
}
Also used : X509CRLImpl(sun.security.x509.X509CRLImpl)

Example 17 with X509CRLImpl

use of sun.security.x509.X509CRLImpl in project Bytecoder by mirkosertic.

the class AlgorithmChecker method check.

/**
 * Check the signature algorithm with the specified public key.
 *
 * @param key the public key to verify the CRL signature
 * @param crl the target CRL
 * @param variant is the Validator variants of the operation. A null value
 *                passed will set it to Validator.GENERIC.
 */
static void check(PublicKey key, X509CRL crl, String variant) throws CertPathValidatorException {
    X509CRLImpl x509CRLImpl = null;
    try {
        x509CRLImpl = X509CRLImpl.toImpl(crl);
    } catch (CRLException ce) {
        throw new CertPathValidatorException(ce);
    }
    AlgorithmId algorithmId = x509CRLImpl.getSigAlgId();
    check(key, algorithmId, variant);
}
Also used : CertPathValidatorException(java.security.cert.CertPathValidatorException) AlgorithmId(sun.security.x509.AlgorithmId) X509CRLImpl(sun.security.x509.X509CRLImpl) CRLException(java.security.cert.CRLException)

Example 18 with X509CRLImpl

use of sun.security.x509.X509CRLImpl in project j2objc by google.

the class X509Factory method intern.

/**
 * Return an interned X509CRLImpl for the given certificate.
 * For more information, see intern(X509Certificate).
 */
public static synchronized X509CRLImpl intern(X509CRL c) throws CRLException {
    if (c == null) {
        return null;
    }
    boolean isImpl = c instanceof X509CRLImpl;
    byte[] encoding;
    if (isImpl) {
        encoding = ((X509CRLImpl) c).getEncodedInternal();
    } else {
        encoding = c.getEncoded();
    }
    X509CRLImpl newC = (X509CRLImpl) getFromCache(crlCache, encoding);
    if (newC != null) {
        return newC;
    }
    if (isImpl) {
        newC = (X509CRLImpl) c;
    } else {
        newC = new X509CRLImpl(encoding);
        encoding = newC.getEncodedInternal();
    }
    addToCache(crlCache, encoding, newC);
    return newC;
}
Also used : X509CRLImpl(sun.security.x509.X509CRLImpl)

Aggregations

X509CRLImpl (sun.security.x509.X509CRLImpl)18 CRLException (java.security.cert.CRLException)10 CertificateException (java.security.cert.CertificateException)6 X509CertImpl (sun.security.x509.X509CertImpl)6 X509CRL (java.security.cert.X509CRL)4 CertPathValidatorException (java.security.cert.CertPathValidatorException)3 CertificateFactory (java.security.cert.CertificateFactory)3 PKCS7 (sun.security.pkcs.PKCS7)3 ParsingException (sun.security.pkcs.ParsingException)3 AlgorithmId (sun.security.x509.AlgorithmId)3 IOException (java.io.IOException)1 CertificateParsingException (java.security.cert.CertificateParsingException)1 X509Certificate (java.security.cert.X509Certificate)1 ArrayList (java.util.ArrayList)1