Class: PacketGen::Plugin::GSSAPI

Inherits:
RASN1::Model
  • Object
show all
Includes:
Types::Fieldable
Defined in:
lib/packetgen/plugin/gssapi.rb

Overview

GSS API, from RFC 4178

GSSAPI ::= CHOICE {
   init        InitialContextToken,
   token_resp  NegTokenResp
}

InitialContextToken ::= [APPLICATION 0] IMPLICIT SEQUENCE {
   oid         OBJECT IDENTIFIER,
   token_init  NegTokenInit
}

NegTokenInit ::= [0] EXPLICIT SEQUENCE {
   mechTypes       [0] MechTypeList,
   reqFlags        [1] BIT STRING    OPTIONAL, -- No more used
   mechToken       [2] OCTET STRING  OPTIONAL,
   mechListMIC     [3] OCTET STRING  OPTIONAL,
}

NegTokenResp ::= [1] EXPLICIT SEQUENCE {
   negState       [0] ENUMERATED {
     accept-completed    (0),
     accept-incomplete   (1),
     reject              (2),
     request-mic         (3)
   }                                 OPTIONAL,
   supportedMech   [1] MechType      OPTIONAL,
   responseToken   [2] OCTET STRING  OPTIONAL,
   mechListMIC     [3] OCTET STRING  OPTIONAL,
}

Examples:

initial context

gssapi.chosen   #=> 0
# Access to oid of initial context
gssapi[:oid]        #=> RASN1::Types::ObjectId
gssapi[:oid].value  #=> "1.3.6.1.5.5.2"
# Access to token_init
gssapi[:token_init]                #=> PacketGen::Plugin::GSSAPI::NegTokenInit
gssapi[:token_init][:mech_types]   #=> RASN1::Types::SequenceOf
# Get mech_types as an array of OID strings
gssapi[:token_init][:mech_types].value.map(&:value)
# Get mech_token value
gssapi[:token_init][:mech_token].value

response token

gssapi.chosen   #=> 1
gssapi[:token_resp][:negstate]             #=> RASN1::Types::Enumerated
gssapi[:token_resp][:negstate].value       #=> String
gssapi[:token_resp][:supported_mech]       #=> RASN1::Types::ObjectId
gssapi[:token_resp][:supported_mech].value #=> String
gssapi[:token_resp][:response]             #=> RASN1::Types::OctetString

Author:

  • Sylvain Daubert

Defined Under Namespace

Classes: NegTokenInit, NegTokenInitEnvelop, NegTokenResp

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ GSSAPI

Returns a new instance of GSSAPI.

Parameters:

  • args (Hash) (defaults to: {})

Options Hash (args):

  • :token (Symbol)

    :init or :response to force selection of token CHOICE.



112
113
114
115
116
# File 'lib/packetgen/plugin/gssapi.rb', line 112

def initialize(args={})
  token = args.delete(:token)
  super
  self[:gssapi].chosen = token == :init ? 0 : 1
end

Instance Method Details

#read(str) ⇒ self

Populate Object from str

Parameters:

  • str (String)

Returns:

  • (self)


121
122
123
124
125
126
# File 'lib/packetgen/plugin/gssapi.rb', line 121

def read(str)
  return self if str.nil?

  parse!(str, ber: true)
  self
end

#to_humanObject



128
129
130
# File 'lib/packetgen/plugin/gssapi.rb', line 128

def to_human
  inspect
end