Class: Rex::Proto::Kerberos::Model::TransitedEncoding

Inherits:
Element
  • Object
show all
Defined in:
lib/rex/proto/kerberos/model/transited_encoding.rb

Overview

This class provides a representation of a Kerberos ticket that helps a client authenticate to a service.

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

Instance Method Summary collapse

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

#contentsString

Returns [1] OCTET STRING.

Returns:

  • (String)
    1

    OCTET STRING



11
12
13
# File 'lib/rex/proto/kerberos/model/transited_encoding.rb', line 11

def contents
  @contents
end

#tr_typeInteger

Returns [0] Int32 – must be registered –.

Returns:

  • (Integer)
    0

    Int32 -- must be registered --



9
10
11
# File 'lib/rex/proto/kerberos/model/transited_encoding.rb', line 9

def tr_type
  @tr_type
end

Instance Method Details

#decode(input) ⇒ self

Decodes the Rex::Proto::Kerberos::Model::TransitedEncoding from an input

Parameters:

  • input (String, OpenSSL::ASN1::ASN1Data)

    the input to decode from

Returns:

  • (self)

    if decoding succeeds

Raises:



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/rex/proto/kerberos/model/transited_encoding.rb', line 19

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 TransitedEncoding, invalid input'
  end

  self
end

#encodeString

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

Returns:

  • (String)


35
36
37
# File 'lib/rex/proto/kerberos/model/transited_encoding.rb', line 35

def encode
  to_asn1.to_der
end

#to_asn1OpenSSL::ASN1::ASN1Data

Encodes a Rex::Proto::Kerberos::Model::TransitedEncoding into ASN.1

Returns:

  • (OpenSSL::ASN1::ASN1Data)

    The TransitedEncoding ASN1Data



42
43
44
45
46
47
48
# File 'lib/rex/proto/kerberos/model/transited_encoding.rb', line 42

def to_asn1
  elems = []
  elems << OpenSSL::ASN1::ASN1Data.new([encode_tr_type], 0, :CONTEXT_SPECIFIC)
  elems << OpenSSL::ASN1::ASN1Data.new([encode_contents], 1, :CONTEXT_SPECIFIC)

  OpenSSL::ASN1::Sequence.new(elems)
end