Android DES Decrypt decryptDESFile(byte[] decryptData, String decryptKey)

Here you can find the source of decryptDESFile(byte[] decryptData, String decryptKey)

Description

decrypt DES File

Declaration

public static byte[] decryptDESFile(byte[] decryptData,
            String decryptKey) throws Exception 

Method Source Code

//package com.java2s;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;

public class Main {
    private static byte[] iv = { 1, 2, 3, 4, 5, 6, 7, 8 };

    public static byte[] decryptDESFile(byte[] decryptData,
            String decryptKey) throws Exception {

        IvParameterSpec zeroIv = new IvParameterSpec(iv);
        SecretKeySpec key = new SecretKeySpec(decryptKey.getBytes(), "DES");
        Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
        cipher.init(Cipher.DECRYPT_MODE, key, zeroIv);
        byte decryptedResult[] = cipher.doFinal(decryptData);
        return decryptedResult;
    }/*ww w.j av a  2 s  .c o m*/
}

Related

  1. decrypt(String data, String key)
  2. decode(String key, String data)
  3. desDecodeCBC(byte[] key, byte[] keyiv, byte[] data)
  4. desDecodeECB(byte[] key, byte[] data)
  5. decryptDES(String decryptString, String decryptKey)
  6. decode(String key, String data)
  7. decode(String key, byte[] data)
  8. decrypt(byte[] key, byte[] src)
  9. encode(String key, String data)