Search in sources :

Example 6 with PKIXCertPathChecker

use of java.security.cert.PKIXCertPathChecker in project XobotOS by xamarin.

the class RFC3280CertPathUtilities method wrapupCertF.

protected static void wrapupCertF(CertPath certPath, int index, List pathCheckers, Set criticalExtensions) throws CertPathValidatorException {
    List certs = certPath.getCertificates();
    X509Certificate cert = (X509Certificate) certs.get(index);
    Iterator tmpIter;
    tmpIter = pathCheckers.iterator();
    while (tmpIter.hasNext()) {
        try {
            ((PKIXCertPathChecker) tmpIter.next()).check(cert, criticalExtensions);
        } catch (CertPathValidatorException e) {
            throw new ExtCertPathValidatorException("Additional certificate path checker failed.", e, certPath, index);
        }
    }
    if (!criticalExtensions.isEmpty()) {
        throw new ExtCertPathValidatorException("Certificate has unsupported critical extension", null, certPath, index);
    }
}
Also used : CertPathValidatorException(java.security.cert.CertPathValidatorException) ExtCertPathValidatorException(org.bouncycastle.jce.exception.ExtCertPathValidatorException) ExtCertPathValidatorException(org.bouncycastle.jce.exception.ExtCertPathValidatorException) PKIXCertPathChecker(java.security.cert.PKIXCertPathChecker) Iterator(java.util.Iterator) List(java.util.List) ArrayList(java.util.ArrayList) X509Certificate(java.security.cert.X509Certificate)

Example 7 with PKIXCertPathChecker

use of java.security.cert.PKIXCertPathChecker in project jdk8u_jdk by JetBrains.

the class ForwardState method initState.

/**
     * Initialize the state.
     *
     * @param certPathCheckers the list of user-defined PKIXCertPathCheckers
     */
public void initState(List<PKIXCertPathChecker> certPathCheckers) throws CertPathValidatorException {
    subjectNamesTraversed = new HashSet<GeneralNameInterface>();
    traversedCACerts = 0;
    /*
         * Populate forwardCheckers with every user-defined checker
         * that supports forward checking and initialize the forwardCheckers
         */
    forwardCheckers = new ArrayList<PKIXCertPathChecker>();
    for (PKIXCertPathChecker checker : certPathCheckers) {
        if (checker.isForwardCheckingSupported()) {
            checker.init(true);
            forwardCheckers.add(checker);
        }
    }
    init = true;
}
Also used : GeneralNameInterface(sun.security.x509.GeneralNameInterface) PKIXCertPathChecker(java.security.cert.PKIXCertPathChecker)

Example 8 with PKIXCertPathChecker

use of java.security.cert.PKIXCertPathChecker in project robovm by robovm.

the class PKIXCertPathCheckerTest method testInit.

public final void testInit() throws CertPathValidatorException {
    PKIXCertPathChecker pc = TestUtils.getTestCertPathChecker();
    pc.init(true);
}
Also used : PKIXCertPathChecker(java.security.cert.PKIXCertPathChecker)

Example 9 with PKIXCertPathChecker

use of java.security.cert.PKIXCertPathChecker in project robovm by robovm.

the class PKIXCertPathCheckerTest method testClone.

public final void testClone() {
    PKIXCertPathChecker pc1 = TestUtils.getTestCertPathChecker();
    PKIXCertPathChecker pc2 = (PKIXCertPathChecker) pc1.clone();
    assertNotSame("notSame", pc1, pc2);
}
Also used : PKIXCertPathChecker(java.security.cert.PKIXCertPathChecker)

Example 10 with PKIXCertPathChecker

use of java.security.cert.PKIXCertPathChecker in project robovm by robovm.

the class PKIXCertPathCheckerTest method testCheck.

public final void testCheck() throws CertPathValidatorException {
    PKIXCertPathChecker pc = TestUtils.getTestCertPathChecker();
    pc.check(new MyCertificate("", null), new HashSet<String>());
}
Also used : MyCertificate(org.apache.harmony.security.tests.support.cert.MyCertificate) PKIXCertPathChecker(java.security.cert.PKIXCertPathChecker)

Aggregations

PKIXCertPathChecker (java.security.cert.PKIXCertPathChecker)15 CertPathValidatorException (java.security.cert.CertPathValidatorException)8 X509Certificate (java.security.cert.X509Certificate)8 ArrayList (java.util.ArrayList)6 Iterator (java.util.Iterator)6 List (java.util.List)6 ExtCertPathValidatorException (org.bouncycastle.jce.exception.ExtCertPathValidatorException)6 BigInteger (java.math.BigInteger)2 InvalidAlgorithmParameterException (java.security.InvalidAlgorithmParameterException)2 PublicKey (java.security.PublicKey)2 PKIXCertPathValidatorResult (java.security.cert.PKIXCertPathValidatorResult)2 PKIXParameters (java.security.cert.PKIXParameters)2 TrustAnchor (java.security.cert.TrustAnchor)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2 X500Principal (javax.security.auth.x500.X500Principal)2 DERObjectIdentifier (org.bouncycastle.asn1.DERObjectIdentifier)2 AlgorithmIdentifier (org.bouncycastle.asn1.x509.AlgorithmIdentifier)2 ExtendedPKIXParameters (org.bouncycastle.x509.ExtendedPKIXParameters)2 GeneralNameInterface (sun.security.x509.GeneralNameInterface)2