3909N/A * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 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 * 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 * 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. 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 0N/A * An immutable sequence of certificates (a certification path). 0N/A * This is an abstract class that defines the methods common to all 0N/A * <code>CertPath</code>s. Subclasses can handle different kinds of 0N/A * certificates (X.509, PGP, etc.). 0N/A * All <code>CertPath</code> objects have a type, a list of 0N/A * <code>Certificate</code>s, and one or more supported encodings. Because the 0N/A * <code>CertPath</code> class is immutable, a <code>CertPath</code> cannot 0N/A * change in any externally visible way after being constructed. This 0N/A * stipulation applies to all public fields and methods of this class and any 0N/A * added or overridden by subclasses. 0N/A * The type is a <code>String</code> that identifies the type of 0N/A * <code>Certificate</code>s in the certification path. For each 0N/A * certificate <code>cert</code> in a certification path <code>certPath</code>, 0N/A * <code>cert.getType().equals(certPath.getType())</code> must be 0N/A * <code>true</code>. 0N/A * The list of <code>Certificate</code>s is an ordered <code>List</code> of 0N/A * zero or more <code>Certificate</code>s. This <code>List</code> and all 0N/A * of the <code>Certificate</code>s contained in it must be immutable. 0N/A * Each <code>CertPath</code> object must support one or more encodings 0N/A * so that the object can be translated into a byte array for storage or 0N/A * transmission to other parties. Preferably, these encodings should be 0N/A * well-documented standards (such as PKCS#7). One of the encodings supported 0N/A * by a <code>CertPath</code> is considered the default encoding. This 0N/A * encoding is used if no encoding is explicitly requested (for the 0N/A * {@link #getEncoded() getEncoded()} method, for instance). 0N/A * All <code>CertPath</code> objects are also <code>Serializable</code>. 0N/A * <code>CertPath</code> objects are resolved into an alternate 0N/A * {@link CertPathRep CertPathRep} object during serialization. This allows 0N/A * a <code>CertPath</code> object to be serialized into an equivalent 0N/A * representation regardless of its underlying implementation. 0N/A * <code>CertPath</code> objects can be created with a 0N/A * <code>CertificateFactory</code> or they can be returned by other classes, 0N/A * such as a <code>CertPathBuilder</code>. 0N/A * By convention, X.509 <code>CertPath</code>s (consisting of 0N/A * <code>X509Certificate</code>s), are ordered starting with the target 0N/A * certificate and ending with a certificate issued by the trust anchor. That 0N/A * is, the issuer of one certificate is the subject of the following one. The 0N/A * certificate representing the {@link TrustAnchor TrustAnchor} should not be 0N/A * included in the certification path. Unvalidated X.509 <code>CertPath</code>s 0N/A * may not follow these conventions. PKIX <code>CertPathValidator</code>s will 0N/A * detect any departure from these conventions that cause the certification 0N/A * path to be invalid and throw a <code>CertPathValidatorException</code>. 3465N/A * <p> Every implementation of the Java platform is required to support the 3465N/A * following standard <code>CertPath</code> encodings: 3465N/A * <li><tt>PkiPath</tt></li> 3465N/A * These encodings are described in the <a href= 3465N/A * CertPath Encodings section</a> of the 3465N/A * Java Cryptography Architecture Standard Algorithm Name Documentation. 3465N/A * Consult the release documentation for your implementation to see if any 3465N/A * other encodings are supported. 0N/A * <b>Concurrent Access</b> 0N/A * All <code>CertPath</code> objects must be thread-safe. That is, multiple 0N/A * threads may concurrently invoke the methods defined in this class on a 0N/A * single <code>CertPath</code> object (or more than one) with no 0N/A * ill effects. This is also true for the <code>List</code> returned by 0N/A * <code>CertPath.getCertificates</code>. 0N/A * Requiring <code>CertPath</code> objects to be immutable and thread-safe 0N/A * allows them to be passed around to various pieces of code without worrying 0N/A * about coordinating access. Providing this thread-safety is 0N/A * generally not difficult, since the <code>CertPath</code> and 0N/A * <code>List</code> objects in question are immutable. 0N/A * @see CertificateFactory 0N/A * @see CertPathBuilder 0N/A * @author Yassir Elley 0N/A * Creates a <code>CertPath</code> of the specified type. 0N/A * This constructor is protected because most users should use a 0N/A * <code>CertificateFactory</code> to create <code>CertPath</code>s. 0N/A * @param type the standard name of the type of 0N/A * <code>Certificate</code>s in this path 0N/A * Returns the type of <code>Certificate</code>s in this certification 0N/A * path. This is the same string that would be returned by 0N/A * {@link java.security.cert.Certificate#getType() cert.getType()} 0N/A * for all <code>Certificate</code>s in the certification path. 0N/A * @return the type of <code>Certificate</code>s in this certification 0N/A * Returns an iteration of the encodings supported by this certification 0N/A * path, with the default encoding first. Attempts to modify the returned 0N/A * <code>Iterator</code> via its <code>remove</code> method result in an 0N/A * <code>UnsupportedOperationException</code>. 0N/A * @return an <code>Iterator</code> over the names of the supported 0N/A * encodings (as Strings) 0N/A * Compares this certification path for equality with the specified 0N/A * object. Two <code>CertPath</code>s are equal if and only if their 0N/A * types are equal and their certificate <code>List</code>s (and by 0N/A * implication the <code>Certificate</code>s in those <code>List</code>s) 0N/A * are equal. A <code>CertPath</code> is never equal to an object that is 0N/A * not a <code>CertPath</code>. 0N/A * This algorithm is implemented by this method. If it is overridden, 0N/A * the behavior specified here must be maintained. 0N/A * @param other the object to test for equality with this certification path 0N/A * @return true if the specified object is equal to this certification path, 0N/A * Returns the hashcode for this certification path. The hash code of 0N/A * a certification path is defined to be the result of the following 0N/A * hashCode = path.getType().hashCode(); 0N/A * hashCode = 31*hashCode + path.getCertificates().hashCode(); 0N/A * This ensures that <code>path1.equals(path2)</code> implies that 0N/A * <code>path1.hashCode()==path2.hashCode()</code> for any two certification 0N/A * paths, <code>path1</code> and <code>path2</code>, as required by the 0N/A * general contract of <code>Object.hashCode</code>. 0N/A * @return the hashcode value for this certification path 0N/A * Returns a string representation of this certification path. 0N/A * This calls the <code>toString</code> method on each of the 0N/A * <code>Certificate</code>s in the path. 0N/A * @return a string representation of this certification path 0N/A +
"===============Certificate " + i +
" start.\n");
0N/A +
"=================Certificate " + i +
" end.\n\n\n");
0N/A * Returns the encoded form of this certification path, using the default 0N/A * @return the encoded bytes 0N/A * @exception CertificateEncodingException if an encoding error occurs 0N/A * Returns the encoded form of this certification path, using the 0N/A * specified encoding. 0N/A * @param encoding the name of the encoding to use 0N/A * @return the encoded bytes 0N/A * @exception CertificateEncodingException if an encoding error occurs or 0N/A * the encoding requested is not supported 0N/A * Returns the list of certificates in this certification path. 0N/A * The <code>List</code> returned must be immutable and thread-safe. 0N/A * @return an immutable <code>List</code> of <code>Certificate</code>s 0N/A * (may be empty, but not null) 0N/A * Replaces the <code>CertPath</code> to be serialized with a 0N/A * <code>CertPathRep</code> object. 0N/A * @return the <code>CertPathRep</code> to be serialized 0N/A * @throws ObjectStreamException if a <code>CertPathRep</code> object 0N/A * representing this certification path could not be created 0N/A (
"java.security.cert.CertPath: " +
type);
0N/A * Alternate <code>CertPath</code> class for serialization. 0N/A /** The Certificate type */ 0N/A /** The encoded form of the cert path */ 0N/A * Creates a <code>CertPathRep</code> with the specified 0N/A * type and encoded form of a certification path. 0N/A * @param type the standard name of a <code>CertPath</code> type 0N/A * @param data the encoded form of the certification path 0N/A * Returns a <code>CertPath</code> constructed from the type and data. 0N/A * @return the resolved <code>CertPath</code> object 0N/A * @throws ObjectStreamException if a <code>CertPath</code> could not 0N/A (
"java.security.cert.CertPath: " +
type);