0

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.

  • Just to make sure I understand correctly ? you want to do that programatically, or using `openssl` in the shell ? With `openssl` is simple, it's just one command for encryption/decryption. Programatically, you might find your answer here: https://stackoverflow.com/a/51329687/2205089 – Alin Gabriel Arhip Jul 01 '22 at 22:31

1 Answers1

-1

You can use the Bouncy Castle library for that. Here‘s a 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).

Daniel
  • 7
  • 3