class Crypt::Crypter
- Crypt::Crypter
- Reference
- Object
Overview
Encrypt / Decrypt using OpenSSL Cipher. See https://crystal-lang.org/api/OpenSSL/Cipher.html
Defined in:
crypter.crConstructors
-
.new(secret : String, digest = :sha1, cipher_algo = "aes-256-cbc")
Creates a new
Crypter
instance.
Instance Method Summary
-
#cipher_decrypt(value : Bytes) : Bytes
Decrypt value encrypted by
#cipher_encrypt
. -
#cipher_encrypt(value) : Bytes
Encrypt the value which should be decrypted by
#cipher_decrypt
. -
#decrypt(value : Bytes, kind : Symbol, sign_error = Signer::INVALID_SIGN) : Bytes
Equivalent to
#verify_and_decrypt
, just a shortcut. -
#decrypt(value : String, kind : Symbol, sign_error = Signer::INVALID_SIGN) : Bytes
Equivalent to
#verify_and_decrypt
, just a shortcut. -
#decrypt(value : Bytes) : Bytes
Equivalent to
#cipher_decrypt
, just a shortcut. -
#encrypt(value : Bytes, kind : Symbol) : String
Equivalent to
#encrypt_and_sign
, just a shortcut. -
#encrypt(value : String, kind : Symbol) : String
Equivalent to
#encrypt_and_sign
, just a shortcut. -
#encrypt(value) : Bytes
Equivalent to
#cipher_encrypt
, just a shortcut. -
#encrypt_and_sign(value : Bytes) : String
Encrypt and sign a value.
-
#encrypt_and_sign(value : String) : String
Encrypt and sign a value.
- #signer : Signer
-
#verify_and_decrypt(value : String, sign_error = Signer::INVALID_SIGN) : Bytes
Verify and decrypt a signed value.
-
#verify_and_decrypt(value : Bytes, sign_error = Signer::INVALID_SIGN) : Bytes
Verify and decrypt a signed value.
Constructor Detail
Instance Method Detail
Encrypt the value which should be decrypted by #cipher_decrypt
.
See also #encrypt
, #encrypt_and_sign
.
Equivalent to #encrypt_and_sign
, just a shortcut.
Equivalent to #encrypt_and_sign
, just a shortcut.
Encrypt and sign a value. We need to sign the value in order to avoid padding attacks. Reference: http://www.limited-entropy.com/padding-oracle-attacks.
Encrypt and sign a value. We need to sign the value in order to avoid padding attacks. Reference: http://www.limited-entropy.com/padding-oracle-attacks.
Verify and decrypt a signed value. We need to verify the value in order to avoid padding attacks. Reference: http://www.limited-entropy.com/padding-oracle-attacks.
Verify and decrypt a signed value. We need to verify the value in order to avoid padding attacks. Reference: http://www.limited-entropy.com/padding-oracle-attacks.