Class: Rex::Proto::Kerberos::Model::DmsaKeyPackage

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

Overview

This class provides a representation of a Kerberos KERB-DMSA-KEY-PACKAGE message as defined in [MS-KILE 2.2.13](learn.microsoft.com/en-us/openspecs/windows_protocols/ms-kile/79170b21-ad15-4a1b-99c4-84b3992d9e70).

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

#current_keysObject

Returns the value of attribute current_keys.



10
11
12
# File 'lib/rex/proto/kerberos/model/dmsa_key_package.rb', line 10

def current_keys
  @current_keys
end

#expiration_intervalObject

Returns the value of attribute expiration_interval.



12
13
14
# File 'lib/rex/proto/kerberos/model/dmsa_key_package.rb', line 12

def expiration_interval
  @expiration_interval
end

#fetch_intervalObject

Returns the value of attribute fetch_interval.



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

def fetch_interval
  @fetch_interval
end

#previous_keysObject

Returns the value of attribute previous_keys.



11
12
13
# File 'lib/rex/proto/kerberos/model/dmsa_key_package.rb', line 11

def previous_keys
  @previous_keys
end

Instance Method Details

#decode(input) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/rex/proto/kerberos/model/dmsa_key_package.rb', line 15

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

  self
end

#encodeObject



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

def encode
  current_keys_asn1 = OpenSSL::ASN1::ASN1Data.new(encode_keys(current_keys), 0, :CONTEXT_SPECIFIC)
  previous_keys_asn1 = previous_keys ? OpenSSL::ASN1::ASN1Data.new(encode_keys(previous_keys), 1, :CONTEXT_SPECIFIC) : nil
  expiration_interval_asn1 = OpenSSL::ASN1::ASN1Data.new([encode_time(expiration_interval)], 2, :CONTEXT_SPECIFIC)
  fetch_interval_asn1 = OpenSSL::ASN1::ASN1Data.new([encode_time(fetch_interval)], 4, :CONTEXT_SPECIFIC)

  seq = OpenSSL::ASN1::Sequence.new([current_keys_asn1, previous_keys_asn1, expiration_interval_asn1, fetch_interval_asn1].compact)

  seq.to_der
end