I have a scenario where I am encrypting and decrypting a string using Cypher by using SecretKey. I am storing SecretKey (AES type) into a keystore (JCEKS type keystore) by using a small java code and retriving that key for encryption and decryption.
But when i try to use key (RSA type) from keystore (JKS type) generated using "keytool" i am getting exception :
java.security.InvalidKeyException: Wrong format: RAW bytes needed
The command i have used to generate keystore using keytool : keytool -genkey -alias key3 -keyalg RSA -keystore teststore.jks -storepass tspassword
Please explain me, weather it is possible to use the key generated using keytool for encryption and decryption?
If so please explain me.
"Experience is what you get when you didn't get what you wanted" -- Randy Pausch