Top Description Fields Constructors Methods
com.sun.crypto.provider

pack-priv Class DESCrypt

extends SymmetricCipher
implements DESConstants
Class Inheritance
All Implemented Interfaces
com.sun.crypto.provider.DESConstants
Known Direct Subclasses
com.sun.crypto.provider.DESedeCrypt
Imports
java.security.InvalidKeyException

This is the internal DES class responsible for encryption and decryption of a byte array of size DES_BLOCK_SIZE.
Authors
Gigi Ankeny, Jan Luehe
See Also
DESConstants, DESCipher

Field Summary

Modifier and TypeField and Description
pack-priv boolean
pack-priv byte[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]
private static final int[]

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv void
cipherBlock(byte[] in, int inOffset, byte[] out, int outOffset)

pack-priv void
decryptBlock(byte[]
the buffer with the input data to be decrypted
cipher
,
int
the offset in cipherOffset
cipherOffset
,
byte[]
the buffer for the result
plain
,
int
the offset in plain
plainOffset
)

Implements abstract com.sun.crypto.provider.SymmetricCipher.decryptBlock.

Performs decryption operation.
pack-priv void
encryptBlock(byte[]
the buffer with the input data to be encrypted
plain
,
int
the offset in plain
plainOffset
,
byte[]
the buffer for the result
cipher
,
int
the offset in cipher
cipherOffset
)

Implements abstract com.sun.crypto.provider.SymmetricCipher.encryptBlock.

Performs encryption operation.
pack-priv void
expandKey(byte[] key)

pack-priv int

Returns:

this cipher's block size
getBlockSize
()

Implements abstract com.sun.crypto.provider.SymmetricCipher.getBlockSize.

Returns this cipher's block size.
pack-priv void
init(boolean
flag indicating encryption or decryption
decrypting
,
String
the algorithm name
algorithm
,
byte[]
the key
rawKey
)

Implements abstract com.sun.crypto.provider.SymmetricCipher.init.

Initializes the cipher in the specified mode with the given key.
private static int
initialPermutationLeft(byte[] block, int offset)

private static int
initialPermutationRight(byte[] block, int offset)

private static void
perm(int left, int right, byte[] out, int offset)

Field Detail

decryptingback to summary
pack-priv boolean decrypting
expandedKeyback to summary
pack-priv byte[] expandedKey
initPermLeft0back to summary
private static final int[] initPermLeft0
initPermLeft1back to summary
private static final int[] initPermLeft1
initPermLeft2back to summary
private static final int[] initPermLeft2
initPermLeft3back to summary
private static final int[] initPermLeft3
initPermLeft4back to summary
private static final int[] initPermLeft4
initPermLeft5back to summary
private static final int[] initPermLeft5
initPermLeft6back to summary
private static final int[] initPermLeft6
initPermLeft7back to summary
private static final int[] initPermLeft7
initPermLeft8back to summary
private static final int[] initPermLeft8
initPermLeft9back to summary
private static final int[] initPermLeft9
initPermLeftAback to summary
private static final int[] initPermLeftA
initPermLeftBback to summary
private static final int[] initPermLeftB
initPermLeftCback to summary
private static final int[] initPermLeftC
initPermLeftDback to summary
private static final int[] initPermLeftD
initPermLeftEback to summary
private static final int[] initPermLeftE
initPermLeftFback to summary
private static final int[] initPermLeftF
initPermRight0back to summary
private static final int[] initPermRight0
initPermRight1back to summary
private static final int[] initPermRight1
initPermRight2back to summary
private static final int[] initPermRight2
initPermRight3back to summary
private static final int[] initPermRight3
initPermRight4back to summary
private static final int[] initPermRight4
initPermRight5back to summary
private static final int[] initPermRight5
initPermRight6back to summary
private static final int[] initPermRight6
initPermRight7back to summary
private static final int[] initPermRight7
initPermRight8back to summary
private static final int[] initPermRight8
initPermRight9back to summary
private static final int[] initPermRight9
initPermRightAback to summary
private static final int[] initPermRightA
initPermRightBback to summary
private static final int[] initPermRightB
initPermRightCback to summary
private static final int[] initPermRightC
initPermRightDback to summary
private static final int[] initPermRightD
initPermRightEback to summary
private static final int[] initPermRightE
initPermRightFback to summary
private static final int[] initPermRightF
permLeft1back to summary
private static final int[] permLeft1
permLeft3back to summary
private static final int[] permLeft3
permLeft5back to summary
private static final int[] permLeft5
permLeft7back to summary
private static final int[] permLeft7
permLeft9back to summary
private static final int[] permLeft9
permLeftBback to summary
private static final int[] permLeftB
permLeftDback to summary
private static final int[] permLeftD
permLeftFback to summary
private static final int[] permLeftF
permRight0back to summary
private static final int[] permRight0
permRight2back to summary
private static final int[] permRight2
permRight4back to summary
private static final int[] permRight4
permRight6back to summary
private static final int[] permRight6
permRight8back to summary
private static final int[] permRight8
permRightAback to summary
private static final int[] permRightA
permRightCback to summary
private static final int[] permRightC
permRightEback to summary
private static final int[] permRightE
s0pback to summary
private static final int[] s0p
s1pback to summary
private static final int[] s1p
s2pback to summary
private static final int[] s2p
s3pback to summary
private static final int[] s3p
s4pback to summary
private static final int[] s4p
s5pback to summary
private static final int[] s5p
s6pback to summary
private static final int[] s6p
s7pback to summary
private static final int[] s7p

