public class

X509CertInfo

extends Object
implements CertAttrSet<T>
java.lang.Object
   ↳ sun.security.x509.X509CertInfo

Class Overview

The X509CertInfo class represents X.509 certificate information.

X.509 certificates have several base data elements, including:

  • The Subject Name, an X.500 Distinguished Name for the entity (subject) for which the certificate was issued.
  • The Subject Public Key, the public key of the subject. This is one of the most important parts of the certificate.
  • The Validity Period, a time period (e.g. six months) within which the certificate is valid (unless revoked).
  • The Issuer Name, an X.500 Distinguished Name for the Certificate Authority (CA) which issued the certificate.
  • A Serial Number assigned by the CA, for use in certificate revocation and other applications.

Summary

Constants
String ALGORITHM_ID
String EXTENSIONS
String IDENT Identifier for this attribute, to be used with the get, set, delete methods of Certificate, x509 type.
String ISSUER
String ISSUER_ID
String KEY
String NAME
String SERIAL_NUMBER
String SUBJECT
String SUBJECT_ID
String VALIDITY
String VERSION
Fields
protected CertificateAlgorithmId algId
protected CertificateExtensions extensions
protected CertificateValidity interval
protected CertificateIssuerName issuer
protected CertificateIssuerUniqueIdentity issuerUniqueId
protected CertificateX509Key pubKey
protected CertificateSerialNumber serialNum
protected CertificateSubjectName subject
protected CertificateSubjectUniqueIdentity subjectUniqueId
protected CertificateVersion version
Public Constructors
X509CertInfo()
Construct an uninitialized X509CertInfo on which decode must later be called (or which may be deserialized).
X509CertInfo(byte[] cert)
Unmarshals a certificate from its encoded form, parsing the encoded bytes.
X509CertInfo(DerValue derVal)
Unmarshal a certificate from its encoded form, parsing a DER value.
Public Methods
void delete(String name)
Delete the certificate attribute.
void encode(OutputStream out)
Appends the certificate to an output stream.
boolean equals(Object other)
Compares two X509CertInfo objects.
boolean equals(X509CertInfo other)
Compares two certificates, returning false if any data differs between the two.
Object get(String name)
Get the certificate attribute.
Enumeration<String> getElements()
Return an enumeration of names of attributes existing within this attribute.
byte[] getEncodedInfo()
Returns the encoded certificate info.
String getName()
Return the name of this attribute.
int hashCode()
Calculates a hash code value for the object.
void set(String name, Object val)
Set the certificate attribute.
String toString()
Returns a printable representation of the certificate.
[Expand]
Inherited Methods
From class java.lang.Object
From interface sun.security.x509.CertAttrSet

Constants

public static final String ALGORITHM_ID

Constant Value: "algorithmID"

public static final String EXTENSIONS

Constant Value: "extensions"

public static final String IDENT

Identifier for this attribute, to be used with the get, set, delete methods of Certificate, x509 type.

Constant Value: "x509.info"

public static final String ISSUER

Constant Value: "issuer"

public static final String ISSUER_ID

Constant Value: "issuerID"

public static final String KEY

Constant Value: "key"

public static final String NAME

Constant Value: "info"

public static final String SERIAL_NUMBER

Constant Value: "serialNumber"

public static final String SUBJECT

Constant Value: "subject"

public static final String SUBJECT_ID

Constant Value: "subjectID"

public static final String VALIDITY

Constant Value: "validity"

public static final String VERSION

Constant Value: "version"

Fields

protected CertificateAlgorithmId algId

protected CertificateExtensions extensions

protected CertificateValidity interval

protected CertificateIssuerName issuer

protected CertificateIssuerUniqueIdentity issuerUniqueId

protected CertificateX509Key pubKey

protected CertificateSerialNumber serialNum

protected CertificateSubjectName subject

protected CertificateSubjectUniqueIdentity subjectUniqueId

protected CertificateVersion version

Public Constructors

public X509CertInfo ()

Construct an uninitialized X509CertInfo on which decode must later be called (or which may be deserialized).

public X509CertInfo (byte[] cert)

Unmarshals a certificate from its encoded form, parsing the encoded bytes. This form of constructor is used by agents which need to examine and use certificate contents. That is, this is one of the more commonly used constructors. Note that the buffer must include only a certificate, and no "garbage" may be left at the end. If you need to ignore data at the end of a certificate, use another constructor.

Parameters
cert the encoded bytes, with no trailing data.
Throws
CertificateParsingException on parsing errors.

public X509CertInfo (DerValue derVal)

Unmarshal a certificate from its encoded form, parsing a DER value. This form of constructor is used by agents which need to examine and use certificate contents.

Parameters
derVal the der value containing the encoded cert.
Throws
CertificateParsingException on parsing errors.

Public Methods

public void delete (String name)

Delete the certificate attribute.

Parameters
name the name of the attribute to delete.
Throws
CertificateException on invalid attributes.
IOException on other errors.

public void encode (OutputStream out)

Appends the certificate to an output stream.

Parameters
out an output stream to which the certificate is appended.
Throws
CertificateException on encoding errors.
IOException on other errors.

public boolean equals (Object other)

Compares two X509CertInfo objects. This is false if the certificates are not both X.509 certs, otherwise it compares them as binary data.

Parameters
other the object being compared with this one
Returns
  • true iff the certificates are equivalent

public boolean equals (X509CertInfo other)

Compares two certificates, returning false if any data differs between the two.

Parameters
other the object being compared with this one
Returns
  • true iff the certificates are equivalent

public Object get (String name)

Get the certificate attribute.

Parameters
name the name of the attribute to return.
Throws
CertificateException on invalid attributes.
IOException on other errors.

public Enumeration<String> getElements ()

Return an enumeration of names of attributes existing within this attribute.

Returns
  • an enumeration of the attribute names.

public byte[] getEncodedInfo ()

Returns the encoded certificate info.

Throws
CertificateEncodingException on encoding information errors.

public String getName ()

Return the name of this attribute.

Returns
  • the name of this CertAttrSet.

public int hashCode ()

Calculates a hash code value for the object. Objects which are equal will also have the same hashcode.

Returns
  • a hash code value for this object.

public void set (String name, Object val)

Set the certificate attribute.

Parameters
name the name of the attribute (e.g. "x509.info.key")
val the attribute object.
Throws
CertificateException on invalid attributes.
IOException on other errors.

public String toString ()

Returns a printable representation of the certificate.

Returns
  • a string representation of the object.