Class X509CertInfo
java.lang.Object
org.mozilla.jss.netscape.security.x509.X509CertInfo
- All Implemented Interfaces:
Serializable
,CertAttrSet
- Direct Known Subclasses:
CertInfo
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.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CertificateAlgorithmId
static final String
protected CertificateExtensions
static final String
static final String
Identifier for this attribute, to be used with the get, set, delete methods of Certificate, x509 type.protected CertificateValidity
protected CertificateIssuerName
static final String
static final String
protected CertificateIssuerUniqueIdentity
static final String
static final String
protected CertificateX509Key
static final String
protected CertificateSerialNumber
protected CertificateSubjectName
static final String
static final String
protected CertificateSubjectUniqueIdentity
static final String
protected CertificateVersion
static final String
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct 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. -
Method Summary
Modifier and TypeMethodDescriptionvoid
decode
(InputStream in) Decode an X.509 certificate from an input stream.void
Delete the certificate attribute.void
encode
(OutputStream out) Appends the certificate to an output stream.void
encode
(OutputStream out, boolean ignoreCache) Appends the certificate to an output stream.boolean
Compares two X509CertInfo objects.boolean
equals
(X509CertInfo other) Compares two certificates, returning false if any data differs between the two.Get the certificate attribute.Return an enumeration of names of attributes existing within this attribute.byte[]
Returns the encoded certificate info.byte[]
getEncodedInfo
(boolean ignoreCache) getName()
Return the name of this attribute.int
hashCode()
Calculates a hash code value for the object.void
Set the certificate attribute.toString()
Returns a printable representation of the certificate.
-
Field Details
-
IDENT
Identifier for this attribute, to be used with the get, set, delete methods of Certificate, x509 type.- See Also:
-
NAME
- See Also:
-
VERSION
- See Also:
-
SERIAL_NUMBER
- See Also:
-
ALGORITHM_ID
- See Also:
-
ISSUER
- See Also:
-
VALIDITY
- See Also:
-
SUBJECT
- See Also:
-
KEY
- See Also:
-
ISSUER_ID
- See Also:
-
SUBJECT_ID
- See Also:
-
EXTENSIONS
- See Also:
-
version
-
serialNum
-
algId
-
issuer
-
interval
-
subject
-
pubKey
-
issuerUniqueId
-
subjectUniqueId
-
extensions
-
-
Constructor Details
-
X509CertInfo
public X509CertInfo()Construct an uninitialized X509CertInfo on which decode must later be called (or which may be deserialized). -
X509CertInfo
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.
-
X509CertInfo
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.
-
-
Method Details
-
decode
Decode an X.509 certificate from an input stream.- Specified by:
decode
in interfaceCertAttrSet
- Parameters:
in
- an input stream holding at least one certificate- Throws:
CertificateParsingException
- on decoding errors.IOException
- on other errors.
-
encode
Appends the certificate to an output stream.- Specified by:
encode
in interfaceCertAttrSet
- Parameters:
out
- an output stream to which the certificate is appended.- Throws:
CertificateException
- on encoding errors.IOException
- on other errors.
-
encode
Appends the certificate to an output stream.- Parameters:
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).- Throws:
IOException
CertificateException
-
getAttributeNames
Return an enumeration of names of attributes existing within this attribute.- Specified by:
getAttributeNames
in interfaceCertAttrSet
- Returns:
- an enumeration of the attribute names.
-
getName
Return the name of this attribute.- Specified by:
getName
in interfaceCertAttrSet
- Returns:
- the name of this CertAttrSet.
-
getEncodedInfo
Returns the encoded certificate info.- Throws:
CertificateEncodingException
- on encoding information errors.
-
getEncodedInfo
- Throws:
CertificateEncodingException
-
equals
Compares two X509CertInfo objects. This is false if the certificates are not both X.509 certs, otherwise it compares them as binary data. -
equals
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
-
hashCode
public int hashCode()Calculates a hash code value for the object. Objects which are equal will also have the same hashcode. -
toString
Returns a printable representation of the certificate.- Specified by:
toString
in interfaceCertAttrSet
- Overrides:
toString
in classObject
- Returns:
- value of this certificate attribute in printable form.
-
set
Set the certificate attribute.- Specified by:
set
in interfaceCertAttrSet
- Parameters:
name
- the name of the Certificate attribute.val
- the value of the Certificate attribute.- Throws:
CertificateException
- on invalid attributes.IOException
- on other errors.
-
delete
Delete the certificate attribute.- Specified by:
delete
in interfaceCertAttrSet
- Parameters:
name
- the name of the Certificate attribute.- Throws:
CertificateException
- on invalid attributes.IOException
- on other errors.
-
get
Get the certificate attribute.- Specified by:
get
in interfaceCertAttrSet
- Parameters:
name
- the name of the Certificate attribute.- Returns:
- attribute value
- Throws:
CertificateException
- on invalid attributes.IOException
- on other errors.
-
getIssuerObj
-
getSubjectObj
-