org.mozilla.jss.SecretDecoderRing
public class Encryptor extends Object
Field Summary | |
---|---|
static EncryptionAlgorithm | DEFAULT_ENCRYPTION_ALG
The default encryption algorithm, currently DES3_CBC. |
Constructor Summary | |
---|---|
Encryptor(CryptoToken token, byte[] keyID, EncryptionAlgorithm alg)
Creates an Encryptor on the given CryptoToken, using the key with
the given keyID and algorithm |
Method Summary | |
---|---|
byte[] | encrypt(byte[] plaintext)
Encrypts a byte array. |
Parameters: 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.
Throws: InvalidKeyException If no key exists on this token with this keyID.
Parameters: plaintext The plaintext bytes to be encrypted.
Returns: The ciphertext. This is actually a DER-encoded Encoding object. It contains the keyID, AlgorithmIdentifier, and the encrypted plaintext. It is compatible with the SDRResult created by NSS's SecretDecoderRing.