module Encryptor
A simple wrapper for the standard OpenSSL library
Public Instance Methods
decrypt(*args, &block)
click to toggle source
Decrypts a :value
with a specified :key
Optionally accepts :iv
and :algorithm
options
Example
decrypted_value = Encryptor.decrypt(:value => 'some encrypted string', :key => 'some secret key') # or decrypted_value = Encryptor.decrypt('some encrypted string', :key => 'some secret key')
# File lib/encryptor.rb, line 43 def decrypt(*args, &block) crypt :decrypt, *args, &block end
default_options()
click to toggle source
The default options to use when calling the encrypt
and
decrypt
methods
Defaults to { :algorithm => 'aes-256-cbc' }
Run 'openssl list-cipher-commands' in your terminal to view a list all cipher algorithms that are supported on your platform
# File lib/encryptor.rb, line 17 def default_options @default_options ||= { :algorithm => 'aes-256-cbc' } end
encrypt(*args, &block)
click to toggle source
Encrypts a :value
with a specified :key
Optionally accepts :iv
and :algorithm
options
Example
encrypted_value = Encryptor.encrypt(:value => 'some string to encrypt', :key => 'some secret key') # or encrypted_value = Encryptor.encrypt('some string to encrypt', :key => 'some secret key')
# File lib/encryptor.rb, line 30 def encrypt(*args, &block) crypt :encrypt, *args, &block end