Q: How do I use OpenSSL to encrypt files?
A: This depends on if you want symmetric or asymmetric encryption.
For symmetic encryption, you can use the following…
To encrypt:
> openssl aes-256-cbc -salt -a -e -in plaintext.txt -out encrypted.txt
To decrypt this, you can use the following.
> openssl aes-256-cbc -salt -a -d -in encrypted.txt -out plaintext.txt
Now, for Asymmetric encryption you must first generate your private key and extract the public key.
> openssl genrsa -des3 -out private.key 4096 > openssl -in private.key -pubout -out public.key
To encrypt:
> openssl rsautl -encrypt -pubin -inkey public.key \\
-in plaintext.txt -out encrypted.txt
To decrypt:
> openssl rsautl -decrypt -inkey private.key \\
-in encrypted.txt -out plaintext.txt
Posted: January 16th, 2007 under Answers, DragonFlyBSD, FreeBSD, NetBSD, OpenBSD, Security.
Comments: 1
Comments
Pingback from zean.no-ip.info » How do I use OpenSSL to encrypt files?
Time: February 25, 2007, 3:33 pm
[...] This depends on if you want symmetric or asymmetric encryption. For symmetic encryption, you can use the following… [...]

Write a comment