public interface ICertificate
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
AES_ENCRYPTION_MODE |
static java.lang.String |
CERTIFICATE_TYPE |
static java.lang.String |
DIGEST_TYPE |
static java.lang.String |
HMAC_ALGORITHM |
static java.lang.String |
RSA_ENCRYPTION_MODE |
Modifier and Type | Method and Description |
---|---|
byte[] |
decrypt(byte[] encryptedMessage)
Decrypts a message, so that the plain text is accessible.
|
byte[] |
encrypt(byte[] message)
Encrypts a message, so that it can only be read by the owner of the corresponding private key of this certificate.
|
boolean |
equals(java.lang.Object obj)
Every certificate type has to implement a comparison operator.
|
java.util.Date |
getEndDate()
Returns the time after that the certificate is invalid.
|
byte[] |
getFingerprint()
Gets the SHA-1 fingerprint of the certificate.
|
java.lang.String |
getIssuer()
Get the issuer of the certificate
|
IPublicKey |
getPublicKey()
Get the public key of the certificate
|
byte[] |
getSignature()
Get the signature of the issuer of this certificate.
|
byte[] |
getSignedPart()
Returns the part of the certificate, that was signed by the issuer.
|
java.util.Date |
getStartDate()
Returns the time from which the certificate is valid.
|
java.lang.String |
getSubject()
Get the subject of the certificate.
|
int |
hashCode()
Returns a hash code for the certificate.
|
boolean |
hasPrivateKey()
Can be used to check if the device owns the corresponding private key of this certificate.
|
boolean |
isValidRegardingStartAndEndDate()
Validates the start and end date of a certificate.
|
byte[] |
sign(byte[] toSign)
Signs a given byte array.
|
byte[][] |
toByteArray()
Get the certificate as byte array (DER encoded), contains also the private key as byte array, if it does exist.
|
java.lang.String |
toString()
Convert the bytes of the certificate to a BASE64-encoded string.
|
boolean |
verifyCertificate(IKeyStore keystore)
Verify if the certificate is trusted or issued by a trusted CA.
|
boolean |
verifySignature(byte[] message,
byte[] signature)
Verifies a signature which was created with the private key of this certificate (only needs the public key for verification).
|
static final java.lang.String CERTIFICATE_TYPE
static final java.lang.String DIGEST_TYPE
static final java.lang.String AES_ENCRYPTION_MODE
static final java.lang.String RSA_ENCRYPTION_MODE
static final java.lang.String HMAC_ALGORITHM
IPublicKey getPublicKey()
java.lang.String getSubject()
java.lang.String getIssuer()
boolean verifyCertificate(IKeyStore keystore)
- byte[] getFingerprint()
java.io.IOException
- This exception is thrown if the certificate is stored in a file and cannot properly accessed.byte[] sign(byte[] toSign)
toSign
- The byte array which should be hashed and signedboolean verifySignature(byte[] message, byte[] signature)
message
- The message which was signedsignature
- The signature of the messagebyte[] encrypt(byte[] message)
message
- The message which should be encryptedbyte[] decrypt(byte[] encryptedMessage)
encryptedMessage
- A message which was encrypted using the public key of this certificatejava.io.IOException
boolean hasPrivateKey()
java.lang.String toString()
toString
in class java.lang.Object
byte[][] toByteArray()
boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- The object of the type CertificateAbstraction that should be compared to the current certificateObject.equals(java.lang.Object)
byte[] getSignedPart()
byte[] getSignature()
getSignedPart()
int hashCode()
hashCode
in class java.lang.Object
java.util.Date getStartDate()
getEndDate()
java.util.Date getEndDate()
getStartDate()
boolean isValidRegardingStartAndEndDate()