Java CertPath
Jakob Jenkov |
The Java CertPath class (java.security.cert.CertPath
represents a chain of cryptographic
identity certificates (Java Certificate objects), where each certificate is the
digital signer of the next certificate in the chain. The Java CertPath
class is typically used to
verify an identity certificate along with the certificates of the Certificate Authorities (CAs) that signed
the certificate.
Obtaining a CertPath Instance
You will typically obtain a Java CertPath
instance from a
CertificateFactory
or a CertPathBuilder
.
See the Java CertificateFactory tutorial for information about obtaining
a CertPath
instance.
getCertificates()
Once you have a Java CertPath
instance you can obtain the Certificate
instances
the CertPath
consists of by calling the CertPath
getCertificates()
method. Here is an example of obtaining the certificates from a CertPath
instance:
List<Certificate> certificates = certPath.getCertificates();
getType()
The CertPath
getType()
method returns a string telling what type of certificates
(e.g. X.509) this CertPath
instance contains. Here is an example of obtaining the
CertPath
type via getType()
:
String type = certPath.getType();
Tweet | |
Jakob Jenkov |