Name
CertificateFactory
Synopsis
This class defines methods for parsing
certificates, certificate chains (certification paths) and
certificate
revocation lists (CRLs) from byte streams. Obtain a
CertificateFactory
by calling one of the static
getInstance( )
factory methods and specifying the
type of certificate or CRL to be parsed, and, optionally, the desired
service provider to perform the parsing. The default
“SUN” provider defines only a
single “X.509” certificate type, so
you typically obtain a CertificateFactory
with
this code:
CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
Once you have obtained a CertificateFactory
for
the desired type of certificate, call
generateCertificate( )
to
parse a Certificate
from a specified byte stream,
or call
generateCertificates( )
to
parse a group of unrelated certificates (i.e. certificates that do
not form a certificate chain) from a stream and return them as a
Collection
of Certificate
objects. Similarly, call
generateCRL( )
to parse a
single CRL object from a stream, and call generateCRLs(
)
to parse a Collection
of
CRL
objects from the stream. These
CertificateFactory
methods read to the end of the
specified stream. If the stream supports
mark( )
and
reset(
)
, however, the CertificateFactory
resets the stream to the position after the end of the last
certificate or CRL read. If you specified a certificate type of
“X.509”, the
Certificate
and CRL
objects
returned by a CertificateFactory
can be cast safely ...
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.