public void generateDes() throws Exception
{
byte[] desKeyData =
{ ( byte ) 0x01, ( byte ) 0x02, ( byte ) 0x03, ( byte ) 0x04, ( byte ) 0x05, ( byte ) 0x06, ( byte ) 0x07,
( byte ) 0x08 };
DESKeySpec desKeySpec = new DESKeySpec( desKeyData );
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance( "DES" );
SecretKey desKey = keyFactory.generateSecret( desKeySpec );
assertEquals( "DES key size", 8, desKey.getEncoded().length );
assertTrue( DESKeySpec.isParityAdjusted( desKey.getEncoded(), 0 ) );
}