- edited description
InvalidAlgorithmParameter Exception
Issue #96
invalid
Hi,
Actually im trying to implement AES/GCM/NoPadding in Android Kitkat version but its not happening im getting above exception .
As a experiment i tried to change Provider Name as BC,SUNJCE but none of the provider is working for me..
im using following code snippet:
SecureRandom sr = new SecureRandom();
byte[] output = new byte[16];
sr.nextBytes(output);
KeyGenerator keyGen = KeyGenerator.getInstance("AES");
keyGen.init(AES_KEY_SIZE, sr);
SecretKey key = keyGen.generateKey();
Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding","BC");
final byte[] nonce = new byte[GCM_NONCE_LENGTH];
sr.nextBytes(nonce);
GCMParameterSpec spec = new GCMParameterSpec(GCM_TAG_LENGTH * 8, nonce);
cipher.init(Cipher.ENCRYPT_MODE, key, spec);//This statement is not executing
Log.e(TAG, "AESGCM.... before AAD "+spec);
byte[] aad = "Whatever I like".getBytes();;
cipher.updateAAD(aad);
I have also tried to use jose4j-0.4.3-SNAPSHOT.jar file but didnt work out.
Kindly help me out on this , Thanks in advance,,!
Cordially, Rakesh App-Java/Android
Comments (2)
-
reporter -
repo owner - changed status to invalid
I'm sorry but this isn't about the library and I'm not in a position to troubleshoot or help with something like this.
- Log in to comment