Reputation: 1674
I'm writing a program that needs to encrypt a log file using openssl
and have a decryption key. For example I want to encrypt this file:
This is a test of encrypting a file
This is a test of encrypting a file
Using openssl
and I want to be able to decrypt it when I put in some decryption key, for sake of argument 123456789
will be the key.
def decrypt
print 'Enter key: '
key = gets.chomp
if key == decryption_key
# decrypt file
else
# don't decrypt file
end
end
I've read the docs on openssl
but I still don't fully understand how it works, could someone give me an example of what I'm trying to do, along with an example of the decryption part please?
Upvotes: 0
Views: 528