Class: Rex::Proto::Kerberos::Model::ApRep

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

Overview

This class provides a representation of a Kerberos AP-REP (response) data definition

Constant Summary

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

AP_REP, AP_REQ, AS_REP, AS_REQ, AUTHENTICATOR, 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

#enc_partRex::Proto::Kerberos::Model::EncryptedData

Returns The encrypted part of the response.

Returns:



18
19
20
# File 'lib/rex/proto/kerberos/model/ap_rep.rb', line 18

def enc_part
  @enc_part
end

#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/ap_rep.rb', line 15

def msg_type
  @msg_type
end

#pvnoInteger

Returns The protocol version number.

Returns:

  • (Integer)

    The protocol version number



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

def pvno
  @pvno
end

Instance Method Details

#decode(input) ⇒ self

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

Parameters:

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

    the input to decode from

Returns:

  • (self)

    if decoding succeeds

Raises:



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

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

  self
end

#decrypt_enc_part(key) ⇒ Object



45
46
47
48
49
# File 'lib/rex/proto/kerberos/model/ap_rep.rb', line 45

def decrypt_enc_part(key)
  data = enc_part.decrypt_asn1(key, Rex::Proto::Kerberos::Crypto::KeyUsage::AP_REP_ENCPART)

  result = Rex::Proto::Kerberos::Model::EncApRepPart::decode(data)
end

#encodeObject

Rex::Proto::Kerberos::Model::ApRep encoding isn’t supported

Raises:

  • (NotImplementedError)


41
42
43
# File 'lib/rex/proto/kerberos/model/ap_rep.rb', line 41

def encode
  raise ::NotImplementedError, 'ApRep encoding not supported'
end