class Lucky::MessageEncryptor

Defined in:

lucky/support/message_encryptor.cr

Constructors

Instance Method Summary

Instance methods inherited from class Object

blank? : Bool blank?, present? : Bool present?

Constructor Detail

def self.new(secret : String, cipher_algorithm : String = "aes-256-cbc", digest : Symbol = :sha1) #

[View source]

Instance Method Detail

def decrypt(value : Bytes) : Bytes #

[View source]
def encrypt(value) : Bytes #

[View source]
def encrypt_and_sign(value : Slice(UInt8)) : String #

Encrypt and sign a message. We need to sign the message in order to avoid padding attacks. Reference: https://en.wikipedia.org/wiki/Padding_oracle_attack.


[View source]
def encrypt_and_sign(value : String) : String #

[View source]
def verifier : MessageVerifier #

[View source]
def verify_and_decrypt(value : String) : Bytes #

Verify and Decrypt a message. We need to verify the message in order to avoid padding attacks. Reference: https://en.wikipedia.org/wiki/Padding_oracle_attack.


[View source]