Class: Rex::Proto::Kerberos::CredentialCache::Principal

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

Overview

This class provides a representation of a Principal stored in the Kerberos Credential Cache.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Element

attr_accessor, attributes, #attributes, #initialize

Constructor Details

This class inherits a constructor from Rex::Proto::Kerberos::CredentialCache::Element

Instance Attribute Details

#componentsArray<String>

Returns:

  • (Array<String>)

17
18
19
# File 'lib/rex/proto/kerberos/credential_cache/principal.rb', line 17

def components
  @components
end

#name_typeInteger

Returns:

  • (Integer)

11
12
13
# File 'lib/rex/proto/kerberos/credential_cache/principal.rb', line 11

def name_type
  @name_type
end

#realmString

Returns:

  • (String)

14
15
16
# File 'lib/rex/proto/kerberos/credential_cache/principal.rb', line 14

def realm
  @realm
end

Instance Method Details

#encodeString

Encodes the Rex::Proto::Kerberos::CredentialCache::Principal into an String

Returns:

  • (String)

    encoded principal


22
23
24
25
26
27
28
29
30
# File 'lib/rex/proto/kerberos/credential_cache/principal.rb', line 22

def encode
  encoded = ''
  encoded << encode_name_type
  encoded << [components.length].pack('N')
  encoded << encode_realm
  encoded << encode_components

  encoded
end