Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Security and the fly likes Trouble encrypting correctly with AES with a static key Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Security
Bookmark "Trouble encrypting correctly with AES with a static key" Watch "Trouble encrypting correctly with AES with a static key" New topic
Author

Trouble encrypting correctly with AES with a static key

Bernardo Luz
Greenhorn

Joined: Jun 04, 2007
Posts: 1
Hi. I'm trying to get JCE to work with the following example using AES in ECB mode (yes, ECB shouldn't be used, but it's what I'm supposed to use): given a clear text String represented by the bytes (in hex) 546578746F2070617261207465737465 and a key 6573736173656E686165686672616361, the program is supposed to provide the encrypted bytes A506A19333F306AC2C62CBE931963AE7. I used an online encryption service to check for myself if the above is true, and it is. However, I just can't get it to work right in Java:



All examples I found generate a key instead of using a static one. Well, I need to use that specific key.

What am I doing wrong? Thank you very much!

[ June 04, 2007: Message edited by: Bernardo Luz ]
[ June 07, 2007: Message edited by: Bernardo Luz ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Trouble encrypting correctly with AES with a static key
 
Similar Threads
padding problem with AES(help)
How to use AES DECRYPT_MODE?
AES decryption - InvalidKeyException: Parameters missing
AES Encryption/Decrypton
BadPaddingException in AES