public class Encryptor
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static EncryptionAlgorithm |
DEFAULT_ENCRYPTION_ALG
The default encryption algorithm, currently DES3_CBC.
|
Constructor and Description |
---|
Encryptor(CryptoToken token,
byte[] keyID,
EncryptionAlgorithm alg)
Creates an Encryptor on the given CryptoToken, using the key with
the given keyID and algorithm
|
Modifier and Type | Method and Description |
---|---|
byte[] |
encrypt(byte[] plaintext)
Encrypts a byte array.
|
public static final EncryptionAlgorithm DEFAULT_ENCRYPTION_ALG
public Encryptor(CryptoToken token, byte[] keyID, EncryptionAlgorithm alg) throws TokenException, java.security.InvalidKeyException
token
- The CryptoToken to use for encryption. The key must
reside on this token.keyID
- The keyID of the key to use for encryption. This key
must have been generated on this token with KeyManager.alg
- The EncryptionAlgorithm this key will be used for.java.security.InvalidKeyException
- If no key exists on this token with this
keyID.TokenException
public byte[] encrypt(byte[] plaintext) throws CryptoManager.NotInitializedException, java.security.GeneralSecurityException, InvalidBERException
plaintext
- The plaintext bytes to be encrypted.CryptoManager.NotInitializedException
java.security.GeneralSecurityException
InvalidBERException