class Rex::Proto::Kerberos::Model::ApReq
This class provides a representation of a KRB_AP_REQ definition, containing the Kerberos
protocol version number, the message type KRB_AP_REQ, an options field to indicate any options in use, and the ticket and authenticator themselves
Attributes
@!attribute authenticator
@return [Rex::Proto::Kerberos::Model::EncryptedData] This contains the authenticator, which includes the client's choice of a subkey
@!attribute msg_type
@return [Fixnum] The type of the protocol message
@!attribute options
@return [Fixnum] request options, affects processing
@!attribute pvno
@return [Fixnum] The protocol version number
@!attribute ticket
@return [Rex::Proto::Kerberos::Model::Ticket] The ticket authenticating the client to the server
Public Instance Methods
Rex::Proto::Kerberos::Model::ApReq
decoding isn't supported
@raise [NotImplementedError]
# File lib/rex/proto/kerberos/model/ap_req.rb, line 30 def decode(input) raise ::NotImplementedError, 'AP-REQ decoding not supported' end
Encodes the Rex::Proto::Kerberos::Model::ApReq
into an ASN.1 String
@return [String]
# File lib/rex/proto/kerberos/model/ap_req.rb, line 37 def encode elems = [] elems << OpenSSL::ASN1::ASN1Data.new([encode_pvno], 0, :CONTEXT_SPECIFIC) elems << OpenSSL::ASN1::ASN1Data.new([encode_msg_type], 1, :CONTEXT_SPECIFIC) elems << OpenSSL::ASN1::ASN1Data.new([encode_options], 2, :CONTEXT_SPECIFIC) elems << OpenSSL::ASN1::ASN1Data.new([encode_ticket], 3, :CONTEXT_SPECIFIC) elems << OpenSSL::ASN1::ASN1Data.new([encode_authenticator], 4, :CONTEXT_SPECIFIC) seq = OpenSSL::ASN1::Sequence.new(elems) seq_asn1 = OpenSSL::ASN1::ASN1Data.new([seq], AP_REQ, :APPLICATION) seq_asn1.to_der end
Private Instance Methods
Encodes the authenticator field
@return [String]
# File lib/rex/proto/kerberos/model/ap_req.rb, line 90 def encode_authenticator authenticator.encode end
Encodes the msg_type
field
@return [OpenSSL::ASN1::Integer]
# File lib/rex/proto/kerberos/model/ap_req.rb, line 66 def encode_msg_type bn = OpenSSL::BN.new(msg_type.to_s) int = OpenSSL::ASN1::Integer.new(bn) int end
Encodes the options field
@return [OpenSSL::ASN1::BitString]
# File lib/rex/proto/kerberos/model/ap_req.rb, line 76 def encode_options OpenSSL::ASN1::BitString.new([options].pack('N')) end
Encodes the pvno field
@return [OpenSSL::ASN1::Integer]
# File lib/rex/proto/kerberos/model/ap_req.rb, line 56 def encode_pvno bn = OpenSSL::BN.new(pvno.to_s) int = OpenSSL::ASN1::Integer.new(bn) int end
Encodes the ticket field
@return [String]
# File lib/rex/proto/kerberos/model/ap_req.rb, line 83 def encode_ticket ticket.encode end