org.mozilla.jss.pkix.cert

Class Certificate

Implemented Interfaces:
ASN1Value

public class Certificate
extends java.lang.Object
implements ASN1Value

An X.509 signed certificate.

Nested Class Summary

static class
Certificate.Template

Constructor Summary

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

Method Summary

void
encode(OutputStream ostream)
void
encode(Tag implicitTag, OutputStream ostream)
CertificateInfo
getInfo()
Returns the information (TBSCertificate) contained in this certificate.
Tag
getTag()
static Certificate.Template
getTemplate()
static void
main(argv[] )
void
verify()
Verifies the signature on this certificate.
void
verify(PublicKey key)
Verifies the signature on this certificate, using the given public key.
void
verify(PublicKey key, CryptoToken token)
Verifies the signature on this certificate, using the given public key and CryptoToken.

Constructor Details

Certificate

public Certificate(CertificateInfo info,
                   java.security.PrivateKey privKey,
                   SignatureAlgorithm signingAlg)
            throws IOException,
                   CryptoManager.NotInitializedException,
                   TokenException,
                   NoSuchAlgorithmException,
                   CertificateException,
                   InvalidKeyException,
                   SignatureException
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:
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.

Method Details

encode

public void encode(OutputStream ostream)
            throws IOException
Specified by:
encode in interface ASN1Value

encode

public void encode(Tag implicitTag,
                   OutputStream ostream)
            throws IOException
Specified by:
encode in interface ASN1Value

getInfo

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

getTag

public Tag getTag()
Specified by:
getTag in interface ASN1Value

getTemplate

public static Certificate.Template getTemplate()

main

public static void main(argv[] )

verify

public void verify()
            throws InvalidKeyException,
                   CryptoManager.NotInitializedException,
                   NoSuchAlgorithmException,
                   CertificateException,
                   SignatureException,
                   InvalidKeyFormatException
Verifies the signature on this certificate. Does not indicate that the certificate is valid at any specific time.

verify

public void verify(PublicKey key)
            throws InvalidKeyException,
                   NoSuchAlgorithmException,
                   CertificateException,
                   SignatureException
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)
            throws NoSuchAlgorithmException,
                   CertificateException,
                   SignatureException,
                   InvalidKeyException
Verifies the signature on this certificate, using the given public key and CryptoToken. Does not indicate the certificate is valid at any specific time.