de.bb.security
Class DES3

java.lang.Object
  |
  +--de.bb.security.BlockCipher
        |
        +--de.bb.security.DES
              |
              +--de.bb.security.DES3

public class DES3
extends DES

The triple-DES encryption method. This is a fairly standard way of increasing the security of DES. You run each block through DES three times, first encrypting with key A, then decrypting with key B, then encrypting with key C.


Fields inherited from class de.bb.security.BlockCipher
blockSize
 
Constructor Summary
DES3()
          Creates a new TripleDes object
 
Method Summary
 void decrypt(byte[] cipherText, int cipherOff, byte[] clearText, int clearOff)
          Decrypt one block of bytes.
 void encrypt(byte[] clearText, int clearOff, byte[] cipherText, int cipherOff)
          Encrypt one block of bytes.
 void setKey(byte[] key)
          Set the key for encryption and decryption.
 void setKeyUnchecked(byte[] key)
          Set the key for encryption and decryption.
 
Methods inherited from class de.bb.security.DES
establishParity, generateKey, isOdd, keyIsWeak, makeKeyData
 
Methods inherited from class de.bb.security.BlockCipher
blockSize, decryptCBC, decryptCBCAndPadd, decryptECB, encryptCBC, encryptCBCAndPadd, encryptECB, getBufferLength
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DES3

public DES3()
Creates a new TripleDes object
See Also:
DesCipher, BlockCipher
Method Detail

setKey

public void setKey(byte[] key)
Set the key for encryption and decryption.
Overrides:
setKey in class DES
Parameters:
key - the given key, an array with 16 bytes

setKeyUnchecked

public void setKeyUnchecked(byte[] key)
Set the key for encryption and decryption.
Overrides:
setKeyUnchecked in class DES
Parameters:
key - the given key, an array with 16 bytes

encrypt

public void encrypt(byte[] clearText,
                    int clearOff,
                    byte[] cipherText,
                    int cipherOff)
Encrypt one block of bytes. You may use one byte array as input data and output data, to encrypt in place.
Overrides:
encrypt in class DES
Parameters:
clearText - input data which is encrypted
clearOff - offset into input data
cipherText - output data which is encrypted.
cipherOff - offset into output data

decrypt

public void decrypt(byte[] cipherText,
                    int cipherOff,
                    byte[] clearText,
                    int clearOff)
Decrypt one block of bytes. You may use one byte array as input data and output data, to decrypt in place.
Overrides:
decrypt in class DES
Parameters:
cipherText - output data which is encrypted.
cipherOff - offset into output data
clearText - input data which is encrypted
clearOff - offset into input data