简体   繁体   中英

Encrypt a file in Scala/Java using AES 256

I want to use symmetric encyption[AES -256] to encrypt and decrypt a [.dat] file using a secret key file provided to me from a team which they created using open ssl commands.

I am unable to find right examples to understand how to use the file already provided to me to encrypt and decrypt instead of generating a new key for the process in Scala.

Any help and guidance is appreciated.

You can use the Bouncy Castle library for that. Here'sa lightweight example listed on their website:

https://www.bouncycastle.org/specifications.html (section 5 & 5.1).

You can specify AES as encryption algorithm via the Engine (see section 5.2).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM