Class: ColumnCryptor::Encryptor
- Inherits:
-
Object
- Object
- ColumnCryptor::Encryptor
- Defined in:
- lib/column_cryptor/encryptor.rb
Overview
Given some plaintext, attempts to encrypt it. Requires that ColumnCryptor.private_key be set.
Instance Method Summary collapse
-
#encrypt ⇒ Object
Returns a Base64-encoded string of the encrypted (ciphertext) version of the plaintext.
-
#initialize(plaintext) ⇒ Encryptor
constructor
Returns a new ColumnCryptor::Encryptor object initialized with the given plaintext.
Constructor Details
#initialize(plaintext) ⇒ Encryptor
Returns a new ColumnCryptor::Encryptor object initialized with the given plaintext.
6 7 8 |
# File 'lib/column_cryptor/encryptor.rb', line 6 def initialize(plaintext) @plaintext = plaintext end |
Instance Method Details
#encrypt ⇒ Object
Returns a Base64-encoded string of the encrypted (ciphertext) version of the plaintext.
11 12 13 14 15 |
# File 'lib/column_cryptor/encryptor.rb', line 11 def encrypt unless @plaintext.blank? Base64.encode64 encrypted_data end end |