Class: AEAD::Cipher::AES_256_CBC_HMAC_SHA_256

Inherits:
AEAD::Cipher
  • Object
show all
Includes:
AES_HMAC
Defined in:
lib/aead/cipher/aes_256_cbc_hmac_sha_256.rb

Overview

Encrypt plaintext using the CBC mode of AES and authenticate the result with HMAC-SHA-256.

Class Method Summary collapse

Methods included from AES_HMAC

#initialize

Methods inherited from AEAD::Cipher

#decrypt, #encrypt, generate_key, #key_len, new, #nonce_len, signature_compare

Class Method Details

.cipher_modeObject



21
# File 'lib/aead/cipher/aes_256_cbc_hmac_sha_256.rb', line 21

def self.cipher_mode; 'aes-256-cbc'; end

.digest_modeObject



22
# File 'lib/aead/cipher/aes_256_cbc_hmac_sha_256.rb', line 22

def self.digest_mode; 'SHA256'; end

.encryption_key_lenObject



18
# File 'lib/aead/cipher/aes_256_cbc_hmac_sha_256.rb', line 18

def self.encryption_key_len; 32; end

.generate_nonceObject

CBC requires a randomly-generated nonce.



27
28
29
# File 'lib/aead/cipher/aes_256_cbc_hmac_sha_256.rb', line 27

def self.generate_nonce
  SecureRandom.random_bytes(self.nonce_len)
end

.iv_lenObject



14
# File 'lib/aead/cipher/aes_256_cbc_hmac_sha_256.rb', line 14

def self.iv_len;    16; end

.key_lenObject



13
# File 'lib/aead/cipher/aes_256_cbc_hmac_sha_256.rb', line 13

def self.key_len;   64; end

.nonce_lenObject



15
# File 'lib/aead/cipher/aes_256_cbc_hmac_sha_256.rb', line 15

def self.nonce_len; 16; end

.signing_key_lenObject



19
# File 'lib/aead/cipher/aes_256_cbc_hmac_sha_256.rb', line 19

def self.signing_key_len;    32; end

.tag_lenObject



16
# File 'lib/aead/cipher/aes_256_cbc_hmac_sha_256.rb', line 16

def self.tag_len;   32; end