All Packages Class Hierarchy This Package Previous Next Index
Class iaik.security.rsa.RSAKey
java.lang.Object
|
+----iaik.security.rsa.RSAKey
- public abstract class RSAKey
- extends Object
- implements RSAKey
Class for dealing with PKCS#1 defined encryption blocks.
-
RSAKey()
-
-
crypt(BigInteger)
- Uses the key to encrypt or decrypt a message.
-
crypt(byte[])
- Uses the key from the subclass to encrypt or decrypt a message.
-
decrypt(int, byte[])
- This method decrypts a RSA encrypted block and parses the result
according to the in PKCS#1 defined encryption block.
-
encrypt(int, byte[])
- This method creates a PKCS#1 defined encryption block and
encrypts it with the key from the subclass.
-
getExponent()
- Returns the exponent.
-
getModulus()
- Returns the modulus.
RSAKey
public RSAKey()
crypt
public abstract BigInteger crypt(BigInteger message)
- Uses the key to encrypt or decrypt a message. Simply performs a modula
exponentiation.
- Parameters:
- message - the message to en/decrypt as BigInteger
- Returns:
- the encrypted or decrypted message
crypt
public byte[] crypt(byte message[])
- Uses the key from the subclass to encrypt or decrypt a message.
Simply performs a modula exponentiation.
- Parameters:
- message - the message to en/decrypt
- Returns:
- the encrypted or decrypted message
decrypt
public byte[] decrypt(int blockType,
byte encrypted[]) throws SignatureException
- This method decrypts a RSA encrypted block and parses the result
according to the in PKCS#1 defined encryption block.
Encryption block format: EB = BT|PS|00|D
- BT: block type (0, 1, 2)
- PS: padding string
- D: data
- Parameters:
- blockType - the block type this block should have
- encrypted - the data to be decrypted and parsed
- Returns:
- the data inside this block
- Throws: SignatureException
- if there is an error while parsing the block
encrypt
public byte[] encrypt(int blockType,
byte data[]) throws SignatureException
- This method creates a PKCS#1 defined encryption block and
encrypts it with the key from the subclass.
Encryption block format: EB = 00|BT|PS|00|D
- BT: block type (0, 1, 2)
- PS: padding string
- D: data
- Parameters:
- blockType - the block type that should be created
- data - the data to encrypt
- Returns:
- the created encryption block
- Throws: SignatureException
- if the block could not be created
All Packages Class Hierarchy This Package Previous Next Index