Class: Ronin::Support::Crypto::Cipher::AES

Inherits:
Ronin::Support::Crypto::Cipher show all
Defined in:
lib/ronin/support/crypto/cipher/aes.rb

Overview

The AES cipher.

Since:

  • 1.0.0

API:

  • public

Direct Known Subclasses

AES128, AES256

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Ronin::Support::Crypto::Cipher

#decrypt, #encrypt, #stream

Constructor Details

#initialize(key_size:, mode: :cbc, **kwargs) ⇒ AES

Initializes the AES cipher.

Parameters:

Since:

  • 1.0.0

API:

  • public



53
54
55
56
57
58
# File 'lib/ronin/support/crypto/cipher/aes.rb', line 53

def initialize(key_size: , mode: :cbc, **kwargs)
  super("aes-#{key_size}-#{mode}", **kwargs)

  @key_size = key_size
  @mode     = mode
end

Instance Attribute Details

#key_sizeInteger (readonly)

The AES cipher key size.

Returns:

  • The key size in bits.

Since:

  • 1.0.0

API:

  • public



34
35
36
# File 'lib/ronin/support/crypto/cipher/aes.rb', line 34

def key_size
  @key_size
end

#mode:cbc, ... (readonly)

The AES cipher mode.

Returns:

Since:

  • 1.0.0

API:

  • public



39
40
41
# File 'lib/ronin/support/crypto/cipher/aes.rb', line 39

def mode
  @mode
end

Class Method Details

.supportedArray<String>

The list of supported AES ciphers.

Returns:

  • The list of supported AES cipher names.

Since:

  • 1.0.0

API:

  • public



66
67
68
# File 'lib/ronin/support/crypto/cipher/aes.rb', line 66

def self.supported
  super().grep(/^aes/)
end