Module: SetecAstronomy::AESCrypt
- Defined in:
- lib/setec_astronomy/aes_crypt.rb
Class Method Summary collapse
- .decrypt(encrypted_data, key, iv, cipher_type) ⇒ Object
- .encrypt(data, key, iv, cipher_type) ⇒ Object
Class Method Details
.decrypt(encrypted_data, key, iv, cipher_type) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/setec_astronomy/aes_crypt.rb', line 3 def self.decrypt(encrypted_data, key, iv, cipher_type) aes = OpenSSL::Cipher::Cipher.new(cipher_type) aes.decrypt aes.key = key aes.iv = iv unless iv.nil? aes.update(encrypted_data) + aes.final end |
.encrypt(data, key, iv, cipher_type) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/setec_astronomy/aes_crypt.rb', line 11 def self.encrypt(data, key, iv, cipher_type) aes = OpenSSL::Cipher::Cipher.new(cipher_type) aes.encrypt aes.key = key aes.iv = iv unless iv.nil? aes.update(data) + aes.final end |