@Deprecated(since="1.2", forRemoval=true) public interface Certificate
This is an interface of abstract methods for managing a variety of identity certificates. An identity certificate is a guarantee by a principal that a public key is that of another principal. (A principal represents an entity such as an individual user, a group, or a corporation.)
In particular, this interface is intended to be a common abstraction for constructs that have different formats but important common uses. For example, different types of certificates, such as X.509 certificates and PGP certificates, share general certificate functionality (the need to encode and decode certificates) and some types of information, such as a public key, the principal whose key it is, and the guarantor guaranteeing that the public key is that of the specified principal. So an implementation of X.509 certificates and an implementation of PGP certificates can both utilize the Certificate
interface, even though their formats and additional types and amounts of information stored are different.
Important: This interface is useful for cataloging and grouping objects sharing certain common uses. It does not have any semantics of its own. In particular, a Certificate
object does not make any statement as to the validity of the binding. It is the duty of the application implementing this interface to verify the certificate and satisfy itself of its validity.
Modifier and Type | Method | Description |
---|---|---|
void |
decode |
Deprecated, for removal: This API element is subject to removal in a future version. Decodes a certificate from an input stream. |
void |
encode |
Deprecated, for removal: This API element is subject to removal in a future version. Encodes the certificate to an output stream in a format that can be decoded by the decode method. |
String |
getFormat() |
Deprecated, for removal: This API element is subject to removal in a future version. Returns the name of the coding format. |
Principal |
getGuarantor() |
Deprecated, for removal: This API element is subject to removal in a future version. Returns the guarantor of the certificate, that is, the principal guaranteeing that the public key associated with this certificate is that of the principal associated with this certificate. |
Principal |
getPrincipal() |
Deprecated, for removal: This API element is subject to removal in a future version. Returns the principal of the principal-key pair being guaranteed by the guarantor. |
PublicKey |
getPublicKey() |
Deprecated, for removal: This API element is subject to removal in a future version. Returns the key of the principal-key pair being guaranteed by the guarantor. |
String |
toString |
Deprecated, for removal: This API element is subject to removal in a future version. Returns a string that represents the contents of the certificate. |
Principal getGuarantor()
Principal getPrincipal()
PublicKey getPublicKey()
void encode(OutputStream stream) throws KeyException, IOException
decode
method.stream
- the output stream to which to encode the certificate.KeyException
- if the certificate is not properly initialized, or data is missing, etc.IOException
- if a stream exception occurs while trying to output the encoded certificate to the output stream.void decode(InputStream stream) throws KeyException, IOException
getFormat
and produced by encode
.stream
- the input stream from which to fetch the data being decoded.KeyException
- if the certificate is not properly initialized, or data is missing, etc.IOException
- if an exception occurs while trying to input the encoded certificate from the input stream.String getFormat()
encode
and decode
methods.String toString(boolean detailed)
detailed
- whether or not to give detailed information about the certificate
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/security/Certificate.html
java.security.cert.Certificate
and related classes.