Package javacardx.security.cert
Interface Certificate
-
- All Known Subinterfaces:
X509Certificate
public interface CertificateTheCertificateinterface is the base interface for all certificate types.- Since:
- 3.1
- See Also:
CertificateParser
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description PublicKeygetPublicKey()Gets the public key from this certificate.shortgetType()Gets the type of this certificatebooleanverify(PublicKey pubKey)Verifies that this certificate was signed using the private key that corresponds to the specified public key.
-
-
-
Method Detail
-
getType
short getType()
Gets the type of this certificate- Returns:
- the certificate type.
- See Also:
CertificateParser.TYPE_* constants
-
getPublicKey
PublicKey getPublicKey() throws CryptoException
Gets the public key from this certificate.- Returns:
- the public key. It may be null if a CertificateParser.KeyHandler filter has been applied when the certificate was built and null was returned at that time.
- Throws:
CryptoException- with CryptoException.NO_SUCH_ALGORITHM value if a certificate public key is not supported
-
verify
boolean verify(PublicKey pubKey) throws CryptoException, CertificateException
Verifies that this certificate was signed using the private key that corresponds to the specified public key. No other checks are performed.In addition to returning a
booleanresult, this method sets the result in an internal state which can be rechecked using assertion methods of theSensitiveResultclass, if supported by the platform.- Parameters:
pubKey- the public key used to carry out the verification.- Returns:
trueif the signature verifies,falseotherwise.- Throws:
CryptoException- with the following reasons code:- CryptoException.NO_SUCH_ALGORITHM if the signature algorithm is not supported
- CryptoException.ILLEGAL_VALUE if the key object is inconsistent with the signature
- CryptoException.UNINITIALIZED_KEY if the key object is not initialized.
CertificateException- with the following reasons code: CertificateException.MISSING_DATA if the certificate is missing data to complete the verification.-
In the case of a certificate of type
CertificateParser.TYPE_X509_DERit means that one of the fieldsX509Certificate.FIELD_CERTIFICATE_SIGNATURE_ALGorX509Certificate.FIELD_CERTIFICATE_SIGNATUREis missing.
-
In the case of a certificate of type
-
-