Package org.mozilla.jss.pkix.cert
Class CertificateInfo
java.lang.Object
org.mozilla.jss.pkix.cert.CertificateInfo
- All Implemented Interfaces:
ASN1Value
A TBSCertificate (to-be-signed certificate), the actual information in
a certificate apart from the signature.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Template class for decoding a CertificateInfo.static class
An X.509 Certificate version. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate SEQUENCE
private Name
private BIT_STRING
private Date
private Date
private INTEGER
private AlgorithmIdentifier
private Name
private SubjectPublicKeyInfo
private BIT_STRING
(package private) static final Tag
private static final CertificateInfo.Template
(package private) static final int
static final CertificateInfo.Version
static final CertificateInfo.Version
static final CertificateInfo.Version
private CertificateInfo.Version
-
Constructor Summary
ConstructorsConstructorDescriptionCertificateInfo
(CertificateInfo.Version version, INTEGER serialNumber, AlgorithmIdentifier signatureAlgId, Name issuer, Date notBefore, Date notAfter, Name subject, SubjectPublicKeyInfo subjectPublicKeyInfo) Creates a CertificateInfo with the required fields. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addExtension
(Extension extension) void
encode
(OutputStream ostream) Write this value's DER encoding to an output stream using its own base tag.void
encode
(Tag implicitTag, OutputStream ostream) Write this value's DER encoding to an output stream using an implicit tag.private static ASN1Value
Returns the correct ASN1Value (UTCTime or GeneralizedTime) to represent the given certificate validity date.Linearly searches the extension list for an extension with the given object identifier.Returns the extensions of this certificate.Should only be called if this field is present.getTag()
Returns the base tag for this type, not counting any tags that may be imposed on it by its context.static CertificateInfo.Template
boolean
boolean
boolean
boolean
Linearly searches the extension list for an extension with the given object identifier.void
print
(PrintStream ps) void
setExtensions
(SEQUENCE extensions) void
void
setIssuerUniqueIdentifier
(BIT_STRING issuerUniqueIdentifier) void
setNotAfter
(Date notAfter) void
setNotBefore
(Date notBefore) void
setSerialNumber
(INTEGER serialNumber) void
setSignatureAlgId
(AlgorithmIdentifier signatureAlgId) void
setSubject
(Name subject) void
Extracts the SubjectPublicKeyInfo from the given public key and stores it in the CertificateInfo.void
setSubjectPublicKeyInfo
(SubjectPublicKeyInfo subjectPublicKeyInfo) void
setSubjectUniqueIdentifier
(BIT_STRING subjectUniqueIdentifier) void
setVersion
(CertificateInfo.Version version) private void
verifyNotNull
(Object obj)
-
Field Details
-
v1
-
v2
-
v3
-
UTCTIME_CUTOFF_YEAR
static final int UTCTIME_CUTOFF_YEAR- See Also:
-
version
-
serialNumber
-
signatureAlgId
-
issuer
-
notBefore
-
notAfter
-
subject
-
subjectPublicKeyInfo
-
issuerUniqueIdentifier
-
subjectUniqueIdentifier
-
extensions
-
TAG
-
templateInstance
-
-
Constructor Details
-
CertificateInfo
public CertificateInfo(CertificateInfo.Version version, INTEGER serialNumber, AlgorithmIdentifier signatureAlgId, Name issuer, Date notBefore, Date notAfter, Name subject, SubjectPublicKeyInfo subjectPublicKeyInfo) Creates a CertificateInfo with the required fields.
-
-
Method Details
-
setVersion
-
getVersion
-
setSerialNumber
-
getSerialNumber
-
setSignatureAlgId
-
getSignatureAlgId
-
setIssuer
-
getIssuer
-
setNotBefore
-
getNotBefore
-
setNotAfter
-
getNotAfter
-
setSubject
-
getSubject
-
setSubjectPublicKeyInfo
-
setSubjectPublicKeyInfo
Extracts the SubjectPublicKeyInfo from the given public key and stores it in the CertificateInfo.- Throws:
InvalidBERException
- If an error occurs decoding the the information extracted from the public key.IOException
-
getSubjectPublicKeyInfo
-
setIssuerUniqueIdentifier
public void setIssuerUniqueIdentifier(BIT_STRING issuerUniqueIdentifier) throws CertificateException - Throws:
CertificateException
- If the certificate is a v1 certificate.
-
hasIssuerUniqueIdentifier
public boolean hasIssuerUniqueIdentifier() -
getIssuerUniqueIdentifier
Should only be called if this field is present. -
setSubjectUniqueIdentifier
public void setSubjectUniqueIdentifier(BIT_STRING subjectUniqueIdentifier) throws CertificateException - Throws:
CertificateException
- If the certificate is a v1 certificate.
-
hasSubjectUniqueIdentifier
public boolean hasSubjectUniqueIdentifier() -
getSubjectUniqueIdentifier
-
hasExtensions
public boolean hasExtensions() -
getExtensions
Returns the extensions of this certificate. The sequence may be empty, but this method will never returnnull
. -
isExtensionPresent
Linearly searches the extension list for an extension with the given object identifier. If it finds one, returnstrue
. Otherwise, returnsfalse
. -
getExtension
Linearly searches the extension list for an extension with the given object identifier. It returns the first one it finds. If none are found, returnsnull
. -
setExtensions
- Throws:
CertificateException
- If the certificate is not a v3 certificate.
-
addExtension
- Throws:
CertificateException
- If the certificate is not a v3 certificate.
-
verifyNotNull
-
getTag
Description copied from interface:ASN1Value
Returns the base tag for this type, not counting any tags that may be imposed on it by its context. -
encode
Description copied from interface:ASN1Value
Write this value's DER encoding to an output stream using its own base tag.- Specified by:
encode
in interfaceASN1Value
- Parameters:
ostream
- Output stream.- Throws:
IOException
- If an error occurred.
-
encode
Description copied from interface:ASN1Value
Write this value's DER encoding to an output stream using an implicit tag.- Specified by:
encode
in interfaceASN1Value
- Parameters:
implicitTag
- Implicit tag.ostream
- Output stream.- Throws:
IOException
- If an error occurred.
-
encodeValidityDate
Returns the correct ASN1Value (UTCTime or GeneralizedTime) to represent the given certificate validity date. -
getTemplate
-
print
- Throws:
InvalidBERException
-