class Rex::Proto::Kerberos::Model::PreAuthPacRequest

This class is a representation of a KERB-PA-PAC-REQUEST, pre authenticated data to explicitly request to include or exclude a PAC in the ticket.

Attributes

value[RW]

@!attribute value

@return [Boolean]

Public Instance Methods

decode(input) click to toggle source

Decodes a Rex::Proto::Kerberos::Model::PreAuthPacRequest

@param input [String, OpenSSL::ASN1::Sequence] the input to decode from @return [self] if decoding succeeds @raise [RuntimeError] if decoding doesn't succeed

# File lib/rex/proto/kerberos/model/pre_auth_pac_request.rb, line 19
def decode(input)
  case input
  when String
    decode_string(input)
  when OpenSSL::ASN1::Sequence
    decode_asn1(input)
  else
    raise ::RuntimeError, 'Failed to decode PreAuthPacRequest, invalid input'
  end

  self
end
encode() click to toggle source

Encodes a Rex::Proto::Kerberos::Model::PreAuthPacRequest into an ASN.1 String

@return [String]

# File lib/rex/proto/kerberos/model/pre_auth_pac_request.rb, line 36
def encode
  value_asn1 = OpenSSL::ASN1::ASN1Data.new([encode_value], 0, :CONTEXT_SPECIFIC)
  seq = OpenSSL::ASN1::Sequence.new([value_asn1])

  seq.to_der
end

Private Instance Methods

decode_asn1(input) click to toggle source

Decodes a Rex::Proto::Kerberos::Model::PreAuthPacRequest from an OpenSSL::ASN1::Sequence

@param input [OpenSSL::ASN1::Sequence] the input to decode from

# File lib/rex/proto/kerberos/model/pre_auth_pac_request.rb, line 65
def decode_asn1(input)
  self.value = decode_asn1_value(input.value[0])
end
decode_asn1_value(input) click to toggle source

Decodes the value from an OpenSSL::ASN1::ASN1Data

@param input [OpenSSL::ASN1::ASN1Data] the input to decode from @return [Boolean]

# File lib/rex/proto/kerberos/model/pre_auth_pac_request.rb, line 73
def decode_asn1_value(input)
  input.value[0].value
end
decode_string(input) click to toggle source

Decodes a Rex::Proto::Kerberos::Model::PreAuthPacRequest

@param input [String] the input to decode from

# File lib/rex/proto/kerberos/model/pre_auth_pac_request.rb, line 55
def decode_string(input)
  asn1 = OpenSSL::ASN1.decode(input)

  decode_asn1(asn1)
end
encode_value() click to toggle source

Encodes value attribute

@return [OpenSSL::ASN1::Boolean]

# File lib/rex/proto/kerberos/model/pre_auth_pac_request.rb, line 48
def encode_value
  OpenSSL::ASN1::Boolean.new(value)
end