Class: Rex::Proto::Kerberos::Model::KerbSupersededByUser

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

Overview

This class provides a representation of a Kerberos KERB-SUPERSEDED-BY-USER 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

#principal_nameObject

Returns the value of attribute principal_name.



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

def principal_name
  @principal_name
end

#realmObject

Returns the value of attribute realm.



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

def realm
  @realm
end

Instance Method Details

#==(other) ⇒ Object



15
16
17
# File 'lib/rex/proto/kerberos/model/kerb_superseded_by_user.rb', line 15

def ==(other)
  realm == other.realm && principal_name == other.principal_name
end

#decode(input) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/rex/proto/kerberos/model/kerb_superseded_by_user.rb', line 23

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 KerbSupersededByUser, invalid input'
  end

  self
end

#encodeObject



36
37
38
39
40
41
42
# File 'lib/rex/proto/kerberos/model/kerb_superseded_by_user.rb', line 36

def encode
  principal_name_asn1 = OpenSSL::ASN1::ASN1Data.new([encode_principal_name], 1, :CONTEXT_SPECIFIC)
  realm_asn1 = OpenSSL::ASN1::ASN1Data.new([encode_realm], 2, :CONTEXT_SPECIFIC)
  seq = OpenSSL::ASN1::Sequence.new([principal_name_asn1, realm_asn1])

  seq.to_der
end

#to_sObject



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

def to_s
  "#{principal_name}@#{realm}"
end