Browsed by
Category: Encryption

Android Encryption and Decryption String with AES/DES .

Android Encryption and Decryption String with AES/DES .

Base Class :  import android.util.Base64; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.security.GeneralSecurityException; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; /** * Created by ADN Digital on 1/17/2018. */ public class EncryptionDecryption { public static String encrypt(String value, String key) throws UnsupportedEncodingException, InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException { byte[] value_bytes = value.getBytes(“UTF-8”); byte[] key_bytes = getKeyBytes(key); return Base64.encodeToString(encrypt(value_bytes, key_bytes, key_bytes), 0); } public static byte[] encrypt(byte[] paramArrayOfByte1, byte[] paramArrayOfByte2, byte[]…

Read More Read More