Module: Rex::Proto::Kerberos::Crypto::Encryption

Defined in:
lib/rex/proto/kerberos/crypto.rb

Overview

Constant Summary collapse

DES_CBC_CRC =
1
DES_CBC_MD4 =
2
DES_CBC_MD5 =
3
DES3_CBC_SHA1 =
16
AES128 =
17
AES256 =
18
RC4_HMAC =
23
IANA_NAMES =

Mapping of encryption type numbers to the human readable text description by IANA www.iana.org/assignments/kerberos-parameters/kerberos-parameters.xhtml

{
  DES_CBC_CRC => 'des-cbc-crc',
  DES_CBC_MD4 => 'des-cbc-md4',
  DES_CBC_MD5 => 'des-cbc-md5',
  DES3_CBC_SHA1 => 'des3-cbc-sha1-kd',
  AES128 => 'aes128-cts-hmac-sha1-96',
  AES256 => 'aes256-cts-hmac-sha1-96',
  RC4_HMAC => 'rc4-hmac'
}
DefaultOfferedEtypes =

The default etypes to offer to the Kerberos server when none is provided

[AES256, AES128, RC4_HMAC, DES_CBC_MD5, DES3_CBC_SHA1]
PkinitEtypes =
[AES256, AES128]
DefaultEncryptionType =

The individual etype used by an encryptor when none is provided

RC4_HMAC
SUPPORTED_ENCRYPTIONS =
ENCRYPTORS.keys

Class Method Summary collapse

Class Method Details

.const_name(code) ⇒ Object

Return a string representation of the constant for a number

Parameters:

  • code (Integer)


107
108
109
110
111
112
# File 'lib/rex/proto/kerberos/crypto.rb', line 107

def self.const_name(code)
  (self.constants - [:DefaultEncryptionType]).each do |c|
    return c.to_s if self.const_get(c) == code
  end
  return nil
end

.from_etype(etype) ⇒ Rex::Proto::Kerberos::Crypto::BlockCipherBase

Parameters:

  • etype (Integer)

Returns:

Raises:

  • (::NotImplementedError)


123
124
125
126
127
128
# File 'lib/rex/proto/kerberos/crypto.rb', line 123

def self.from_etype(etype)
  result = ENCRYPTORS[etype]
  raise ::NotImplementedError, "EncryptedData schema #{etype.inspect} is not supported" if result == nil

  result.new
end

.value_for(const_name) ⇒ Object

Return a integer value for the given encryption const name

Parameters:

  • const_name (String)


117
118
119
# File 'lib/rex/proto/kerberos/crypto.rb', line 117

def self.value_for(const_name)
  self.const_get(const_name)
end