Class: Devise::Encryptors::Aes256

Inherits:
Base
  • Object
show all
Defined in:
lib/encryptors/aes256.rb

Overview

AES

Uses the AES algorithm to encrypt passwords.

Class Method Summary collapse

Class Method Details

.decrypt(encrypted_password, pepper) ⇒ Object

Returns the plaintext password where pepper is used for the key, and the initialization_vector is read from the Base64 encoded ciphertext



19
20
21
# File 'lib/encryptors/aes256.rb', line 19

def decrypt(encrypted_password, pepper)        
  password = ::AES.decrypt(encrypted_password, pepper)
end

.digest(password, stretches, salt, pepper) ⇒ Object Also known as: encrypt

Returns a Base64 encrypted password where pepper is used for the key, and the initialization_vector is randomly generated and prepended onto encoded ciphertext



12
13
14
# File 'lib/encryptors/aes256.rb', line 12

def digest(password, stretches, salt, pepper)
  digest = ::AES.encrypt(password, pepper, {:iv => salt})
end