class ActiveRecord::Encryption::Cipher

Defined in:

active_record/encryption/cipher.cr

Constant Summary

CIPHER_TYPE = "aes-256-gcm"
IV_LENGTH = 12

https://github.com/rails/rails/blob/885734a85ef4f4578400bda72a7507dd09a85e64/activerecord/lib/active_record/encryption/cipher/aes256_gcm.rb#L95

Constructors

Instance Method Summary

Constructor Detail

def self.new(secret : Bytes | String) #

Instance Method Detail

def decrypt(encrypted_message) #

def encrypt(clear_text, deterministic = false) #

Ported from https://github.com/rails/rails/blob/main/activerecord/lib/active_record/encryption/cipher/aes256_gcm.rb https://docs.openssl.org/1.1.1/man3/EVP_EncryptInit/#synopsis cipher = OpenSSL::Cipher.new("aes-256-gcm") cipher.encrypt cipher.key = "1"*32 iv = "1" * 12 data = cipher.update("foo") data << cipher.final p cipher.auth_tag


def generate_deterministic_iv(clear_text) #

def generate_iv(cipher, clear_text, deterministic) #