Package org.mozilla.jss.pkix.cert
Class Certificate
java.lang.Object
org.mozilla.jss.pkix.cert.Certificate
- All Implemented Interfaces:
ASN1Value
An X.509 signed certificate.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AlgorithmIdentifierprivate CertificateInfoprivate byte[](package private) SEQUENCEprivate byte[]private static final Tagprivate static final Certificate.Template -
Constructor Summary
ConstructorsConstructorDescriptionCertificate(CertificateInfo info, byte[] infoEncoding, AlgorithmIdentifier algId, byte[] signature) Certificate(CertificateInfo info, PrivateKey privKey, SignatureAlgorithm signingAlg) Creates and signs an X.509 Certificate. -
Method Summary
Modifier and TypeMethodDescriptionvoidencode(OutputStream ostream) Write this value's DER encoding to an output stream using its own base tag.voidencode(Tag implicitTag, OutputStream ostream) Write this value's DER encoding to an output stream using an implicit tag.getInfo()Returns the information (TBSCertificate) contained in this certificate.getTag()Returns the base tag for this type, not counting any tags that may be imposed on it by its context.static Certificate.Templatestatic voidvoidverify()Verifies the signature on this certificate.voidVerifies 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.
-
Field Details
-
info
-
infoEncoding
private byte[] infoEncoding -
signature
private byte[] signature -
algId
-
sequence
SEQUENCE sequence -
TAG
-
templateInstance
-
-
Constructor Details
-
Certificate
Certificate(CertificateInfo info, byte[] infoEncoding, AlgorithmIdentifier algId, byte[] signature) -
Certificate
public Certificate(CertificateInfo info, PrivateKey privKey, SignatureAlgorithm signingAlg) throws IOException, 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 certificate.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.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 Details
-
verify
public void verify() throws InvalidKeyException, NoSuchAlgorithmException, CertificateException, SignatureException, InvalidKeyFormatExceptionVerifies 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. -
getInfo
Returns the information (TBSCertificate) contained in this certificate. -
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
Description copied from interface:ASN1ValueWrite this value's DER encoding to an output stream using its own base tag.- Specified by:
encodein interfaceASN1Value- Parameters:
ostream- Output stream.- Throws:
IOException- If an error occurred.
-
encode
Description copied from interface:ASN1ValueWrite this value's DER encoding to an output stream using an implicit tag.- Specified by:
encodein interfaceASN1Value- Parameters:
implicitTag- Implicit tag.ostream- Output stream.- Throws:
IOException- If an error occurred.
-
getTemplate
-
main
-