Search in sources :

Example 1 with PKIXAttrCertChecker

use of com.github.zhenwei.provider.x509.PKIXAttrCertChecker in project LinLong-Java by zhenwei1108.

the class RFC3281CertPathUtilities method processAttrCert7.

protected static void processAttrCert7(X509AttributeCertificate attrCert, CertPath certPath, CertPath holderCertPath, PKIXExtendedParameters pkixParams, Set attrCertCheckers) throws CertPathValidatorException {
    // TODO:
    // AA Controls
    // Attribute encryption
    // Proxy
    Set set = attrCert.getCriticalExtensionOIDs();
    // target information checked in step 6 / X509AttributeCertStoreSelector
    if (set.contains(TARGET_INFORMATION)) {
        try {
            TargetInformation.getInstance(CertPathValidatorUtilities.getExtensionValue(attrCert, TARGET_INFORMATION));
        } catch (AnnotatedException e) {
            throw new ExtCertPathValidatorException("Target information extension could not be read.", e);
        } catch (IllegalArgumentException e) {
            throw new ExtCertPathValidatorException("Target information extension could not be read.", e);
        }
    }
    set.remove(TARGET_INFORMATION);
    for (Iterator it = attrCertCheckers.iterator(); it.hasNext(); ) {
        ((PKIXAttrCertChecker) it.next()).check(attrCert, certPath, holderCertPath, set);
    }
    if (!set.isEmpty()) {
        throw new CertPathValidatorException("Attribute certificate contains unsupported critical extensions: " + set);
    }
}
Also used : CertPathValidatorException(java.security.cert.CertPathValidatorException) ExtCertPathValidatorException(com.github.zhenwei.provider.jce.exception.ExtCertPathValidatorException) LinkedHashSet(java.util.LinkedHashSet) Set(java.util.Set) ExtCertPathValidatorException(com.github.zhenwei.provider.jce.exception.ExtCertPathValidatorException) Iterator(java.util.Iterator) PKIXAttrCertChecker(com.github.zhenwei.provider.x509.PKIXAttrCertChecker)

Aggregations

ExtCertPathValidatorException (com.github.zhenwei.provider.jce.exception.ExtCertPathValidatorException)1 PKIXAttrCertChecker (com.github.zhenwei.provider.x509.PKIXAttrCertChecker)1 CertPathValidatorException (java.security.cert.CertPathValidatorException)1 Iterator (java.util.Iterator)1 LinkedHashSet (java.util.LinkedHashSet)1 Set (java.util.Set)1