| |
Algorithms, classes, and methods | page 5 of 7 |
JDK 1.4 supports the following private key algorithms: - DES. DES (Data Encryption Standard) was invented by IBM in the 1970s and adopted by the U.S. government as a standard. It is a 56-bit block cipher.
- TripleDES. This algorithm is used to deal with the growing weakness of a 56-bit key while leveraging DES technology by running plaintext through the DES algorithm three times, with two keys, giving an effective key strength of 112 bits. TripleDES is sometimes known as DESede (for encrypt, decrypt, and encrypt, which are the three phases).
- AES. AES (Advanced Encryption Standard) replaces DES as the U.S. standard. It was invented by Joan Daemen and Vincent Rijmen and is also known as the Rinjdael algorithm. It is a 128-bit block cipher with key lengths of 128, 192, or 256 bits.
- RC2, RC4, and RC5. These are algorithms from a leading encryption security company, RSA Security.
- Blowfish. This algorithm was developed by Bruce Schneier and is a block cipher with variable key lengths from 32 to 448 bits (in multiples of 8), and was designed for efficient implementation in software for microprocessors.
- PBE. PBE (Password Based Encryption) can be used in combination with a variety of message digest and private key algorithms.
The Cipher class manipulates private key algorithms using a key produced by the KeyGenerator class. The following methods are used in the Private key cryptography code example: - KeyGenerator.getInstance("DES"), .init(56), and .generateKey(): Generates the key.
- Cipher.getInstance("DES/ECB/PKCS5Padding"): Creates the Cipher object (specifying the algorithm, mode, and padding).
- .init(Cipher.ENCRYPT_MODE, key): Initializes the Cipher object.
- .doFinal(plainText): Calculates the ciphertext with a plaintext string.
- .init(Cipher.DECRYPT_MODE, key): Decrypts the ciphertext.
- .doFinal(cipherText): Computes the ciphertext.
|