APIdia Launch Partner
Top Description Fields Constructors Methods
sun.security.x509

public Class X509CertInfo

extends Object
Class Inheritance
Imports
java.io.IOException, java.security.cert.*, java.util.*, sun.security.util.*, .HexDumpEncoder

The X509CertInfo class represents X.509 certificate information.

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

Authors
Amit Kapoor, Hemma Prafullchandra
See Also
DerEncoder, X509CertImpl

Field Summary

Modifier and TypeField and Description
protected CertificateAlgorithmId
public static final String
public static final String
public static final String
protected CertificateExtensions
protected CertificateValidity
public static final String
protected X500Name
public static final String
protected UniqueIdentity
public static final String
public static final String
protected CertificateX509Key
private byte[]
public static final String
protected CertificateSerialNumber
public static final String
protected X500Name
public static final String
protected UniqueIdentity
public static final String
public static final String
protected CertificateVersion

Constructor Summary

AccessConstructor and Description
public
X509CertInfo()

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

public
X509CertInfo(byte[]
the encoded bytes, with no trailing data.
cert
)

Unmarshals a certificate from its encoded form, parsing the encoded bytes.

public
X509CertInfo(DerValue
the der value containing the encoded cert.
derVal
)

Unmarshal a certificate from its encoded form, parsing a DER value.

Method Summary

Modifier and TypeMethod and Description
private void
public void
encode(DerOutputStream
an output stream to which the certificate is appended.
out
)

Appends the certificate to an output stream.

public boolean

Returns:

true iff the certificates are equivalent
equals
(Object
the object being compared with this one
obj
)

Overrides java.lang.Object.equals.

Compares two X509CertInfo objects.

public CertificateAlgorithmId
public byte[]
getEncodedInfo()

Returns the encoded certificate info.

public CertificateExtensions
public X500Name
public UniqueIdentity
public CertificateX509Key
public CertificateSerialNumber
public X500Name
public UniqueIdentity
public CertificateValidity
public CertificateVersion
private Object
getX500Name(String name, boolean getIssuer)

public int
hashCode()

Overrides java.lang.Object.hashCode.

Calculates a hash code value for the object.

private void
public void
setAlgorithmId(CertificateAlgorithmId
the Object class value for the AlgorithmId
val
)

Set the algorithm id of the certificate.

public void
setExtensions(CertificateExtensions
the Object class value for the Extensions
val
)

Set the extensions in the certificate.

public void
setIssuer(X500Name
the Object class value for the issuer
val
)

Set the issuer name of the certificate.

public void
setIssuerUniqueId(UniqueIdentity
the Object class value for the IssuerUniqueId
val
)

Set the Issuer Unique Identity in the certificate.

public void
setKey(CertificateX509Key
the Object class value for the PublicKey
val
)

Set the public key in the certificate.

public void
setSerialNumber(CertificateSerialNumber
the Object class value for the CertificateSerialNumber
val
)

Set the serial number of the certificate.

public void
setSubject(X500Name
the Object class value for the Subject
val
)

Set the subject name of the certificate.

public void
setSubjectUniqueId(UniqueIdentity
the Object class value for the SubjectUniqueId
val
)

Set the Subject Unique Identity in the certificate.

public void
setValidity(CertificateValidity
the Object class value for the CertificateValidity
val
)

Set the validity interval of the certificate.

public void
setVersion(CertificateVersion
the Object class value for the Extensions
val
)

Set the version number of the certificate.

public String
toString()

Overrides java.lang.Object.toString.

Returns a printable representation of the certificate.

private void
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

algIdback to summary
protected CertificateAlgorithmId algId
ALGORITHM_IDback to summary
public static final String ALGORITHM_ID
DN_NAMEback to summary
public static final String DN_NAME
EXTENSIONSback to summary
public static final String EXTENSIONS
extensionsback to summary
protected CertificateExtensions extensions
intervalback to summary
protected CertificateValidity interval
ISSUERback to summary
public static final String ISSUER
issuerback to summary
protected X500Name issuer
ISSUER_IDback to summary
public static final String ISSUER_ID
issuerUniqueIdback to summary
protected UniqueIdentity issuerUniqueId
KEYback to summary
public static final String KEY
NAMEback to summary
public static final String NAME
pubKeyback to summary
protected CertificateX509Key pubKey
rawCertInfoback to summary
private byte[] rawCertInfo
SERIAL_NUMBERback to summary
public static final String SERIAL_NUMBER
serialNumback to summary
protected CertificateSerialNumber serialNum
SUBJECTback to summary
public static final String SUBJECT
subjectback to summary
protected X500Name subject
SUBJECT_IDback to summary
public static final String SUBJECT_ID
subjectUniqueIdback to summary
protected UniqueIdentity subjectUniqueId
VALIDITYback to summary
public static final String VALIDITY
VERSIONback to summary
public static final String VERSION
versionback to summary
protected CertificateVersion version

