Created
August 27, 2016 09:19
-
-
Save Serphentas/3d0fb1deeeb616b9232b6c8b4846cef5 to your computer and use it in GitHub Desktop.
[Java] Bouncy Castle AES-CTR null pointer exception
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Security.addProvider(new BouncyCastleProvider()); | |
Cipher c = Cipher.getInstance("AES/CTR/NoPadding",new BouncyCastleProvider()); | |
System.out.println(c.getProvider()); | |
KeyGenerator kg = KeyGenerator.getInstance("AES"); | |
c.init(Cipher.ENCRYPT_MODE, kg.generateKey()); | |
System.out.println(c.update(new byte[20]).length); // output: 16 | |
System.out.println(c.update(new byte[1]).length); // null pointer exception |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment