Class: Rex::Proto::Kerberos::Model::PreAuthEtypeInfo2Entry

Inherits:
Element
  • Object
show all
Defined in:
lib/rex/proto/kerberos/model/pre_auth_etype_info2_entry.rb

Overview

This class provides a representation of a PA-Etype-Info2-Entry structure, which contains information about valid encryption types and salts that can be used to authenticate using Kerberos Pre-Authentication

Constant Summary

Constants included from Rex::Proto::Kerberos::Model

AP_REP, AP_REQ, AS_REP, AS_REQ, AUTHENTICATOR, ENC_AP_REP_PART, ENC_KRB_CRED_PART, KRB_CRED, KRB_ERROR, TGS_REP, TGS_REQ, TICKET, VERSION

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Element

attr_accessor, attributes, #attributes, decode, #initialize

Constructor Details

This class inherits a constructor from Rex::Proto::Kerberos::Model::Element

Instance Attribute Details

#etypeInteger

Returns The supported encryption type.

Returns:

  • (Integer)

    The supported encryption type



13
14
15
# File 'lib/rex/proto/kerberos/model/pre_auth_etype_info2_entry.rb', line 13

def etype
  @etype
end

#s2kparamsString

Returns An encryption type-specific parameter.

Returns:

  • (String)

    An encryption type-specific parameter



19
20
21
# File 'lib/rex/proto/kerberos/model/pre_auth_etype_info2_entry.rb', line 19

def s2kparams
  @s2kparams
end

#saltString

Returns The salt that should be used with this encryption type.

Returns:

  • (String)

    The salt that should be used with this encryption type



16
17
18
# File 'lib/rex/proto/kerberos/model/pre_auth_etype_info2_entry.rb', line 16

def salt
  @salt
end

Instance Method Details

#decode(input) ⇒ self

Decodes the Rex::Proto::Kerberos::Model::PreAuthEtypeInfo2Entry from an input

Parameters:

  • input (String, OpenSSL::ASN1::ASN1Data)

    the input to decode from

Returns:

  • (self)

    if decoding succeeds

Raises:



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/rex/proto/kerberos/model/pre_auth_etype_info2_entry.rb', line 26

def decode(input)
  case input
  when String
    decode_string(input)
  when OpenSSL::ASN1::ASN1Data
    decode_asn1(input)
  else
    raise ::Rex::Proto::Kerberos::Model::Error::KerberosDecodingError, 'Failed to decode ETYPE-INFO2, invalid input'
  end

  self
end

#encodeString

Encodes a Rex::Proto::Kerberos::Model::PreAuthEtypeInfo2Entry into an ASN.1 String

Returns:

  • (String)


42
43
44
45
46
47
48
49
50
# File 'lib/rex/proto/kerberos/model/pre_auth_etype_info2_entry.rb', line 42

def encode
  result = []
  result << OpenSSL::ASN1::ASN1Data.new([encode_etype], 0, :CONTEXT_SPECIFIC)
  result << OpenSSL::ASN1::ASN1Data.new([encode_salt], 1, :CONTEXT_SPECIFIC) if self.salt
  result << OpenSSL::ASN1::ASN1Data.new([encode_s2kparams], 2, :CONTEXT_SPECIFIC) if self.s2kparams
  seq = OpenSSL::ASN1::Sequence.new(result)

  seq.to_der
end