Class: Rex::Proto::Kerberos::Model::PreAuthPacOptions
- Defined in:
- lib/rex/proto/kerberos/model/pre_auth_pac_options.rb
Overview
This class is a representation of a PA-PAC-OPTIONS, which specifies explicitly requested options in the PAC as defined in learn.microsoft.com/fr-fr/openspecs/windows_protocols/ms-kile/99721a01-c859-48d1-8310-ec1bab9b2838 and learn.microsoft.com/en-us/openspecs/windows_protocols/ms-sfu/aeecfd82-a5e4-474c-92ab-8df9022cf955
Constant Summary
Constants included from Rex::Proto::Kerberos::Model
AP_REP, AP_REQ, AS_REP, AS_REQ, AUTHENTICATOR, ENC_AP_REP_PART, ENC_KRB_CRED_PART, KRB_CRED, KRB_ERROR, TGS_REP, TGS_REQ, TICKET, VERSION
Instance Attribute Summary collapse
-
#flags ⇒ Integer
The PA-PAC-OPTIONS flags.
Instance Method Summary collapse
-
#decode(input) ⇒ self
Decodes the Rex::Proto::Kerberos::Model::PreAuthPacOptions from an input.
-
#decode_asn1(input) ⇒ Object
Decodes a Rex::Proto::Kerberos::Model::PreAuthPacOptions from an OpenSSL::ASN1::Sequence.
-
#decode_flags(input) ⇒ Integer
Decodes the flags field.
-
#decode_string(input) ⇒ Object
Decodes a Rex::Proto::Kerberos::Model::PreAuthPacOptions from an String.
-
#encode ⇒ String
Encodes the Rex::Proto::Kerberos::Model::PreAuthPacOptions into an ASN.1 String.
-
#encode_flags ⇒ OpenSSL::ASN1::BitString
Encodes the flags.
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
#flags ⇒ Integer
Returns The PA-PAC-OPTIONS flags.
14 15 16 |
# File 'lib/rex/proto/kerberos/model/pre_auth_pac_options.rb', line 14 def flags @flags end |
Instance Method Details
#decode(input) ⇒ self
Decodes the Rex::Proto::Kerberos::Model::PreAuthPacOptions from an input
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rex/proto/kerberos/model/pre_auth_pac_options.rb', line 21 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 PreAuthPacOptions, invalid input' end self end |
#decode_asn1(input) ⇒ Object
Decodes a Rex::Proto::Kerberos::Model::PreAuthPacOptions from an OpenSSL::ASN1::Sequence
70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/rex/proto/kerberos/model/pre_auth_pac_options.rb', line 70 def decode_asn1(input) seq_values = input.value seq_values.each do |val| case val.tag when 0 self. = decode_flags(val) else raise ::Rex::Proto::Kerberos::Model::Error::KerberosDecodingError, 'Failed to decode PreAuthPacOptions SEQUENCE' end end end |
#decode_flags(input) ⇒ Integer
Decodes the flags field
87 88 89 |
# File 'lib/rex/proto/kerberos/model/pre_auth_pac_options.rb', line 87 def decode_flags(input) input.value[0].value.unpack('N')[0] end |
#decode_string(input) ⇒ Object
Decodes a Rex::Proto::Kerberos::Model::PreAuthPacOptions from an String
57 58 59 60 61 62 63 |
# File 'lib/rex/proto/kerberos/model/pre_auth_pac_options.rb', line 57 def decode_string(input) asn1 = OpenSSL::ASN1.decode(input) decode_asn1(asn1) rescue OpenSSL::ASN1::ASN1Error raise Rex::Proto::Kerberos::Model::Error::KerberosDecodingError end |
#encode ⇒ String
Encodes the Rex::Proto::Kerberos::Model::PreAuthPacOptions into an ASN.1 String
37 38 39 40 41 42 43 44 |
# File 'lib/rex/proto/kerberos/model/pre_auth_pac_options.rb', line 37 def encode elems = [] elems << OpenSSL::ASN1::ASN1Data.new([encode_flags], 0, :CONTEXT_SPECIFIC) seq = OpenSSL::ASN1::Sequence.new(elems) seq.to_der end |
#encode_flags ⇒ OpenSSL::ASN1::BitString
Encodes the flags
49 50 51 |
# File 'lib/rex/proto/kerberos/model/pre_auth_pac_options.rb', line 49 def encode_flags OpenSSL::ASN1::BitString.new([flags.to_i].pack('N')) end |