Constructor Detail

X509CertInfoback to summary
public X509CertInfo()

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

X509CertInfoback to summary
public X509CertInfo(byte[] cert) throws CertificateParsingException

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:byte[]

the encoded bytes, with no trailing data.

Exceptions
CertificateParsingException:
on parsing errors.
X509CertInfoback to summary
public X509CertInfo(DerValue derVal) throws CertificateParsingException

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:DerValue

the der value containing the encoded cert.

Exceptions
CertificateParsingException:
on parsing errors.

Method Detail

emitback to summary
private void emit(DerOutputStream out) throws CertificateException
encodeback to summary
public void encode(DerOutputStream out) throws CertificateException

Appends the certificate to an output stream.

Parameters
out:DerOutputStream

an output stream to which the certificate is appended.

Exceptions
CertificateException:
on encoding errors.
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

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

Parameters
obj:Object

the object being compared with this one

Returns:boolean

true iff the certificates are equivalent

Annotations
@Override
getAlgorithmIdback to summary
public CertificateAlgorithmId getAlgorithmId()
getEncodedInfoback to summary
public byte[] getEncodedInfo() throws CertificateEncodingException

Returns the encoded certificate info.

Exceptions
CertificateEncodingException:
on encoding information errors.
getExtensionsback to summary
public CertificateExtensions getExtensions()
getIssuerback to summary
public X500Name getIssuer()
getIssuerUniqueIdback to summary
public UniqueIdentity getIssuerUniqueId()
getKeyback to summary
public CertificateX509Key getKey()
getSerialNumberback to summary
public CertificateSerialNumber getSerialNumber()
getSubjectback to summary
public X500Name getSubject()
getSubjectUniqueIdback to summary
public UniqueIdentity getSubjectUniqueId()
getValidityback to summary
public CertificateValidity getValidity()
getVersionback to summary
public CertificateVersion getVersion()
getX500Nameback to summary
private Object getX500Name(String name, boolean getIssuer) throws IOException
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

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

Annotations
@Override
parseback to summary
private void parse(DerValue val) throws CertificateParsingException, IOException
setAlgorithmIdback to summary
public void setAlgorithmId(CertificateAlgorithmId val)

Set the algorithm id of the certificate.

Parameters
val:CertificateAlgorithmId

the Object class value for the AlgorithmId

Exceptions
CertificateException:
on invalid data.
setExtensionsback to summary
public void setExtensions(CertificateExtensions val) throws CertificateException

Set the extensions in the certificate.

Parameters
val:CertificateExtensions

the Object class value for the Extensions

setIssuerback to summary
public void setIssuer(X500Name val)

Set the issuer name of the certificate.

Parameters
val:X500Name

the Object class value for the issuer

Exceptions
CertificateException:
on invalid data.
setIssuerUniqueIdback to summary
public void setIssuerUniqueId(UniqueIdentity val) throws CertificateException

Set the Issuer Unique Identity in the certificate.

Parameters
val:UniqueIdentity

the Object class value for the IssuerUniqueId

setKeyback to summary
public void setKey(CertificateX509Key val)

Set the public key in the certificate.

Parameters
val:CertificateX509Key

the Object class value for the PublicKey

Exceptions
CertificateException:
on invalid data.
setSerialNumberback to summary
public void setSerialNumber(CertificateSerialNumber val)

Set the serial number of the certificate.

Parameters
val:CertificateSerialNumber

the Object class value for the CertificateSerialNumber

Exceptions
CertificateException:
on invalid data.
setSubjectback to summary
public void setSubject(X500Name val) throws CertificateException

Set the subject name of the certificate.

Parameters
val:X500Name

the Object class value for the Subject

Exceptions
CertificateException:
on invalid data.
setSubjectUniqueIdback to summary
public void setSubjectUniqueId(UniqueIdentity val) throws CertificateException

Set the Subject Unique Identity in the certificate.

Parameters
val:UniqueIdentity

the Object class value for the SubjectUniqueId

setValidityback to summary
public void setValidity(CertificateValidity val)

Set the validity interval of the certificate.

Parameters
val:CertificateValidity

the Object class value for the CertificateValidity

Exceptions
CertificateException:
on invalid data.
setVersionback to summary
public void setVersion(CertificateVersion val)

Set the version number of the certificate.

Parameters
val:CertificateVersion

the Object class value for the Extensions

Exceptions
CertificateException:
on invalid data.
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a printable representation of the certificate.

verifyCertback to summary
private void verifyCert(X500Name subject, CertificateExtensions extensions) throws CertificateParsingException