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