Android DES Decrypt decrypt(byte[] key, byte[] src)

Here you can find the source of decrypt(byte[] key, byte[] src)

Description

decrypt

Declaration

private static byte[] decrypt(byte[] key, byte[] src) 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 };

    private static byte[] decrypt(byte[] key, byte[] src) throws Exception {
        IvParameterSpec zeroIv = new IvParameterSpec(iv);
        SecretKeySpec spec = new SecretKeySpec(key, "DES");
        Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
        cipher.init(Cipher.DECRYPT_MODE, spec, zeroIv);
        return cipher.doFinal(src);
    }/*from   ww  w.j  a va  2 s  .  c  o  m*/
}

Related

  1. desDecodeECB(byte[] key, byte[] data)
  2. decryptDES(String decryptString, String decryptKey)
  3. decryptDESFile(byte[] decryptData, String decryptKey)
  4. decode(String key, String data)
  5. decode(String key, byte[] data)
  6. encode(String key, String data)
  7. decryptBytes(String key, byte[] src)
  8. decryptEDE(byte[] key, byte[] src)