Package javacardx.security.cert
Interface Certificate
-
- All Known Subinterfaces:
X509Certificate
public interface Certificate
TheCertificate
interface 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 PublicKey
getPublicKey()
Gets the public key from this certificate.short
getType()
Gets the type of this certificateboolean
verify(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
boolean
result, this method sets the result in an internal state which can be rechecked using assertion methods of theSensitiveResult
class, if supported by the platform.- Parameters:
pubKey
- the public key used to carry out the verification.- Returns:
true
if the signature verifies,false
otherwise.- 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_DER
it means that one of the fieldsX509Certificate.FIELD_CERTIFICATE_SIGNATURE_ALG
orX509Certificate.FIELD_CERTIFICATE_SIGNATURE
is missing.
-
In the case of a certificate of type
-
-