Class: ColumnCryptor::Decryptor

Inherits:
Object
  • Object
show all
Defined in:
lib/column_cryptor/decryptor.rb

Overview

Given some ciphertext, attempts to decrypt it. Requires that ColumnCryptor.private_key be previously set to the same private key used to create the ciphertext.

Instance Method Summary collapse

Constructor Details

#initialize(encrypted_data) ⇒ Decryptor

Returns a new ColumnCryptor::Decryptor object initialized with the given ciphertext.



7
8
9
# File 'lib/column_cryptor/decryptor.rb', line 7

def initialize(encrypted_data)
  @encrypted_data = encrypted_data
end

Instance Method Details

#decryptObject

Returns decrypted version of the Base64-encoded ciphertext.



12
13
14
15
16
# File 'lib/column_cryptor/decryptor.rb', line 12

def decrypt
  unless @encrypted_data.blank?
    plaintext_data
  end
end