au.net.aba.crypto.provider
Class DES

java.lang.Object
  |
  +--javax.crypto.CipherSpi
        |
        +--au.net.aba.crypto.provider.BlockCipher
              |
              +--au.net.aba.crypto.provider.DES
Direct Known Subclasses:
DESede

public class DES
extends BlockCipher

A class that provides DES encryption.


Field Summary
static java.lang.String ident
           
protected  int[] Kn1
           
protected  int[] work
           
 
Fields inherited from class au.net.aba.crypto.provider.BlockCipher
BLOCK_SIZE, buffer, bufferPos, CBC, cbcNextV, cbcV, ECB, firstBlock, ident, ivec, ivEncrypted, ivInline, key, mode, paddedStream, random, streamMode
 
Fields inherited from class javax.crypto.CipherSpi
ident
 
Constructor Summary
DES()
           
 
Method Summary
protected  int decryptBlock(byte[] in, int inOff, int len, byte[] out, int outOff)
          Decrypt the given block starting at the given offset and place the result in the provided buffer starting at the given offset.
protected  void desfunc(int[] block, int[] keys)
          the DES engine.
protected  int encryptBlock(byte[] in, int inOff, int len, byte[] out, int outOff)
          Encrypt the given block starting at the given offset and place the result in the provided buffer starting at the given offset.
protected  void prepareKeys(int opMode, byte[] key, int[] keys)
          prepare the key for whatever processing we are planing.
protected  void scrunch(byte[] outof, int offset, int[] into)
          pack 8 bytes from outof into 2 ints.
protected  void setKey(java.security.Key key)
          Re-key the cipher.
protected  void unscrunch(int[] outof, byte[] into, int offset)
          extract 8 bytes from the 2 ints in outof.
 
Methods inherited from class au.net.aba.crypto.provider.BlockCipher
engineDoFinal, engineDoFinal, engineGetBlockSize, engineGetIV, engineGetOutputSize, engineGetParameters, engineInit, engineInit, engineInit, engineSetMode, engineSetPadding, engineUpdate, engineUpdate, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ident

public static final java.lang.String ident

work

protected int[] work

Kn1

protected int[] Kn1
Constructor Detail

DES

public DES()
Method Detail

setKey

protected void setKey(java.security.Key key)
               throws java.security.InvalidKeyException
Description copied from class: BlockCipher
Re-key the cipher. If the provided Key is not compatible with this cipher the exception should throw an InvalidKeyException.
Overrides:
setKey in class BlockCipher

encryptBlock

protected int encryptBlock(byte[] in,
                           int inOff,
                           int len,
                           byte[] out,
                           int outOff)
                    throws IllegalBlockSizeException
Description copied from class: BlockCipher
Encrypt the given block starting at the given offset and place the result in the provided buffer starting at the given offset. The input will be an exact multiple of our blocksize.
Overrides:
encryptBlock in class BlockCipher

decryptBlock

protected int decryptBlock(byte[] in,
                           int inOff,
                           int len,
                           byte[] out,
                           int outOff)
                    throws BadPaddingException
Description copied from class: BlockCipher
Decrypt the given block starting at the given offset and place the result in the provided buffer starting at the given offset. The input will be an exact multiple of our blocksize.
Overrides:
decryptBlock in class BlockCipher

prepareKeys

protected void prepareKeys(int opMode,
                           byte[] key,
                           int[] keys)
prepare the key for whatever processing we are planing. Acknowledgements for this routine go to James Gillogly & Phil Karn. (whoever, and wherever they are!).

scrunch

protected void scrunch(byte[] outof,
                       int offset,
                       int[] into)
pack 8 bytes from outof into 2 ints.

unscrunch

protected void unscrunch(int[] outof,
                         byte[] into,
                         int offset)
extract 8 bytes from the 2 ints in outof.

desfunc

protected void desfunc(int[] block,
                       int[] keys)
the DES engine.