class Cryptor::SymmetricEncryption::Ciphers::XSalsa20Poly1305
XSalsa20+Poly1305 authenticated stream cipher
Public Instance Methods
decrypt(key, ciphertext)
click to toggle source
# File lib/cryptor/symmetric_encryption/ciphers/xsalsa20poly1305.rb, line 16 def decrypt(key, ciphertext) box(key).decrypt(ciphertext) rescue RbNaCl::CryptoError => ex raise CorruptedMessageError, ex.to_s end
encrypt(key, plaintext)
click to toggle source
# File lib/cryptor/symmetric_encryption/ciphers/xsalsa20poly1305.rb, line 12 def encrypt(key, plaintext) box(key).encrypt(plaintext) end
Private Instance Methods
box(key)
click to toggle source
# File lib/cryptor/symmetric_encryption/ciphers/xsalsa20poly1305.rb, line 24 def box(key) RbNaCl::SimpleBox.new(RbNaCl::SecretBoxes::XSalsa20Poly1305.new(key)) end