Package org.mozilla.jss.pkix.cert
Class Certificate
- java.lang.Object
-
- org.mozilla.jss.pkix.cert.Certificate
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCertificate.Template
-
Constructor Summary
Constructors Constructor Description Certificate(CertificateInfo info, java.security.PrivateKey privKey, SignatureAlgorithm signingAlg)Creates and signs an X.509 Certificate.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidencode(java.io.OutputStream ostream)Write this value's DER encoding to an output stream using its own base tag.voidencode(Tag implicitTag, java.io.OutputStream ostream)Write this value's DER encoding to an output stream using an implicit tag.CertificateInfogetInfo()Returns the information (TBSCertificate) contained in this certificate.TaggetTag()Returns the base tag for this type, not counting any tags that may be imposed on it by its context.static Certificate.TemplategetTemplate()static voidmain(java.lang.String[] argv)voidverify()Verifies the signature on this certificate.voidverify(java.security.PublicKey key)Verifies the signature on this certificate, using the given public key.voidverify(java.security.PublicKey key, CryptoToken token)Verifies the signature on this certificate, using the given public key and CryptoToken.
-
-
-
Constructor Detail
-
Certificate
public Certificate(CertificateInfo info, java.security.PrivateKey privKey, SignatureAlgorithm signingAlg) throws java.io.IOException, NotInitializedException, TokenException, java.security.NoSuchAlgorithmException, java.security.cert.CertificateException, java.security.InvalidKeyException, java.security.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 certificate.signingAlg- The algorithm to use to sign the certificate. It must match the algorithm specified in the CertificateInfo.- Throws:
java.io.IOException- If an error occurred while encoding the certificate.NotInitializedException- Because this operation involves cryptography (signing), CryptoManager must be initialized before calling it.TokenException- If an error occurs on a PKCS #11 token.java.security.NoSuchAlgorithmException- If the OID for the signing algorithm cannot be located.java.security.cert.CertificateException- If the signing algorithm specified as a parameter does not match the one in the certificate info.java.security.InvalidKeyException- If the key does not match the signing algorithm.java.security.SignatureException- If an error occurs while signing the certificate.
-
-
Method Detail
-
verify
public void verify() throws java.security.InvalidKeyException, NotInitializedException, java.security.NoSuchAlgorithmException, java.security.cert.CertificateException, java.security.SignatureException, InvalidKeyFormatExceptionVerifies the signature on this certificate. Does not indicate that the certificate is valid at any specific time.- Throws:
java.security.InvalidKeyExceptionNotInitializedExceptionjava.security.NoSuchAlgorithmExceptionjava.security.cert.CertificateExceptionjava.security.SignatureExceptionInvalidKeyFormatException
-
verify
public void verify(java.security.PublicKey key) throws java.security.InvalidKeyException, java.security.NoSuchAlgorithmException, java.security.cert.CertificateException, java.security.SignatureExceptionVerifies the signature on this certificate, using the given public key. Does not indicate the certificate is valid at any specific time.- Throws:
java.security.InvalidKeyExceptionjava.security.NoSuchAlgorithmExceptionjava.security.cert.CertificateExceptionjava.security.SignatureException
-
verify
public void verify(java.security.PublicKey key, CryptoToken token) throws java.security.NoSuchAlgorithmException, java.security.cert.CertificateException, java.security.SignatureException, java.security.InvalidKeyExceptionVerifies the signature on this certificate, using the given public key and CryptoToken. Does not indicate the certificate is valid at any specific time.- Throws:
java.security.NoSuchAlgorithmExceptionjava.security.cert.CertificateExceptionjava.security.SignatureExceptionjava.security.InvalidKeyException
-
getInfo
public CertificateInfo getInfo()
Returns the information (TBSCertificate) contained in this certificate.
-
getTag
public Tag getTag()
Description copied from interface:ASN1ValueReturns the base tag for this type, not counting any tags that may be imposed on it by its context.
-
encode
public void encode(java.io.OutputStream ostream) throws java.io.IOExceptionDescription copied from interface:ASN1ValueWrite this value's DER encoding to an output stream using its own base tag.
-
encode
public void encode(Tag implicitTag, java.io.OutputStream ostream) throws java.io.IOException
Description copied from interface:ASN1ValueWrite this value's DER encoding to an output stream using an implicit tag.
-
getTemplate
public static Certificate.Template getTemplate()
-
main
public static void main(java.lang.String[] argv)
-
-