Android DES Decrypt desDecodeCBC(byte[] key, byte[] keyiv, byte[] data)

Here you can find the source of desDecodeCBC(byte[] key, byte[] keyiv, byte[] data)

Description

des Decode CBC

Declaration

public static byte[] desDecodeCBC(byte[] key, byte[] keyiv, byte[] data)
        throws Exception 

Method Source Code

//package com.java2s;
import java.security.Key;

import javax.crypto.Cipher;

import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESedeKeySpec;
import javax.crypto.spec.IvParameterSpec;

public class Main {

    public static byte[] desDecodeCBC(byte[] key, byte[] keyiv, byte[] data)
            throws Exception {
        Key deskey = null;/*  w  w  w . j  a v  a2  s . com*/
        DESedeKeySpec spec = new DESedeKeySpec(key);
        SecretKeyFactory keyfactory = SecretKeyFactory
                .getInstance("desede");
        deskey = keyfactory.generateSecret(spec);
        Cipher cipher = Cipher.getInstance("desede" + "/CBC/NoPadding");
        IvParameterSpec ips = new IvParameterSpec(keyiv);
        cipher.init(Cipher.DECRYPT_MODE, deskey, ips);
        byte[] bOut = cipher.doFinal(data);
        return bOut;
    }
}

Related

  1. decrypt(String data, String key)
  2. decode(String key, String data)
  3. desDecodeECB(byte[] key, byte[] data)
  4. decryptDES(String decryptString, String decryptKey)
  5. decryptDESFile(byte[] decryptData, String decryptKey)
  6. decode(String key, String data)