Class: Passman::Crypto
- Inherits:
-
Object
- Object
- Passman::Crypto
- Defined in:
- lib/passman/crypto.rb
Constant Summary collapse
- MINIMUM_SIZE_KEY =
32
Class Method Summary collapse
Class Method Details
.decrypt(encrypted_password, key) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/passman/crypto.rb', line 17 def decrypt(encrypted_password, key) cipher = new_cipher cipher.decrypt cipher.key = sanitize_key(key) decrypted_password = cipher.update(Base64.decode64(encrypted_password)) decrypted_password << cipher.final end |
.encrypt(password, key) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/passman/crypto.rb', line 9 def encrypt(password, key) cipher = new_cipher cipher.encrypt cipher.key = sanitize_key(key) encrypted_password = cipher.update(password) + cipher.final Base64.encode64(encrypted_password) end |