org.mozilla.jss.pkix.cert

Class Certificate

public class Certificate extends Object implements ASN1Value

An X.509 signed certificate.
Nested Class Summary
static classCertificate.Template
Constructor Summary
Certificate(CertificateInfo info, PrivateKey privKey, SignatureAlgorithm signingAlg)
Creates and signs an X.509 Certificate.
Method Summary
voidencode(OutputStream ostream)
voidencode(Tag implicitTag, OutputStream ostream)
CertificateInfogetInfo()
Returns the information (TBSCertificate) contained in this certificate.
TaggetTag()
static Certificate.TemplategetTemplate()
static voidmain(String[] argv)
voidverify()
Verifies the signature on this certificate.
voidverify(PublicKey key)
Verifies the signature on this certificate, using the given public key.
voidverify(PublicKey key, CryptoToken token)
Verifies the signature on this certificate, using the given public key and CryptoToken.

Constructor Detail

Certificate

public Certificate(CertificateInfo info, PrivateKey privKey, SignatureAlgorithm signingAlg)
Creates and signs an X.509 Certificate.

Parameters: info A CertificateInfo (TBSCertificate), which specifies the actual information of the certificate. privKey The private key with which to sign the certificat. signingAlg The algorithm to use to sign the certificate. It must match the algorithm specified in the CertificateInfo.

Throws: IOException If an error occurred while encoding the certificate. CryptoManager.NotInitializedException Because this operation involves cryptography (signing), CryptoManager must be initialized before calling it. TokenException If an error occurs on a PKCS #11 token. NoSuchAlgorithmException If the OID for the signing algorithm cannot be located. CertificateException If the signing algorithm specified as a parameter does not match the one in the certificate info. InvalidKeyException If the key does not match the signing algorithm. SignatureException If an error occurs while signing the certificate.

Method Detail

encode

public void encode(OutputStream ostream)

encode

public void encode(Tag implicitTag, OutputStream ostream)

getInfo

public CertificateInfo getInfo()
Returns the information (TBSCertificate) contained in this certificate.

getTag

public Tag getTag()

getTemplate

public static Certificate.Template getTemplate()

main

public static void main(String[] argv)

verify

public void verify()
Verifies the signature on this certificate. Does not indicate that the certificate is valid at any specific time.

verify

public void verify(PublicKey key)
Verifies the signature on this certificate, using the given public key. Does not indicate the certificate is valid at any specific time.

verify

public void verify(PublicKey key, CryptoToken token)
Verifies the signature on this certificate, using the given public key and CryptoToken. Does not indicate the certificate is valid at any specific time.