Search in sources :

Example 1 with InhibitAnyPolicyExtension

use of sun.security.x509.InhibitAnyPolicyExtension in project jdk8u_jdk by JetBrains.

the class PolicyChecker method mergeInhibitAnyPolicy.

/**
     * Merges the specified inhibitAnyPolicy value with the
     * SkipCerts value of the InhibitAnyPolicy
     * extension obtained from the certificate.
     *
     * @param inhibitAnyPolicy an integer which indicates whether
     * "any-policy" is considered a match
     * @param currCert the Certificate to be processed
     * @return returns the new inhibitAnyPolicy value
     * @exception CertPathValidatorException Exception thrown if an error
     * occurs
     */
static int mergeInhibitAnyPolicy(int inhibitAnyPolicy, X509CertImpl currCert) throws CertPathValidatorException {
    if ((inhibitAnyPolicy > 0) && !X509CertImpl.isSelfIssued(currCert)) {
        inhibitAnyPolicy--;
    }
    try {
        InhibitAnyPolicyExtension inhAnyPolExt = (InhibitAnyPolicyExtension) currCert.getExtension(InhibitAnyPolicy_Id);
        if (inhAnyPolExt == null)
            return inhibitAnyPolicy;
        int skipCerts = inhAnyPolExt.get(InhibitAnyPolicyExtension.SKIP_CERTS).intValue();
        if (debug != null)
            debug.println("PolicyChecker.mergeInhibitAnyPolicy() " + "skipCerts Index from cert = " + skipCerts);
        if (skipCerts != -1) {
            if (skipCerts < inhibitAnyPolicy) {
                inhibitAnyPolicy = skipCerts;
            }
        }
    } catch (IOException e) {
        if (debug != null) {
            debug.println("PolicyChecker.mergeInhibitAnyPolicy " + "unexpected exception");
            e.printStackTrace();
        }
        throw new CertPathValidatorException(e);
    }
    return inhibitAnyPolicy;
}
Also used : CertPathValidatorException(java.security.cert.CertPathValidatorException) IOException(java.io.IOException) InhibitAnyPolicyExtension(sun.security.x509.InhibitAnyPolicyExtension)

Aggregations

IOException (java.io.IOException)1 CertPathValidatorException (java.security.cert.CertPathValidatorException)1 InhibitAnyPolicyExtension (sun.security.x509.InhibitAnyPolicyExtension)1