org.mozilla.jss.pkix.cert

Class CertificateInfo

Implemented Interfaces:
ASN1Value

public class CertificateInfo
extends java.lang.Object
implements ASN1Value

A TBSCertificate (to-be-signed certificate), the actual information in a certificate apart from the signature.

Nested Class Summary

static class
CertificateInfo.Template
Template class for decoding a CertificateInfo.
static class
CertificateInfo.Version
An X.509 Certificate version.

Field Summary

static CertificateInfo.Version
v1
static CertificateInfo.Version
v2
static CertificateInfo.Version
v3

Constructor Summary

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 Summary

void
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.
Extension
getExtension(OBJECT_IDENTIFIER oid)
Linearly searches the extension list for an extension with the given object identifier.
SEQUENCE
getExtensions()
Returns the extensions of this certificate.
Name
getIssuer()
BIT_STRING
getIssuerUniqueIdentifier()
Should only be called if this field is present.
Date
getNotAfter()
Date
getNotBefore()
INTEGER
getSerialNumber()
AlgorithmIdentifier
getSignatureAlgId()
Name
getSubject()
SubjectPublicKeyInfo
getSubjectPublicKeyInfo()
BIT_STRING
getSubjectUniqueIdentifier()
Tag
getTag()
Returns the base tag for this type, not counting any tags that may be imposed on it by its context.
static CertificateInfo.Template
getTemplate()
CertificateInfo.Version
getVersion()
boolean
hasExtensions()
boolean
hasIssuerUniqueIdentifier()
boolean
hasSubjectUniqueIdentifier()
boolean
isExtensionPresent(OBJECT_IDENTIFIER oid)
Linearly searches the extension list for an extension with the given object identifier.
void
print(PrintStream ps)
void
setExtensions(SEQUENCE extensions)
void
setIssuer(Name issuer)
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
setSubjectPublicKeyInfo(PublicKey pubk)
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)

Field Details

v1

public static final CertificateInfo.Version v1

v2

public static final CertificateInfo.Version v2

v3

public static final CertificateInfo.Version v3

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

addExtension

public void addExtension(Extension extension)
            throws CertificateException

encode

public void encode(OutputStream ostream)
            throws IOException
Write this value's DER encoding to an output stream using its own base tag.
Specified by:
encode in interface ASN1Value

encode

public void encode(Tag implicitTag,
                   OutputStream ostream)
            throws IOException
Write this value's DER encoding to an output stream using an implicit tag.
Specified by:
encode in interface ASN1Value

getExtension

public Extension getExtension(OBJECT_IDENTIFIER oid)
Linearly searches the extension list for an extension with the given object identifier. It returns the first one it finds. If none are found, returns null.

getExtensions

public SEQUENCE getExtensions()
Returns the extensions of this certificate. The sequence may be empty, but this method will never return null.

getIssuer

public Name getIssuer()

getIssuerUniqueIdentifier

public BIT_STRING getIssuerUniqueIdentifier()
Should only be called if this field is present.

getNotAfter

public Date getNotAfter()

getNotBefore

public Date getNotBefore()

getSerialNumber

public INTEGER getSerialNumber()

getSignatureAlgId

public AlgorithmIdentifier getSignatureAlgId()

getSubject

public Name getSubject()

getSubjectPublicKeyInfo

public SubjectPublicKeyInfo getSubjectPublicKeyInfo()

getSubjectUniqueIdentifier

public BIT_STRING getSubjectUniqueIdentifier()

getTag

public Tag getTag()
Returns the base tag for this type, not counting any tags that may be imposed on it by its context.
Specified by:
getTag in interface ASN1Value

getTemplate

public static CertificateInfo.Template getTemplate()

getVersion

public CertificateInfo.Version getVersion()

hasExtensions

public boolean hasExtensions()

hasIssuerUniqueIdentifier

public boolean hasIssuerUniqueIdentifier()

hasSubjectUniqueIdentifier

public boolean hasSubjectUniqueIdentifier()

isExtensionPresent

public boolean isExtensionPresent(OBJECT_IDENTIFIER oid)
Linearly searches the extension list for an extension with the given object identifier. If it finds one, returns true. Otherwise, returns false.

print

public void print(PrintStream ps)
            throws IOException,
                   InvalidBERException

setExtensions

public void setExtensions(SEQUENCE extensions)
            throws CertificateException

setIssuer

public void setIssuer(Name issuer)

setIssuerUniqueIdentifier

public void setIssuerUniqueIdentifier(BIT_STRING issuerUniqueIdentifier)
            throws CertificateException

setNotAfter

public void setNotAfter(Date notAfter)

setNotBefore

public void setNotBefore(Date notBefore)

setSerialNumber

public void setSerialNumber(INTEGER serialNumber)

setSignatureAlgId

public void setSignatureAlgId(AlgorithmIdentifier signatureAlgId)

setSubject

public void setSubject(Name subject)

setSubjectPublicKeyInfo

public void setSubjectPublicKeyInfo(PublicKey pubk)
            throws InvalidBERException,
                   IOException
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.

setSubjectPublicKeyInfo

public void setSubjectPublicKeyInfo(SubjectPublicKeyInfo subjectPublicKeyInfo)

setSubjectUniqueIdentifier

public void setSubjectUniqueIdentifier(BIT_STRING subjectUniqueIdentifier)
            throws CertificateException

setVersion

public void setVersion(CertificateInfo.Version version)