Here is an exmple:

    byte[] data = ...; // data encrypted with DES-CBC-CRC
    byte[] keyBytes = ...;  // the DES key used to encrypt data.
    final byte[] iv = new byte[]
        { ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte
) 0x00, ( byte ) 0x00, ( byte ) 0x00,
            ( byte ) 0x00 };
    Cipher cipher = Cipher.getInstance( "DES/CBC/NoPadding" );
    SecretKey key = new SecretKeySpec( keyBytes, "DES" );
    AlgorithmParameterSpec paramSpec = new IvParameterSpec( iv );
    cipher.init( Cipher.DECRYPT_MODE, key, paramSpec );
    byte[] decryptedData = cipher.doFinal( data );

    Has the decryptedData got here already discarded the padding bytes? If
not, how to discard these data?

   Is there somebody familar with this?
   Thanks in advance.

-- 
Leo Li
China Software Development Lab, IBM

Reply via email to