Constructor Detail

DESCryptback to summary
pack-priv DESCrypt()

Method Detail

cipherBlockback to summary
pack-priv void cipherBlock(byte[] in, int inOffset, byte[] out, int outOffset)
decryptBlockback to summary
pack-priv void decryptBlock(byte[] cipher, int cipherOffset, byte[] plain, int plainOffset)

Implements abstract com.sun.crypto.provider.SymmetricCipher.decryptBlock.

Performs decryption operation.

The input cipher text cipher, starting at cipherOffset and ending at (cipherOffset + len - 1), is decrypted. The result is stored in plain, starting at plainOffset.

The subclass that implements Cipher should ensure that init has been called before this method is called.

Parameters
cipher:byte[]

the buffer with the input data to be decrypted

cipherOffset:int

the offset in cipherOffset

plain:byte[]

the buffer for the result

plainOffset:int

the offset in plain

encryptBlockback to summary
pack-priv void encryptBlock(byte[] plain, int plainOffset, byte[] cipher, int cipherOffset)

Implements abstract com.sun.crypto.provider.SymmetricCipher.encryptBlock.

Performs encryption operation.

The input plain text plain, starting at plainOffset and ending at (plainOffset + len - 1), is encrypted. The result is stored in cipher, starting at cipherOffset.

The subclass that implements Cipher should ensure that init has been called before this method is called.

Parameters
plain:byte[]

the buffer with the input data to be encrypted

plainOffset:int

the offset in plain

cipher:byte[]

the buffer for the result

cipherOffset:int

the offset in cipher

expandKeyback to summary
pack-priv void expandKey(byte[] key)
getBlockSizeback to summary
pack-priv int getBlockSize()

Implements abstract com.sun.crypto.provider.SymmetricCipher.getBlockSize.

Returns this cipher's block size.

Returns:int

this cipher's block size

initback to summary
pack-priv void init(boolean decrypting, String algorithm, byte[] rawKey) throws InvalidKeyException

Implements abstract com.sun.crypto.provider.SymmetricCipher.init.

Doc from com.sun.crypto.provider.SymmetricCipher.init.

Initializes the cipher in the specified mode with the given key.

Parameters
decrypting:boolean

flag indicating encryption or decryption

algorithm:String

the algorithm name

rawKey:byte[]

the key

Exceptions
InvalidKeyException:
if the given key is inappropriate for initializing this cipher
initialPermutationLeftback to summary
private static int initialPermutationLeft(byte[] block, int offset)
initialPermutationRightback to summary
private static int initialPermutationRight(byte[] block, int offset)
permback to summary
private static void perm(int left, int right, byte[] out, int offset)