• Post Reply Bookmark Topic Watch Topic
  • New Topic

AES SecretKeyFactory not available - error with secretKey file  RSS feed

 
Kevin P Smith
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I have the following code for generating and reading a secretKey file which I use for encode/decode.

Just wondering if anyone could shed any light onto why I get the



Error when running my encryption/decryption code.

below is the code for generating the key and reading the key and encryption/decryption...



Encryption


Decryption


Cheers in advance

KS
 
Richard Tookey
Bartender
Posts: 1166
17
Java Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems that the AES secret key factory is missing in 1.7 (a known bug ). Since SecretKeySpec extends SecretKey this is easy to get round
 
Kevin P Smith
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fantastic, cool & cheers all rolled into one!
 
Richard Tookey
Bartender
Posts: 1166
17
Java Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kevin P Smith wrote:Fantastic, cool & cheers all rolled into one!

Of course you do realize that your Cipher construction defaults to using ECB block mode which is generally considered insecure since it allows splicing of ciphertext to produce valid forged cleartext. you should really use one of the feedback block modes such as CBC.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!