public class X509CertInfo extends java.lang.Object implements CertAttrSet, java.io.Serializable
X.509 certificates have several base data elements, including:
CertAttrSet
,
Serializable
,
X509CertImpl
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected CertificateAlgorithmId |
algId |
static java.lang.String |
ALGORITHM_ID |
protected CertificateExtensions |
extensions |
static java.lang.String |
EXTENSIONS |
static java.lang.String |
IDENT
Identifier for this attribute, to be used with the
get, set, delete methods of Certificate, x509 type.
|
protected CertificateValidity |
interval |
protected CertificateIssuerName |
issuer |
static java.lang.String |
ISSUER |
static java.lang.String |
ISSUER_ID |
protected CertificateIssuerUniqueIdentity |
issuerUniqueId |
static java.lang.String |
KEY |
static java.lang.String |
NAME |
protected CertificateX509Key |
pubKey |
static java.lang.String |
SERIAL_NUMBER |
protected CertificateSerialNumber |
serialNum |
protected CertificateSubjectName |
subject |
static java.lang.String |
SUBJECT |
static java.lang.String |
SUBJECT_ID |
protected CertificateSubjectUniqueIdentity |
subjectUniqueId |
static java.lang.String |
VALIDITY |
protected CertificateVersion |
version |
static java.lang.String |
VERSION |
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
void |
decode(java.io.InputStream in)
Decode an X.509 certificate from an input stream.
|
void |
delete(java.lang.String name)
Delete the certificate attribute.
|
void |
encode(java.io.OutputStream out)
Appends the certificate to an output stream.
|
void |
encode(java.io.OutputStream out,
boolean ignoreCache)
Appends the certificate to an output stream.
|
boolean |
equals(java.lang.Object other)
Compares two X509CertInfo objects.
|
boolean |
equals(X509CertInfo other)
Compares two certificates, returning false if any data
differs between the two.
|
java.lang.Object |
get(java.lang.String name)
Get the certificate attribute.
|
java.util.Enumeration<java.lang.String> |
getAttributeNames()
Return an enumeration of names of attributes existing within this
attribute.
|
byte[] |
getEncodedInfo()
Returns the encoded certificate info.
|
byte[] |
getEncodedInfo(boolean ignoreCache) |
CertificateIssuerName |
getIssuerObj() |
java.lang.String |
getName()
Return the name of this attribute.
|
CertificateSubjectName |
getSubjectObj() |
int |
hashCode()
Calculates a hash code value for the object.
|
void |
set(java.lang.String name,
java.lang.Object val)
Set the certificate attribute.
|
java.lang.String |
toString()
Returns a printable representation of the certificate.
|
public static final java.lang.String IDENT
public static final java.lang.String NAME
public static final java.lang.String VERSION
public static final java.lang.String SERIAL_NUMBER
public static final java.lang.String ALGORITHM_ID
public static final java.lang.String ISSUER
public static final java.lang.String VALIDITY
public static final java.lang.String SUBJECT
public static final java.lang.String KEY
public static final java.lang.String ISSUER_ID
public static final java.lang.String SUBJECT_ID
public static final java.lang.String EXTENSIONS
protected CertificateVersion version
protected CertificateSerialNumber serialNum
protected CertificateAlgorithmId algId
protected CertificateIssuerName issuer
protected CertificateValidity interval
protected CertificateSubjectName subject
protected CertificateX509Key pubKey
protected CertificateIssuerUniqueIdentity issuerUniqueId
protected CertificateSubjectUniqueIdentity subjectUniqueId
protected CertificateExtensions extensions
public X509CertInfo()
public X509CertInfo(byte[] cert) throws java.security.cert.CertificateParsingException
cert
- the encoded bytes, with no trailing data.java.security.cert.CertificateParsingException
- on parsing errors.public X509CertInfo(DerValue derVal) throws java.security.cert.CertificateParsingException
derVal
- the der value containing the encoded cert.java.security.cert.CertificateParsingException
- on parsing errors.public void decode(java.io.InputStream in) throws java.security.cert.CertificateParsingException, java.io.IOException
decode
in interface CertAttrSet
in
- an input stream holding at least one certificatejava.security.cert.CertificateParsingException
- on decoding errors.java.io.IOException
- on other errors.public void encode(java.io.OutputStream out) throws java.security.cert.CertificateException, java.io.IOException
encode
in interface CertAttrSet
out
- an output stream to which the certificate is appended.java.security.cert.CertificateException
- on encoding errors.java.io.IOException
- on other errors.public void encode(java.io.OutputStream out, boolean ignoreCache) throws java.io.IOException, java.security.cert.CertificateException
out
- An output stream to which the certificate is appended.ignoreCache
- Whether to ignore the internal cache when encoding.
(the cache can easily become out of date).java.io.IOException
java.security.cert.CertificateException
public java.util.Enumeration<java.lang.String> getAttributeNames()
getAttributeNames
in interface CertAttrSet
public java.lang.String getName()
getName
in interface CertAttrSet
public byte[] getEncodedInfo() throws java.security.cert.CertificateEncodingException
java.security.cert.CertificateEncodingException
- on encoding information errors.public byte[] getEncodedInfo(boolean ignoreCache) throws java.security.cert.CertificateEncodingException
java.security.cert.CertificateEncodingException
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
other
- the object being compared with this onepublic boolean equals(X509CertInfo other)
other
- the object being compared with this onepublic int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in interface CertAttrSet
toString
in class java.lang.Object
public void set(java.lang.String name, java.lang.Object val) throws java.security.cert.CertificateException, java.io.IOException
set
in interface CertAttrSet
name
- the name of the Certificate attribute.val
- the value of the Certificate attribute.java.security.cert.CertificateException
- on invalid attributes.java.io.IOException
- on other errors.public void delete(java.lang.String name) throws java.security.cert.CertificateException, java.io.IOException
delete
in interface CertAttrSet
name
- the name of the Certificate attribute.java.security.cert.CertificateException
- on invalid attributes.java.io.IOException
- on other errors.public java.lang.Object get(java.lang.String name) throws java.security.cert.CertificateException, java.io.IOException
get
in interface CertAttrSet
name
- the name of the Certificate attribute.java.security.cert.CertificateException
- on invalid attributes.java.io.IOException
- on other errors.public CertificateIssuerName getIssuerObj()
public CertificateSubjectName getSubjectObj()