Decrypt AES encrypted file in java

前端 未结 4 2019
一生所求
一生所求 2021-02-06 17:42

I have a file encrypted with java application using AES. I also have a key file was encrypted with. But i can\'t understand how to use the key to decrypt file. Most tutorials an

4条回答
  •  礼貌的吻别
    2021-02-06 18:08

    The answer could be simply to put the key data as bytes into a SecretKeySpec like this:

    SecretKeySpec aesKey = new SecretKeySpec(myKeyData, "AES");
    

    Note that SecretKeySpec implements the Key interface, so you can use it directly in a Cipher.init() method. So there is no SecretKeyFactory needed, which you would use otherwise.

提交回复
热议问题