List of utility methods to do DES Decrypt
String | decrypt(String data, String key) decrypt byte[] myKey = generateKey(key.getBytes()); SecretKeySpec spec = new SecretKeySpec(myKey, CIPHER_ALGORITHM); Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM); cipher.init(Cipher.DECRYPT_MODE, spec); byte[] encryptedData = Base64.decode(data, Base64.DEFAULT); byte[] decryptedData = cipher.doFinal(encryptedData); String result = new String(decryptedData); return result; ... |
String | decode(String key, String data) decode if (data == null) return null; try { DESKeySpec dks = new DESKeySpec(key.getBytes()); SecretKeyFactory keyFactory = SecretKeyFactory .getInstance("DES"); Key secretKey = keyFactory.generateSecret(dks); Cipher cipher = Cipher.getInstance(ALGORITHM_DES); ... |
byte[] | desDecodeCBC(byte[] key, byte[] keyiv, byte[] data) des Decode CBC Key deskey = null; 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[] | desDecodeECB(byte[] key, byte[] data) des Decode ECB Key deskey = null; 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)); ... |
String | decryptDES(String decryptString, String decryptKey) decrypt DES byte[] byteMi = String2Byte(decryptString); 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 decryptedData[] = cipher.doFinal(byteMi); return new String(decryptedData); |
byte[] | decryptDESFile(byte[] decryptData, String decryptKey) decrypt DES File 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; |
String | decode(String key, String data) decode if (data == null) return null; try { DESKeySpec dks = new DESKeySpec(key.getBytes()); SecretKeyFactory keyFactory = SecretKeyFactory .getInstance("DES"); Key secretKey = keyFactory.generateSecret(dks); Cipher cipher = Cipher.getInstance(ALGORITHM_DES); ... |
byte[] | decode(String key, byte[] data) decode try { DESKeySpec dks = new DESKeySpec(key.getBytes()); SecretKeyFactory keyFactory = SecretKeyFactory .getInstance("DES"); Key secretKey = keyFactory.generateSecret(dks); Cipher cipher = Cipher.getInstance(ALGORITHM_DES); IvParameterSpec iv = new IvParameterSpec(key.getBytes()); AlgorithmParameterSpec paramSpec = iv; ... |
byte[] | decrypt(byte[] key, byte[] src) decrypt 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); |
String | encode(String key, String data) encode if (data == null) return null; try { DESKeySpec dks = new DESKeySpec(key.getBytes()); SecretKeyFactory keyFactory = SecretKeyFactory .getInstance("DES"); Key secretKey = keyFactory.generateSecret(dks); Cipher cipher = Cipher.getInstance(ALGORITHM_DES); ... |