Name
X509Certificate
Synopsis
This class represents an X.509
certificate. Its various methods provide complete access to the
contents of the certificate. A full understanding of this class
requires detailed knowledge of the X.509 standard which is beyond the
scope of this reference. Some of the more important methods are
described here, however. getSubjectDN( )
returns
the Principal
to whom this certificate applies,
and the inherited getPublicKey( )
method returns
the PublicKey
that the certificate associates with
that Principal
. getIssuerDN( )
returns a Principal
that represents the issuer of
the certificate, and if you know the public key for that
Principal
, you can pass it to the
verify( )
method to
check the digital signature of the issuer and ensure that the
certificate is not forged. checkValidity( )
checks
whether the certificate has expired or has not yet gone into effect.
Note that verify( )
and getPublicKey(
)
are inherited from Certificate
.
Obtain an X509Certificate
object by creating a CertificateFactory
for
certificate type “X.509” and then
using generateCertificate( )
to parse an X.509
certificate from a stream of bytes. Finally, cast the
Certificate
returned by this method to an
X509Certificate
.
Figure 14-71. java.security.cert.X509Certificate
public abstract class X509Certificate extends java.security.cert.Certificate implements X509Extension { // Protected Constructors ...
Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.