Search in sources :

Example 1 with CertPathValidatorResult

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

the class CertPathValidatorTest method testCertPathValidator.

public void testCertPathValidator() throws Exception {
    CertPathValidator certPathValidator = CertPathValidator.getInstance(algorithmName);
    CertPathValidatorResult validatorResult = certPathValidator.validate(getCertPath(), getParams());
    validateResult(validatorResult);
}
Also used : CertPathValidator(java.security.cert.CertPathValidator) CertPathValidatorResult(java.security.cert.CertPathValidatorResult)

Example 2 with CertPathValidatorResult

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

the class CertPathValidatorSpiTest method testCertPathValidatorSpi01.

/**
     * Test for <code>CertPathValidatorSpi</code> constructor Assertion:
     * constructs CertPathValidatorSpi
     */
public void testCertPathValidatorSpi01() throws CertPathValidatorException, InvalidAlgorithmParameterException {
    CertPathValidatorSpi certPathValid = new MyCertPathValidatorSpi();
    CertPathParameters params = null;
    CertPath certPath = null;
    CertPathValidatorResult cpvResult = certPathValid.engineValidate(certPath, params);
    assertNull("Not null CertPathValidatorResult", cpvResult);
    try {
        certPathValid.engineValidate(certPath, params);
        fail("CertPathValidatorException must be thrown");
    } catch (CertPathValidatorException e) {
    }
    try {
        certPathValid.engineValidate(certPath, params);
        fail("InvalidAlgorithmParameterException must be thrown");
    } catch (InvalidAlgorithmParameterException e) {
    }
}
Also used : CertPathValidatorException(java.security.cert.CertPathValidatorException) InvalidAlgorithmParameterException(java.security.InvalidAlgorithmParameterException) CertPathParameters(java.security.cert.CertPathParameters) CertPath(java.security.cert.CertPath) CertPathValidatorResult(java.security.cert.CertPathValidatorResult) MyCertPathValidatorSpi(org.apache.harmony.security.tests.support.cert.MyCertPathValidatorSpi) MyCertPathValidatorSpi(org.apache.harmony.security.tests.support.cert.MyCertPathValidatorSpi) CertPathValidatorSpi(java.security.cert.CertPathValidatorSpi)

Example 3 with CertPathValidatorResult

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

the class ValidateTargetConstraints method validate.

/**
     * Perform a PKIX validation.
     *
     * @param path CertPath to validate
     * @param params PKIXParameters to use in validation
     * @throws Exception on error
     */
public static void validate(CertPath path, PKIXParameters params) throws Exception {
    CertPathValidator validator = CertPathValidator.getInstance("PKIX");
    CertPathValidatorResult cpvr = validator.validate(path, params);
}
Also used : CertPathValidator(java.security.cert.CertPathValidator) CertPathValidatorResult(java.security.cert.CertPathValidatorResult)

Example 4 with CertPathValidatorResult

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

the class ValidateNC method validate.

/**
     * Perform a PKIX validation.
     *
     * @param path CertPath to validate
     * @param params PKIXParameters to use in validation
     * @throws Exception on error
     */
public static void validate(CertPath path, PKIXParameters params) throws Exception {
    CertPathValidator validator = CertPathValidator.getInstance("PKIX", "SUN");
    CertPathValidatorResult cpvr = validator.validate(path, params);
}
Also used : CertPathValidator(java.security.cert.CertPathValidator) CertPathValidatorResult(java.security.cert.CertPathValidatorResult)

Example 5 with CertPathValidatorResult

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

the class VerifyNameConstraints method validate.

/**
     * Perform a PKIX validation. On success, print the
     * CertPathValidatorResult on System.out. On failure,
     * throw an exception.
     *
     * @param path CertPath to validate
     * @param params PKIXParameters to use in validation
     * @throws Exception on error
     */
public static void validate(CertPath path, PKIXParameters params) throws Exception {
    CertPathValidator validator = CertPathValidator.getInstance("PKIX");
    CertPathValidatorResult cpvr = validator.validate(path, params);
}
Also used : CertPathValidator(java.security.cert.CertPathValidator) CertPathValidatorResult(java.security.cert.CertPathValidatorResult)

Aggregations

CertPathValidatorResult (java.security.cert.CertPathValidatorResult)8 CertPathValidator (java.security.cert.CertPathValidator)6 CertPath (java.security.cert.CertPath)4 PKIXParameters (java.security.cert.PKIXParameters)3 CertPathValidatorException (java.security.cert.CertPathValidatorException)2 CertificateFactory (java.security.cert.CertificateFactory)2 PKIXCertPathValidatorResult (java.security.cert.PKIXCertPathValidatorResult)2 Method (java.lang.reflect.Method)1 InvalidAlgorithmParameterException (java.security.InvalidAlgorithmParameterException)1 KeyStore (java.security.KeyStore)1 CertPathParameters (java.security.cert.CertPathParameters)1 CertPathValidatorSpi (java.security.cert.CertPathValidatorSpi)1 X509Certificate (java.security.cert.X509Certificate)1 MyCertPathValidatorSpi (org.apache.harmony.security.tests.support.cert.MyCertPathValidatorSpi)1