Pages

Friday, 8 January 2016

Encrypt And Decrypt Using TripleDES in Java

Name Algorithm
TripleDES
KeyLength
192 bit / 24 Character
Block Size
64 bit
Tutorial Encrypt And Decrypt Using TripleDES in Java
https://youtu.be/ih6M79mEzk4

Wednesday, 30 December 2015

[SOLVED] org.bouncycastle.jcajce.provider.symmetric.util.BaseBlockCipher$1: Key length not 128/192/256 bits.

SOURCE
 ----- 
Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
 byte[] input = "Hello".getBytes();
 byte[] keyByte = "1234567812345678123456781234567".getBytes();
 SecretKeySpec key = new SecretKeySpec(keyByte, "AES");
----
ERROR
Dec 31, 2015 11:57:52 AM aes256.AES256 main
SEVERE: null
org.bouncycastle.jcajce.provider.symmetric.util.BaseBlockCipher$1: Key length not 128/192/256 bits.
at org.bouncycastle.jcajce.provider.symmetric.util.BaseBlockCipher.engineInit(Unknown Source)
at org.bouncycastle.jcajce.provider.symmetric.util.BaseBlockCipher.engineInit(Unknown Source)
at javax.crypto.Cipher.init(Cipher.java:1246)
at javax.crypto.Cipher.init(Cipher.java:1186)
at aes256.AES256.main(AES256.java:36)
Caused by: java.lang.IllegalArgumentException: Key length not 128/192/256 bits.
at org.bouncycastle.crypto.engines.AESFastEngine.generateWorkingKey(Unknown Source)
at org.bouncycastle.crypto.engines.AESFastEngine.init(Unknown Source)
at org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher.init(Unknown Source)
at org.bouncycastle.jcajce.provider.symmetric.util.BaseBlockCipher$BufferedGenericBlockCipher.init(Unknown Source)
... 5 more
BUILD SUCCESSFUL (total time: 1 second)
SOLUTION
Key Leng AES must 128 / 192 / 256 bit or 16 / 24 / 32 Character 
 Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
 byte[] input = "Hello".getBytes();
 byte[] keyByte = "12345678123456781234567812345678".getBytes();
 SecretKeySpec key = new SecretKeySpec(keyByte, "AES");

Tuesday, 29 December 2015

Encrpt And Decrypt Using AES 256 in Java

Name Algorithm
AES 256
Type Algorithm
Block Cipher
Key Length
256 bit / 32 Character
Link Video Encrypt and Decrypt Using AES 256 in Java
https://youtu.be/NS0QBDq9PfA


Monday, 30 November 2015

Encrypt And Decrypt Using Blowfish in C++

Name Algorithm
Blowfish
Type Algorithm
Block Cipher
Key Length
128 bit / 16 Character
Block Size
64 bit / 8 Character
Link Tutorial Encrypt And Decrypt Using Blowfish in C++
https://youtu.be/5Av0FqFdfGU