This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


java.security
interface Certificate


Most common ways to construct:

KeyStore ks = …;
String alias = …;

Certificate cert = ks.getCertificate(alias);

Based on 11 examples

 

Iterator i = …;

Certificate cert = (Certificate)i.next();

Based on 9 examples

 

CertificateFactory cf = …;
BufferedInputStream bis = …;

Certificate cert = cf.generateCertificate(bis);

Based on 9 examples


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.


Method Summary
 void

          Decodes a certificate from an input stream.
 void

          Encodes the certificate to an output stream in a format that can be decoded by the decode method.
 String

          Returns the name of the coding format.
 Principal

          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

          Returns the principal of the principal-key pair being guaranteed by the guarantor.
 PublicKey

          Returns the key of the principal-key pair being guaranteed by the guarantor.
 String
toString(boolean detailed)

          Returns a string that represents the contents of the certificate.
 

Method Detail

decode

public void decode(InputStream stream)
            throws KeyException,
                   IOException
Decodes a certificate from an input stream. The format should be that returned by getFormat and produced by encode.

Parameters:
stream - the input stream from which to fetch the data being decoded.
Throws:
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.

encode

public void encode(OutputStream stream)
            throws KeyException,
                   IOException
Encodes the certificate to an output stream in a format that can be decoded by the decode method.

Parameters:
stream - the output stream to which to encode the certificate.
Throws:
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.

getFormat

public String getFormat()
Returns the name of the coding format. This is used as a hint to find an appropriate parser. It could be "X.509", "PGP", etc. This is the format produced and understood by the encode and decode methods.

Returns:
the name of the coding format.

getGuarantor

public Principal getGuarantor()
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. For X.509 certificates, the guarantor will typically be a Certificate Authority (such as the United States Postal Service or Verisign, Inc.).

Returns:
the guarantor which guaranteed the principal-key binding.

getPrincipal

public Principal getPrincipal()
Returns the principal of the principal-key pair being guaranteed by the guarantor.

Returns:
the principal to which this certificate is bound.

getPublicKey

public PublicKey getPublicKey()
Returns the key of the principal-key pair being guaranteed by the guarantor.

Returns:
the public key that this certificate certifies belongs to a particular principal.

toString

public String toString(boolean detailed)
Returns a string that represents the contents of the certificate.

Parameters:
detailed - whether or not to give detailed information about the certificate
Returns:
a string representing the contents of the certificate


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.