java.lang.Object
org.codelibs.jcifs.smb1.util.DES
This code is derived from the above source
JCIFS API
Norbert Hranitzky
and modified again by Michael B. Allen
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]decrypt(byte[] cipherText) Decrypts an 8-byte block using DESvoiddecrypt(byte[] cipherText, byte[] clearText) Decrypts an 8-byte block using DESbyte[]encrypt(byte[] clearText) Encrypts an 8-byte block using DESvoidencrypt(byte[] clearText, byte[] cipherText) Encrypts an 8-byte block using DESstatic voidmakeSMBKey(byte[] key7, byte[] key8) Converts a 7-byte SMB key to an 8-byte DES key with parity bitsvoidsetKey(byte[] key) Sets the DES encryption keystatic voidspreadIntsToBytes(int[] inInts, int inOff, byte[] outBytes, int outOff, int intLen) Converts integers to bytes after internal DES processingstatic voidsquashBytesToInts(byte[] inBytes, int inOff, int[] outInts, int outOff, int intLen) Converts bytes to integers for internal DES processing
-
Constructor Details
-
DES
public DES()Creates a DES cipher instance without a key -
DES
public DES(byte[] key) Creates a DES cipher instance with the specified key- Parameters:
key- the DES key (7 or 8 bytes)
-
-
Method Details
-
makeSMBKey
public static void makeSMBKey(byte[] key7, byte[] key8) Converts a 7-byte SMB key to an 8-byte DES key with parity bits- Parameters:
key7- the 7-byte SMB keykey8- the output 8-byte DES key
-
setKey
public void setKey(byte[] key) Sets the DES encryption key- Parameters:
key- the 8-byte DES key
-
encrypt
public void encrypt(byte[] clearText, byte[] cipherText) Encrypts an 8-byte block using DES- Parameters:
clearText- the 8-byte plaintext blockcipherText- the output 8-byte ciphertext block
-
decrypt
public void decrypt(byte[] cipherText, byte[] clearText) Decrypts an 8-byte block using DES- Parameters:
cipherText- the 8-byte ciphertext blockclearText- the output 8-byte plaintext block
-
encrypt
public byte[] encrypt(byte[] clearText) Encrypts an 8-byte block using DES- Parameters:
clearText- the 8-byte plaintext block- Returns:
- the 8-byte ciphertext block
-
decrypt
public byte[] decrypt(byte[] cipherText) Decrypts an 8-byte block using DES- Parameters:
cipherText- the 8-byte ciphertext block- Returns:
- the 8-byte plaintext block
-
squashBytesToInts
public static void squashBytesToInts(byte[] inBytes, int inOff, int[] outInts, int outOff, int intLen) Converts bytes to integers for internal DES processing- Parameters:
inBytes- the input byte arrayinOff- the offset into the input arrayoutInts- the output integer arrayoutOff- the offset into the output arrayintLen- the number of integers to convert
-
spreadIntsToBytes
public static void spreadIntsToBytes(int[] inInts, int inOff, byte[] outBytes, int outOff, int intLen) Converts integers to bytes after internal DES processing- Parameters:
inInts- the input integer arrayinOff- the offset into the input arrayoutBytes- the output byte arrayoutOff- the offset into the output arrayintLen- the number of integers to convert
-