gnu.javax.crypto.cipher
Class DES
- Cloneable, IBlockCipher, gnu.javax.crypto.cipher.IBlockCipherSpi
The Data Encryption Standard. DES is a 64-bit block cipher with a 56-bit
key, developed by IBM in the 1970's for the standardization process begun by
the National Bureau of Standards (now NIST).
New applications should not use DES except for compatibility.
This version is based upon the description and sample implementation in
[1].
References:
- Bruce Schneier, Applied Cryptography: Protocols, Algorithms, and
Source Code in C, Second Edition. (1996 John Wiley and Sons) ISBN
0-471-11709-9. Pages 265--301, 623--632.
static int | BLOCK_SIZE - DES operates on 64 bit blocks.
|
static int | KEY_SIZE - DES uses 56 bits of a 64 bit parity-adjusted key.
|
static byte[][] | POSSIBLE_WEAK_KEYS - Possible weak keys (parity adjusted) --produce 4 instead of 16 subkeys.
|
static byte[][] | SEMIWEAK_KEYS - Semi-weak keys (parity adjusted): Some pairs of keys encrypt plain text
to identical cipher text.
|
static byte[][] | WEAK_KEYS - Weak keys (parity adjusted): If all the bits in each half are either 0
or 1, then the key used for any cycle of the algorithm is the same as
all other cycles.
|
DES() - Default 0-argument constructor.
|
static void | adjustParity(byte[] kb, int offset) - Adjust the parity for a raw key array.
|
Iterator<E> | blockSizes() - Returns an
Iterator over the supported block sizes.
|
Object | clone() - Returns a clone of this instance.
|
void | decrypt(byte[] in, int i, byte[] out, int o, Object K, int bs)
|
void | encrypt(byte[] in, int i, byte[] out, int o, Object K, int bs)
|
static boolean | isParityAdjusted(byte[] kb, int offset) - Test if a byte array, which must be at least 8 bytes long, is parity
adjusted.
|
static boolean | isPossibleWeak(byte[] kb) - Test if the designated byte array represents a possibly weak key.
|
static boolean | isSemiWeak(byte[] kb) - Test if a key is a semi-weak key.
|
static boolean | isWeak(byte[] kb) - Test if a key is a weak key.
|
Iterator<E> | keySizes() - Returns an
Iterator over the supported key sizes.
|
Object | makeKey(byte[] kb, int bs)
|
clone , currentBlockSize , decryptBlock , defaultBlockSize , defaultKeySize , encryptBlock , init , name , reset , selfTest , testKat , testKat |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
BLOCK_SIZE
public static final int BLOCK_SIZE
DES operates on 64 bit blocks.
KEY_SIZE
public static final int KEY_SIZE
DES uses 56 bits of a 64 bit parity-adjusted key.
POSSIBLE_WEAK_KEYS
public static final byte[][] POSSIBLE_WEAK_KEYS
Possible weak keys (parity adjusted) --produce 4 instead of 16 subkeys.
SEMIWEAK_KEYS
public static final byte[][] SEMIWEAK_KEYS
Semi-weak keys (parity adjusted): Some pairs of keys encrypt plain text
to identical cipher text. In other words, one key in the pair can decrypt
messages that were encrypted with the other key. These keys are called
semi-weak keys. This occurs because instead of 16 different sub-keys being
generated, these semi-weak keys produce only two different sub-keys.
WEAK_KEYS
public static final byte[][] WEAK_KEYS
Weak keys (parity adjusted): If all the bits in each half are either 0
or 1, then the key used for any cycle of the algorithm is the same as
all other cycles.
DES
public DES()
Default 0-argument constructor.
adjustParity
public static void adjustParity(byte[] kb,
int offset)
Adjust the parity for a raw key array. This essentially means that each
byte in the array will have an odd number of '1' bits (the last bit in
each byte is unused.
kb
- The key array, to be parity-adjusted.offset
- The starting index into the key bytes.
decrypt
public void decrypt(byte[] in,
int i,
byte[] out,
int o,
Object K,
int bs)
- decrypt in interface gnu.javax.crypto.cipher.IBlockCipherSpi
encrypt
public void encrypt(byte[] in,
int i,
byte[] out,
int o,
Object K,
int bs)
- encrypt in interface gnu.javax.crypto.cipher.IBlockCipherSpi
isParityAdjusted
public static boolean isParityAdjusted(byte[] kb,
int offset)
Test if a byte array, which must be at least 8 bytes long, is parity
adjusted.
kb
- The key bytes.offset
- The starting index into the key bytes.
true
if the first 8 bytes of kb have been
parity adjusted. false
otherwise.
isPossibleWeak
public static boolean isPossibleWeak(byte[] kb)
Test if the designated byte array represents a possibly weak key.
kb
- the byte array to test.
true
if kb
represents a possibly weak key.
Returns false
otherwise.
isSemiWeak
public static boolean isSemiWeak(byte[] kb)
Test if a key is a semi-weak key.
true
if this key is semi-weak.
isWeak
public static boolean isWeak(byte[] kb)
Test if a key is a weak key.
DES.java --
Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc.
This file is a part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at
your option) any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.