Class: EncryptedStrings::Cipher

Inherits:
Object
  • Object
show all
Defined in:
lib/encrypted_strings/cipher.rb

Overview

Represents the base class for all ciphers. By default, all ciphers are assumed to be able to decrypt strings. Note, however, that certain encryption algorithms do not allow decryption.

Direct Known Subclasses

AsymmetricCipher, ShaCipher, SymmetricCipher

Instance Method Summary collapse

Instance Method Details

#can_decrypt?Boolean

Can this string be decrypted? Default is true.

Returns:

  • (Boolean)

7
8
9
# File 'lib/encrypted_strings/cipher.rb', line 7

def can_decrypt?
  true
end

#decrypt(data) ⇒ Object

Attempts to decrypt the given data using the current configuration. By default, decryption is not implemented.

Raises:

  • (NotImplementedError)

13
14
15
# File 'lib/encrypted_strings/cipher.rb', line 13

def decrypt(data)
  raise NotImplementedError, "Decryption is not supported using a(n) #{self.class.name}"
end