Equivalent to OpenSSL commands in java

前端 未结 1 1591
深忆病人
深忆病人 2020-12-21 15:06

I\'m not very familiar with encryption of files in java or openssl for that matter. I know the basics from school but have never actually implemented it.

Now I\'ve b

相关标签:
1条回答
  • 2020-12-21 16:10

    The random byte array code is fine but why Base64 encode the random bytes, that is really only neccessary for display of perhaps use where only ASCII charactrers are required.

    For AES encryption see the Java docs for javax.crypto.

    Use SecureRandom to create the iv and prepend it to the encrypted data, it does not need to be secret. On decryption just pick the iv from the data to use for the iv.

    0 讨论(0)
提交回复
热议问题