0N/A/*
2362N/A * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage java.security.cert;
0N/A
0N/Aimport java.security.PublicKey;
0N/A
0N/A/**
0N/A * This class represents the successful result of the PKIX certification
0N/A * path builder algorithm. All certification paths that are built and
0N/A * returned using this algorithm are also validated according to the PKIX
0N/A * certification path validation algorithm.
0N/A *
0N/A * <p>Instances of <code>PKIXCertPathBuilderResult</code> are returned by
0N/A * the <code>build</code> method of <code>CertPathBuilder</code>
0N/A * objects implementing the PKIX algorithm.
0N/A *
0N/A * <p>All <code>PKIXCertPathBuilderResult</code> objects contain the
0N/A * certification path constructed by the build algorithm, the
0N/A * valid policy tree and subject public key resulting from the build
0N/A * algorithm, and a <code>TrustAnchor</code> describing the certification
0N/A * authority (CA) that served as a trust anchor for the certification path.
0N/A * <p>
0N/A * <b>Concurrent Access</b>
0N/A * <p>
0N/A * Unless otherwise specified, the methods defined in this class are not
0N/A * thread-safe. Multiple threads that need to access a single
0N/A * object concurrently should synchronize amongst themselves and
0N/A * provide the necessary locking. Multiple threads each manipulating
0N/A * separate objects need not synchronize.
0N/A *
0N/A * @see CertPathBuilderResult
0N/A *
0N/A * @since 1.4
0N/A * @author Anne Anderson
0N/A */
0N/Apublic class PKIXCertPathBuilderResult extends PKIXCertPathValidatorResult
0N/A implements CertPathBuilderResult {
0N/A
0N/A private CertPath certPath;
0N/A
0N/A /**
0N/A * Creates an instance of <code>PKIXCertPathBuilderResult</code>
0N/A * containing the specified parameters.
0N/A *
0N/A * @param certPath the validated <code>CertPath</code>
0N/A * @param trustAnchor a <code>TrustAnchor</code> describing the CA that
0N/A * served as a trust anchor for the certification path
0N/A * @param policyTree the immutable valid policy tree, or <code>null</code>
0N/A * if there are no valid policies
0N/A * @param subjectPublicKey the public key of the subject
0N/A * @throws NullPointerException if the <code>certPath</code>,
0N/A * <code>trustAnchor</code> or <code>subjectPublicKey</code> parameters
0N/A * are <code>null</code>
0N/A */
0N/A public PKIXCertPathBuilderResult(CertPath certPath,
0N/A TrustAnchor trustAnchor, PolicyNode policyTree,
0N/A PublicKey subjectPublicKey)
0N/A {
0N/A super(trustAnchor, policyTree, subjectPublicKey);
0N/A if (certPath == null)
0N/A throw new NullPointerException("certPath must be non-null");
0N/A this.certPath = certPath;
0N/A }
0N/A
0N/A /**
0N/A * Returns the built and validated certification path. The
0N/A * <code>CertPath</code> object does not include the trust anchor.
0N/A * Instead, use the {@link #getTrustAnchor() getTrustAnchor()} method to
0N/A * obtain the <code>TrustAnchor</code> that served as the trust anchor
0N/A * for the certification path.
0N/A *
0N/A * @return the built and validated <code>CertPath</code> (never
0N/A * <code>null</code>)
0N/A */
0N/A public CertPath getCertPath() {
0N/A return certPath;
0N/A }
0N/A
0N/A /**
0N/A * Return a printable representation of this
0N/A * <code>PKIXCertPathBuilderResult</code>.
0N/A *
0N/A * @return a <code>String</code> describing the contents of this
0N/A * <code>PKIXCertPathBuilderResult</code>
0N/A */
0N/A public String toString() {
0N/A StringBuffer sb = new StringBuffer();
0N/A sb.append("PKIXCertPathBuilderResult: [\n");
0N/A sb.append(" Certification Path: " + certPath + "\n");
0N/A sb.append(" Trust Anchor: " + getTrustAnchor().toString() + "\n");
0N/A sb.append(" Policy Tree: " + String.valueOf(getPolicyTree()) + "\n");
0N/A sb.append(" Subject Public Key: " + getPublicKey() + "\n");
0N/A sb.append("]");
0N/A return sb.toString();
0N/A }
0N/A}