Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Contributor
Posts: 7
Registered: ‎07-06-2013
My Device: 8520
My Carrier: Maxis
Accepted Solution

Java EE AESKey equivalent

What is the equivalent of AESKey in Java EE?

 

curently i use this code to encrypt

 

private static byte[] encrypt(byte[] encryptionKey, byte[] plainText) throws Exception {


Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
SecretKeySpec key = new SecretKeySpec(encryptionKey, "AES");
byte[] x = cipher.init(Cipher.ENCRYPT_MODE, key);

return cipher.doFinal(x);
}

 

and it returns java.security.InvalidKeyException: Invalid AES key length: .. bytes

Highlighted
New Contributor
Posts: 7
Registered: ‎07-06-2013
My Device: 8520
My Carrier: Maxis

Re: Java EE AESKey equivalent

well, SecretKeySpec key = new SecretKeySpec(encryptionKey, "AES"); is same as AESKey

 

it was just restriction of Java's Cipher that restrict only 128 bit key length, but RIM does not restrict the key length on its AES crypto API..