Android DES Decrypt desDecodeECB(byte[] key, byte[] data)

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

Description

des Decode ECB

Declaration

public static byte[] desDecodeECB(byte[] key, 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 android.util.Base64;

public class Main {

    public static byte[] desDecodeECB(byte[] key, byte[] data)
            throws Exception {
        Key deskey = null;//from w ww  . j  a v  a2  s  .c om
        DESedeKeySpec spec = new DESedeKeySpec(key);
        SecretKeyFactory keyfactory = SecretKeyFactory
                .getInstance("desede");
        deskey = keyfactory.generateSecret(spec);
        Cipher cipher = Cipher.getInstance("desede" + "/ECB/NoPadding");
        cipher.init(Cipher.DECRYPT_MODE, deskey);
        byte[] bOut = cipher.doFinal(Base64.decode(data, Base64.DEFAULT));
        return bOut;
    }
}

Related

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