| Author |
How use the same SecretKey (not random each time it runs) ?
|
Daniel Rodriguez Hernandez
Greenhorn
Joined: Nov 26, 2009
Posts: 13
|
|
Hi everybody.
I need to encrypt and decrypt using the same SecretKey for AES, but if you use the method "GenerateKey ()", it generates a new key every time ..
Is there a way to encrypt and decrypt with a key defined by me, not creating a new one every time?
Thank you.
|
 |
greg stark
Ranch Hand
Joined: Aug 10, 2006
Posts: 220
|
|
|
use a SecretKeySpec.
|
Nice to meet you.
|
 |
Daniel Rodriguez Hernandez
Greenhorn
Joined: Nov 26, 2009
Posts: 13
|
|
Ok, thank you..
I used SecretKeySpec but it threw me a "Invalid length key 7 bytes"... Then I read that the key must be of length 16 bytes... i.e, a character per byte, 16 character..
Now It works fine.
Thank you
|
 |
 |
|
|
subject: How use the same SecretKey (not random each time it runs) ?
|
|
|