Easy way to store/restore encryption key for decrypting string in java

前端 未结 4 1261
梦毁少年i
梦毁少年i 2020-12-23 15:13

For encryption I use something like this:

SecretKey aesKey = KeyGenerator.getInstance(\"AES\").generateKey();
StringEncrypter aesEncrypt = new StringEncrypte         


        
4条回答
  •  一整个雨季
    2020-12-23 16:05

    Just for reference, the output you're seeing is the result of the default toString method and the funny number on the end is a hash code. See here. Hash codes are by design not reversible, and toString is not necessarily guaranteed to give you enough information to reconstruct the original object (although it does for certain classes).

提交回复
热议问题