public class RSAPublicKey extends java.lang.Object implements IPublicKey
Modifier and Type | Field and Description |
---|---|
static int |
PRE_HEADER_LENGTH |
Constructor and Description |
---|
RSAPublicKey(java.security.cert.X509Certificate cert)
Creates a new RSAPublicKey with the given rsa key parameters and uses an AES key of 128 bit size (for hybrid encryption).
|
RSAPublicKey(java.security.cert.X509Certificate cert,
int aesKeySize)
Creates a new RSAPublicKey with the given rsa key parameters and uses the given key size for the AES key (hybrid encryption).
|
Modifier and Type | Method and Description |
---|---|
byte[] |
encryptMessage(byte[] input)
Encrypts a message using this RSA public key.
|
boolean |
equals(java.lang.Object obj)
Every public key has to implement a comparison operator.
|
boolean |
verifySignature(byte[] message,
byte[] signature)
Use this public key to verify a signature.
|
public static final int PRE_HEADER_LENGTH
public RSAPublicKey(java.security.cert.X509Certificate cert, int aesKeySize)
keyParameters
- An RSA public keyaesKeySize
- The AES key size, can be 128, 192 or 256 bitspublic RSAPublicKey(java.security.cert.X509Certificate cert)
keyParameters
- An RSA public keypublic byte[] encryptMessage(byte[] input) throws java.io.IOException
encryptMessage
in interface IPublicKey
input
- The message which should be encryptedjava.io.IOException
- If not enough memory is available or if a key could not be read, this exception occurspublic boolean verifySignature(byte[] message, byte[] signature)
IPublicKey
verifySignature
in interface IPublicKey
message
- The message which was signedsignature
- The signature of this messagepublic boolean equals(java.lang.Object obj)
IPublicKey
equals
in interface IPublicKey
equals
in class java.lang.Object
obj
- The object of the type AbstractCertificate
that should be compared to the current public keyObject.equals(java.lang.Object)