Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Implementation of key generation with AES CTR mode

843811Jun 1 2010 — edited Jun 3 2010
Hi,

I need to generate some secret keys with AES in CTR mode.
I used KeyGenerator for this task before:
KeyGenerator kg=KeyGenerator.getInstance("AES");
kg.init(128);
SecretKey sk=kg.generateKey();

But when i try to use AES in CTR mode i get "java.security.NoSuchAlgorithmException: AES/CTR/NoPadding KeyGenerator not available" exception

KeyGenerator kg=KeyGenerator.getInstance("AES/CTR/NoPadding");
kg.init(AES_key_size);
kg.init(params); //params type is IvParameterSpec
SecretKey sk=kg.generateKey();

Is there any other way to generate keys with AES in CTR mode?

Thx in advance
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 1 2010
Added on Jun 1 2010
4 comments
752 views