class Rex::Proto::Kerberos::Model::KdcResponse
This class provides a representation of a Kerberos
KDC-REQ (response) data definition
Attributes
@!attribute cname
@return [Rex::Proto::Kerberos::Model::PrincipalName] The name part of the client's principal identifier
@!attribute crealm
@return [String] The realm part of the client's principal identifier
@!attribute enc_part
@return [Rex::Proto::Kerberos::Model::EncryptedData] The encrypted part of the response
@!attribute msg_type
@return [Fixnum] The type of a protocol message
@!attribute pvno
@return [Fixnum] The protocol version number
@!attribute ticket
@return [Rex::Proto::Kerberos::Model::Ticket] The issued ticket
Public Instance Methods
Decodes the Rex::Proto::Kerberos::Model::KdcResponse
from an input
@param input [String, OpenSSL::ASN1::ASN1Data] the input to decode from @return [self] if decoding succeeds @raise [RuntimeError] if decoding doesn't succeed
# File lib/rex/proto/kerberos/model/kdc_response.rb, line 33 def decode(input) case input when String decode_string(input) when OpenSSL::ASN1::ASN1Data decode_asn1(input) else raise ::RuntimeError, 'Failed to decode KdcResponse, invalid input' end self end
Rex::Proto::Kerberos::Model::KdcResponse
encoding isn't supported
@raise [NotImplementedError]
# File lib/rex/proto/kerberos/model/kdc_response.rb, line 49 def encode raise ::NotImplementedError, 'KdcResponse encoding not supported' end
Private Instance Methods
Decodes a Rex::Proto::Kerberos::Model::KdcResponse
@param input [OpenSSL::ASN1::ASN1Data] the input to decode from @raise [RuntimeError] if decoding doesn't succeed
# File lib/rex/proto/kerberos/model/kdc_response.rb, line 68 def decode_asn1(input) input.value[0].value.each do |val| case val.tag when 0 self.pvno = decode_pvno(val) when 1 self.msg_type = decode_msg_type(val) when 3 self.crealm = decode_crealm(val) when 4 self.cname = decode_cname(val) when 5 self.ticket = decode_ticket(val) when 6 self.enc_part = decode_enc_part(val) else raise ::RuntimeError, 'Failed to decode KDC-RESPONSE SEQUENCE' end end end
Decodes the cname field
@param input [OpenSSL::ASN1::ASN1Data] the input to decode from @return [Rex::Proto::Kerberos::Type::PrincipalName]
# File lib/rex/proto/kerberos/model/kdc_response.rb, line 117 def decode_cname(input) Rex::Proto::Kerberos::Model::PrincipalName.decode(input.value[0]) end
Decodes the crealm field
@param input [OpenSSL::ASN1::ASN1Data] the input to decode from @return [String]
# File lib/rex/proto/kerberos/model/kdc_response.rb, line 109 def decode_crealm(input) input.value[0].value end
Decodes the enc_part
@param input [OpenSSL::ASN1::ASN1Data] the input to decode from @return [Rex::Proto::Kerberos::Model::EncryptedData]
# File lib/rex/proto/kerberos/model/kdc_response.rb, line 133 def decode_enc_part(input) Rex::Proto::Kerberos::Model::EncryptedData.decode(input.value[0]) end
Decodes the msg_type
from an OpenSSL::ASN1::ASN1Data
@param input [OpenSSL::ASN1::ASN1Data] the input to decode from @return [Fixnum]
# File lib/rex/proto/kerberos/model/kdc_response.rb, line 101 def decode_msg_type(input) input.value[0].value.to_i end
Decodes the pvno from an OpenSSL::ASN1::ASN1Data
@param input [OpenSSL::ASN1::ASN1Data] the input to decode from @return [Fixnum]
# File lib/rex/proto/kerberos/model/kdc_response.rb, line 93 def decode_pvno(input) input.value[0].value.to_i end
Decodes a Rex::Proto::Kerberos::Model::KdcResponse
from an String
@param input [String] the input to decode from
# File lib/rex/proto/kerberos/model/kdc_response.rb, line 58 def decode_string(input) asn1 = OpenSSL::ASN1.decode(input) decode_asn1(asn1) end
Decodes the ticket field
@param input [OpenSSL::ASN1::ASN1Data] the input to decode from @return [Rex::Proto::Kerberos::Type::Ticket]
# File lib/rex/proto/kerberos/model/kdc_response.rb, line 125 def decode_ticket(input) Rex::Proto::Kerberos::Model::Ticket.decode(input.value[0]) end