Class: Izokatu::Openssl::PrivateKey::Auth::CCM::Decrypter

Inherits:
Decrypter show all
Defined in:
lib/izokatu/openssl/private_key/auth/ccm/decrypter.rb

Overview

OpenSSL private key decrypter for authenticated ciphers in CCM mode

Constant Summary collapse

DEFAULT_CCM_IV_LENGTH =

Default iv (nonce) length for ciphers in CCM mode

7
DEFAULT_CCM_AUTH_TAG_LENGTH =

Default authentication tag length for ciphers in CCM mode

8

Constants inherited from Decrypter

Decrypter::DEFAULT_AUTH_TAG_LENGTH

Constants inherited from Default::Decrypter

Default::Decrypter::DEFAULT_OPTIONS

Instance Attribute Summary

Attributes inherited from Decrypter

#auth_data, #auth_tag

Attributes inherited from Default::Decrypter

#cipher, #key, #nonce

Attributes inherited from Decrypter

#decrypted_data, #decrypter, #encrypted_data

Instance Method Summary collapse

Methods inherited from Decrypter

#initialize, #perform

Methods inherited from Default::Decrypter

#create_decrypter!, #decrypt_data!, #initialize

Methods inherited from Decrypter

#decrypt_data!, #import_encrypted_data!, #initialize, #perform

Methods included from Callable

#call

Constructor Details

This class inherits a constructor from Izokatu::Openssl::PrivateKey::Auth::Decrypter

Instance Method Details

#initialize_auth_ccm_decrypter_params!Object (private)

Set length for iv and auth_tag before their initialization

Since:

  • 0.1.0



31
32
33
34
# File 'lib/izokatu/openssl/private_key/auth/ccm/decrypter.rb', line 31

def initialize_auth_ccm_decrypter_params!
  decrypter.iv_len = DEFAULT_CCM_IV_LENGTH
  decrypter.auth_tag_len = DEFAULT_CCM_AUTH_TAG_LENGTH
end

#initialize_auth_decrypter_params!Object (private)

Initializing decrypter auth params

Since:

  • 0.1.0



40
41
42
43
# File 'lib/izokatu/openssl/private_key/auth/ccm/decrypter.rb', line 40

def initialize_auth_decrypter_params!
  initialize_static_message_length!
  super
end

#initialize_decrypter_params!Object (private)

Initializing decrypter params

Since:

  • 0.1.0



22
23
24
25
# File 'lib/izokatu/openssl/private_key/auth/ccm/decrypter.rb', line 22

def initialize_decrypter_params!
  initialize_auth_ccm_decrypter_params!
  super
end

#initialize_static_message_length!Object (private)

Initializing message length for cipher in CCM mode

Since:

  • 0.1.0



49
50
51
# File 'lib/izokatu/openssl/private_key/auth/ccm/decrypter.rb', line 49

def initialize_static_message_length!
  decrypter.ccm_data_len = encrypted_data.length unless cipher.include?('ARIA')
end

#verify_tag_size!Object (private)

Note:

Redefined to use local auth tag length

Raising exception if auth tag is truncated

Raises:

  • RuntimeError

Since:

  • 0.1.0



59
60
61
# File 'lib/izokatu/openssl/private_key/auth/ccm/decrypter.rb', line 59

def verify_tag_size!
  raise 'tag is truncated!' unless auth_tag.bytesize == DEFAULT_CCM_AUTH_TAG_LENGTH
end