Package java.security.cert
Class CertPath
- java.lang.Object
-
- java.security.cert.CertPath
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
OpenSSLX509CertPath,PKIXCertPath
public abstract class CertPath extends Object implements Serializable
An immutable certificate path that can be validated. All certificates in the path are of the same type (i.e., X509).A
CertPathcan be represented as a byte array in at least one supported encoding scheme (i.e. PkiPath or PKCS7) when serialized.When a
Listof the certificates is obtained it must be immutable.A
CertPathmust be thread-safe without requiring coordinated access.- See Also:
Certificate, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classCertPath.CertPathRepThe alternateSerializableclass to be used for serialization and deserialization onCertPathobjects.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanequals(Object other)ReturnstrueifCertificates in the list are the same type and the lists are equal (and by implication the certificates contained within are the same).abstract List<? extends Certificate>getCertificates()Returns an immutable List of theCertificates contained in theCertPath.abstract byte[]getEncoded()Returns an encoding of theCertPathusing the default encoding.abstract byte[]getEncoded(String encoding)abstract Iterator<String>getEncodings()Returns anIteratorover the supported encodings for a representation of the certificate path.StringgetType()Returns the type ofCertificatein this instance.inthashCode()OverridesObject.hashCode().StringtoString()Returns aStringrepresentation of thisCertPathinstance.protected ObjectwriteReplace()Returns an alternate object to be serialized.
-
-
-
Constructor Detail
-
CertPath
protected CertPath(String type)
Creates a newCertPathinstance for the specified certificate type.- Parameters:
type- the certificate type.
-
-
Method Detail
-
getType
public String getType()
Returns the type ofCertificatein this instance.- Returns:
- the certificate type.
-
equals
public boolean equals(Object other)
ReturnstrueifCertificates in the list are the same type and the lists are equal (and by implication the certificates contained within are the same).- Overrides:
equalsin classObject- Parameters:
other-CertPathto be compared for equality.- Returns:
trueif the object are equal,falseotherwise.- See Also:
Object.hashCode()
-
hashCode
public int hashCode()
OverridesObject.hashCode(). The function is defined as follows:hashCode = 31 * path.getType().hashCode() + path.getCertificates().hashCode();- Overrides:
hashCodein classObject- Returns:
- the hash code for this instance.
- See Also:
Object.equals(java.lang.Object)
-
toString
public String toString()
Returns aStringrepresentation of thisCertPathinstance. It is the result of callingtoStringon allCertificates in theList.
-
getCertificates
public abstract List<? extends Certificate> getCertificates()
Returns an immutable List of theCertificates contained in theCertPath.- Returns:
- a list of
Certificates in theCertPath.
-
getEncoded
public abstract byte[] getEncoded() throws CertificateEncodingExceptionReturns an encoding of theCertPathusing the default encoding.- Returns:
- default encoding of the
CertPath. - Throws:
CertificateEncodingException- if the encoding fails.
-
getEncoded
public abstract byte[] getEncoded(String encoding) throws CertificateEncodingException
- Throws:
CertificateEncodingException- if the encoding fails.
-
getEncodings
public abstract Iterator<String> getEncodings()
Returns anIteratorover the supported encodings for a representation of the certificate path.- Returns:
Iteratorover supported encodings (asStrings).
-
writeReplace
protected Object writeReplace() throws ObjectStreamException
Returns an alternate object to be serialized.- Returns:
- an alternate object to be serialized.
- Throws:
ObjectStreamException- if the creation of the alternate object fails.
-
-