You are currently viewing a snapshot of taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to, please file a bug.

Class Encryptor

  extended by org.mozilla.jss.SecretDecoderRing.Encryptor

public class Encryptor
extends java.lang.Object

Encrypts data with the SecretDecoderRing.

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.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


public static final EncryptionAlgorithm DEFAULT_ENCRYPTION_ALG
The default encryption algorithm, currently DES3_CBC.

Constructor Detail


public Encryptor(CryptoToken token,
                 byte[] keyID,
                 EncryptionAlgorithm alg)
          throws TokenException,
Creates an Encryptor on the given CryptoToken, using the key with the given keyID and algorithm

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: - If no key exists on this token with this keyID.
Method Detail


public byte[] encrypt(byte[] plaintext)
               throws CryptoManager.NotInitializedException,
Encrypts a byte array.

plaintext - The plaintext bytes to be encrypted.
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.