class Rex::Proto::Kerberos::Model::EncKdcResponse
Attributes
@!attribute auth_time
@return [Time] the time of initial authentication for the named principal
@!attribute end_time
@return [Time] This field contains the time after which the ticket will not be honored (its expiration time)
@!attribute flags
@return [Fixnum] This field indicates which of various options were used or requested when the ticket was issued
@!attribute key
@return [Rex::Proto::Kerberos::Model::EncryptionKey] The session key
@!attribute key_expiration
@return [Time] The key-expiration field is part of the response from the KDC and specifies the time that the client's secret key is due to expire
@!attribute last_req
@return [Array<Rex::Proto::Kerberos::Model::LastRequest>] This field is returned by the KDC and specifies the time(s) of the last request by a principal
@!attribute nonce
@return [Fixnum] random number
@!attribute renew_till
@return [Time] This field is only present in tickets that have the RENEWABLE flag set in the flags field. It indicates the maximum endtime that may be included in a renewal
@!attribute sname
@return [Rex::Proto::Kerberos::Model::PrincipalName] The name part of the server's identity
@!attribute srealm
@return [String] The realm part of the server's principal identifier
@!attribute start_time
@return [Time] Specifies the time after which the ticket is valid
Public Instance Methods
Decodes the Rex::Proto::Kerberos::Model::EncKdcResponse
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/enc_kdc_response.rb, line 52 def decode(input) case input when String decode_string(input) when OpenSSL::ASN1::ASN1Data decode_asn1(input) else raise ::RuntimeError, 'Failed to decode EncKdcResponse, invalid input' end self end
Rex::Proto::Kerberos::Model::EncKdcResponse
encoding isn't supported
@raise [NotImplementedError]
# File lib/rex/proto/kerberos/model/enc_kdc_response.rb, line 68 def encode raise ::NotImplementedError, 'EncKdcResponse encoding not supported' end
Private Instance Methods
Decodes a Rex::Proto::Kerberos::Model::EncKdcResponse
@param input [OpenSSL::ASN1::ASN1Data] the input to decode from @raise [RuntimeError] if decoding doesn't succeed
# File lib/rex/proto/kerberos/model/enc_kdc_response.rb, line 87 def decode_asn1(input) input.value[0].value.each do |val| case val.tag when 0 self.key = decode_key(val) when 1 self.last_req = decode_last_req(val) when 2 self.nonce = decode_nonce(val) when 3 self.key_expiration = decode_key_expiration(val) when 4 self.flags = decode_flags(val) when 5 self.auth_time = decode_auth_time(val) when 6 self.start_time = decode_start_time(val) when 7 self.end_time = decode_end_time(val) when 8 self.renew_till = decode_renew_till(val) when 9 self.srealm = decode_srealm(val) when 10 self.sname = decode_sname(val) else raise ::RuntimeError, 'Failed to decode ENC-KDC-RESPONSE SEQUENCE' end end end
Decodes the auth_time
field
@param input [OpenSSL::ASN1::ASN1Data] the input to decode from @return [Time]
# File lib/rex/proto/kerberos/model/enc_kdc_response.rb, line 167 def decode_auth_time(input) input.value[0].value end
Decodes the end_time
field
@param input [OpenSSL::ASN1::ASN1Data] the input to decode from @return [Time]
# File lib/rex/proto/kerberos/model/enc_kdc_response.rb, line 183 def decode_end_time(input) input.value[0].value end
Decodes the flags field
@param input [OpenSSL::ASN1::ASN1Data] the input to decode from @return [Fixnum]
# File lib/rex/proto/kerberos/model/enc_kdc_response.rb, line 159 def decode_flags(input) input.value[0].value.to_i end
Decodes the key from an OpenSSL::ASN1::ASN1Data
@param input [OpenSSL::ASN1::ASN1Data] the input to decode from @return [EncryptionKey]
# File lib/rex/proto/kerberos/model/enc_kdc_response.rb, line 122 def decode_key(input) Rex::Proto::Kerberos::Model::EncryptionKey.decode(input.value[0]) end
Decodes the key_expiration
field
@param input [OpenSSL::ASN1::ASN1Data] the input to decode from @return [Time]
# File lib/rex/proto/kerberos/model/enc_kdc_response.rb, line 151 def decode_key_expiration(input) input.value[0].value end
Decodes the last_req
from an OpenSSL::ASN1::ASN1Data
@param input [OpenSSL::ASN1::ASN1Data] the input to decode from @return [Array<Rex::Proto::Kerberos::Model::LastRequest>]
# File lib/rex/proto/kerberos/model/enc_kdc_response.rb, line 130 def decode_last_req(input) last_requests = [] input.value[0].value.each do |last_request| last_requests << Rex::Proto::Kerberos::Model::LastRequest.decode(last_request) end last_requests end
Decodes the nonce field
@param input [OpenSSL::ASN1::ASN1Data] the input to decode from @return [Fixnum]
# File lib/rex/proto/kerberos/model/enc_kdc_response.rb, line 143 def decode_nonce(input) input.value[0].value.to_i end
Decodes the renew_till
field
@param input [OpenSSL::ASN1::ASN1Data] the input to decode from @return [Time]
# File lib/rex/proto/kerberos/model/enc_kdc_response.rb, line 191 def decode_renew_till(input) input.value[0].value end
Decodes the sname field
@param input [OpenSSL::ASN1::ASN1Data] the input to decode from @return [Rex::Proto::Kerberos::Type::PrincipalName]
# File lib/rex/proto/kerberos/model/enc_kdc_response.rb, line 207 def decode_sname(input) Rex::Proto::Kerberos::Model::PrincipalName.decode(input.value[0]) end
Decodes the srealm field
@param input [OpenSSL::ASN1::ASN1Data] the input to decode from @return [String]
# File lib/rex/proto/kerberos/model/enc_kdc_response.rb, line 199 def decode_srealm(input) input.value[0].value end
Decodes the start_time
field
@param input [OpenSSL::ASN1::ASN1Data] the input to decode from @return [Time]
# File lib/rex/proto/kerberos/model/enc_kdc_response.rb, line 175 def decode_start_time(input) input.value[0].value end
Decodes a Rex::Proto::Kerberos::Model::EncKdcResponse
from an String
@param input [String] the input to decode from
# File lib/rex/proto/kerberos/model/enc_kdc_response.rb, line 77 def decode_string(input) asn1 = OpenSSL::ASN1.decode(input) decode_asn1(asn1) end