Examples of PKIXCertPathValidatorResult


Examples of java.security.cert.PKIXCertPathValidatorResult

        if (ta == null) {
            fail(getName() + ": not performed (could not create test TrustAnchor)");
        }

        // no valid policy tree case (null)
        PKIXCertPathValidatorResult vr =
            new PKIXCertPathValidatorResult(
                    ta,
                    null,
                    testPublicKey);

        // must return the same reference passed
        // as a parameter to the constructor
        assertNull(vr.getPolicyTree());
    }
View Full Code Here

Examples of java.security.cert.PKIXCertPathValidatorResult

        TrustAnchor ta = TestUtils.getTrustAnchor();
        if (ta == null) {
            fail(getName() + ": not performed (could not create test TrustAnchor)");
        }

        PKIXCertPathValidatorResult vr1 =
            new PKIXCertPathValidatorResult(
                    ta,
                    TestUtils.getPolicyTree(),
                    testPublicKey);

        PKIXCertPathValidatorResult vr2 =
            (PKIXCertPathValidatorResult) vr1.clone();

        // check that method makes shallow copy
        assertNotSame("notSame", vr1, vr2);
        assertSame("trustAncor", vr1.getTrustAnchor(), vr2.getTrustAnchor());
        assertSame("policyTree", vr1.getPolicyTree(), vr2.getPolicyTree());
        assertSame("publicKey", vr1.getPublicKey(), vr2.getPublicKey());

        // Regression for HARMONY-2786.
        byte[] encoding = { 0x01 };
        MyPKIXCertPathBuilderResult my = new MyPKIXCertPathBuilderResult(ta,
                TestUtils.getPolicyTree(), testPublicKey, encoding);
View Full Code Here

Examples of java.security.cert.PKIXCertPathValidatorResult

        TrustAnchor ta = TestUtils.getTrustAnchor();
        if (ta == null) {
            fail(getName() + ": not performed (could not create test TrustAnchor)");
        }

        PKIXCertPathValidatorResult vr =
            new PKIXCertPathValidatorResult(
                    ta,
                    TestUtils.getPolicyTree(),
                    testPublicKey);

        assertNotNull(vr.toString());
    }
View Full Code Here

Examples of java.security.cert.PKIXCertPathValidatorResult

        TrustAnchor ta = TestUtils.getTrustAnchor();
        if (ta == null) {
            fail(getName() + ": not performed (could not create test TrustAnchor)");
        }

        PKIXCertPathValidatorResult vr =
            new PKIXCertPathValidatorResult(
                    ta,
                    null,
                    testPublicKey);

        assertNotNull(vr.toString());
    }
View Full Code Here

Examples of java.security.cert.PKIXCertPathValidatorResult

                    PolicyChecker.ANY_POLICY, null, false,
                    Collections.singleton(PolicyChecker.ANY_POLICY), false);
                PolicyNode policyTree =
                    doValidate(anchor, cp, certList, pkixParam, rootNode);
                // if this anchor works, return success
                return new PKIXCertPathValidatorResult(anchor, policyTree,
                    basicChecker.getPublicKey());
            } catch (CertPathValidatorException cpe) {
                // remember this exception
                lastException = cpe;
            }
View Full Code Here

Examples of java.security.cert.PKIXCertPathValidatorResult

                            try {
                                CertPathValidator validator = CertPathValidator.getInstance("PKIX");
                                CertPath path = CertificateFactory.getInstance("X509").generateCertPath(Arrays.asList(certs));
                                PKIXParameters params = new PKIXParameters(new HashSet(Arrays.asList(myTrustedAnchors)));
                                params.setRevocationEnabled(false);
                                PKIXCertPathValidatorResult result = (PKIXCertPathValidatorResult) validator.validate(path, params);
                                if (result != null && result.getTrustAnchor() != null) {
                                    return;
                                }                       
                            } catch (NoSuchAlgorithmException e1) {
                            } catch (CertPathValidatorException e) {
                            } catch (InvalidAlgorithmParameterException e) {
View Full Code Here

Examples of java.security.cert.PKIXCertPathValidatorResult

                    PolicyChecker.ANY_POLICY, null, false,
                    Collections.singleton(PolicyChecker.ANY_POLICY), false);
                PolicyNode policyTree =
                    doValidate(anchor, cp, certList, pkixParam, rootNode);
                // if this anchor works, return success
                return new PKIXCertPathValidatorResult(anchor, policyTree,
                    basicChecker.getPublicKey());
            } catch (CertPathValidatorException cpe) {
                // remember this exception
                lastException = cpe;
            }
View Full Code Here

Examples of java.security.cert.PKIXCertPathValidatorResult

            // check whether the issuer of <tbvCert> is a TrustAnchor
            if (CertPathValidatorUtilities.findTrustAnchor(tbvCert, pkixParams.getTrustAnchors(),
                pkixParams.getSigProvider()) != null)
            {
                CertPath certPath;
                PKIXCertPathValidatorResult result;
                try
                {
                    certPath = cFact.generateCertPath(tbvPath);
                }
                catch (Exception e)
                {
                    throw new AnnotatedException(
                                            "Certification path could not be constructed from certificate list.",
                                            e);
                }

                try
                {
                    result = (PKIXCertPathValidatorResult) validator.validate(
                            certPath, pkixParams);
                }
                catch (Exception e)
                {
                    throw new AnnotatedException(
                                            "Certification path could not be validated.",
                                            e);
                }

                return new PKIXCertPathBuilderResult(certPath, result
                        .getTrustAnchor(), result.getPolicyTree(), result
                        .getPublicKey());

            }
            else
            {
View Full Code Here

Examples of java.security.cert.PKIXCertPathValidatorResult

        PKIXPolicyNode intersection = RFC3280CertPathUtilities.wrapupCertG(certPath, paramsPKIX, userInitialPolicySet,
                index + 1, policyNodes, validPolicyTree, acceptablePolicies);

        if ((explicitPolicy > 0) || (intersection != null))
        {
            return new PKIXCertPathValidatorResult(trust, intersection, cert.getPublicKey());
        }

        throw new CertPathValidatorException("Path processing failed on policy.", null, certPath, index);
    }
View Full Code Here

Examples of java.security.cert.PKIXCertPathValidatorResult

                    if (xcrl.isRevoked(p[p.length - 1]))
                      throw new CertPathValidatorException("certificate is revoked");
                  }
              }
            // The chain is valid; return the result.
            return new PKIXCertPathValidatorResult(anchor, rootNode,
                                                   p[0].getPublicKey());
          }
        catch (Exception ignored)
          {
            cause = ignored;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.