Class: Rex::Proto::Kerberos::Model::KdcRequest

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

Overview

This class provides a representation of a Kerberos KDC-REQ (request) data definition

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

#msg_typeInteger

Returns The type of a protocol message.

Returns:

  • (Integer)

    The type of a protocol message



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

def msg_type
  @msg_type
end

#pa_dataArray<Rex::Proto::Kerberos::Model::PreAuthDataEntry>

be needed before credentials can be issued or decrypted

Returns:



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

def pa_data
  @pa_data
end

#pvnoInteger

Returns The protocol version number.

Returns:

  • (Integer)

    The protocol version number



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

def pvno
  @pvno
end

#req_bodyRex::Proto::Kerberos::Model:::KdcRequestBody

Returns The request body.

Returns:

  • (Rex::Proto::Kerberos::Model:::KdcRequestBody)

    The request body



22
23
24
# File 'lib/rex/proto/kerberos/model/kdc_request.rb', line 22

def req_body
  @req_body
end

Instance Method Details

#decode(input) ⇒ self

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

Parameters:

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

    the input to decode from

Returns:

  • (self)

    if decoding succeeds

Raises:



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/rex/proto/kerberos/model/kdc_request.rb', line 29

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

  self
end

#encodeString

Encodes the Rex::Proto::Kerberos::Model::KdcRequest into an ASN.1 String

Returns:

  • (String)


45
46
47
48
49
50
51
52
53
# File 'lib/rex/proto/kerberos/model/kdc_request.rb', line 45

def encode
  pvno_asn1 = OpenSSL::ASN1::ASN1Data.new([encode_pvno], 1, :CONTEXT_SPECIFIC)
  msg_type_asn1 = OpenSSL::ASN1::ASN1Data.new([encode_msg_type], 2, :CONTEXT_SPECIFIC)
  pa_data_asn1 = OpenSSL::ASN1::ASN1Data.new([encode_pa_data], 3, :CONTEXT_SPECIFIC)
  req_body_asn1 = OpenSSL::ASN1::ASN1Data.new([encode_req_body], 4, :CONTEXT_SPECIFIC)
  seq = OpenSSL::ASN1::Sequence.new([pvno_asn1, msg_type_asn1, pa_data_asn1, req_body_asn1])
  seq_asn1 = OpenSSL::ASN1::ASN1Data.new([seq], msg_type, :APPLICATION)
  seq_asn1.to_der
end