org.mozilla.jss.pkcs10

Class CertificationRequest

Implemented Interfaces:
ASN1Value

public class CertificationRequest
extends java.lang.Object
implements ASN1Value

A pkcs10 signed CertificationRequest.

Nested Class Summary

static class
CertificationRequest.Template

Constructor Summary

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

Method Summary

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.
CertificationRequestInfo
getInfo()
Returns the information (TBSCertificationRequest) contained in this CertificationRequest.
Tag
getTag()
Returns the base tag for this type, not counting any tags that may be imposed on it by its context.
static CertificationRequest.Template
getTemplate()
static void
main(argv[] )
void
verify()
Verifies the signature on this CertificationRequest.
void
verify(PublicKey key)
Verifies the signature on this CertificationRequest, using the given public key.
void
verify(PublicKey key, CryptoToken token)
Verifies the signature on this CertificationRequest, using the given public key and CryptoToken.

Constructor Details

CertificationRequest

public CertificationRequest(CertificationRequestInfo info,
                            java.security.PrivateKey privKey,
                            SignatureAlgorithm signingAlg)
            throws IOException,
                   CryptoManager.NotInitializedException,
                   TokenException,
                   NoSuchAlgorithmException,
                   CertificateException,
                   InvalidKeyException,
                   SignatureException
Creates and signs an X.509 CertificationRequest.
Parameters:
info - A CertificationRequestInfo (TBSCertificationRequest), which specifies the actual information of the CertificationRequest.
privKey - The private key with which to sign the certificat.
signingAlg - The algorithm to use to sign the CertificationRequest. It must match the algorithm specified in the CertificationRequestInfo.
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
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

getInfo

public CertificationRequestInfo getInfo()
Returns the information (TBSCertificationRequest) contained in this CertificationRequest.

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 CertificationRequest.Template getTemplate()

main

public static void main(argv[] )

verify

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

verify

public void verify(PublicKey key)
            throws InvalidKeyException,
                   CryptoManager.NotInitializedException,
                   NoSuchAlgorithmException,
                   CertificateException,
                   TokenException,
                   SignatureException
Verifies the signature on this CertificationRequest, using the given public key. Does not indicate the CertificationRequest is valid at any specific time.

verify

public void verify(PublicKey key,
                   CryptoToken token)
            throws NoSuchAlgorithmException,
                   CertificateException,
                   TokenException,
                   SignatureException,
                   InvalidKeyException
Verifies the signature on this CertificationRequest, using the given public key and CryptoToken. Does not indicate the CertificationRequest is valid at any specific time.