class Rex::Proto::Kerberos::CredentialCache::Cache

This class provides a representation of a Kerberos Credential Cache.

Attributes

credentials[RW]

@!attribute credentials

@return [Array<Rex::Proto::Kerberos::CredentialCache::Credential>] The primary principal credentials
headers[RW]

@!attribute headers

@return [Array<String>] The header tags
primary_principal[RW]

@!attribute primary_principal

@return [Rex::Proto::Kerberos::CredentialCache::Principal] The principal cache's owner
version[RW]

@!attribute version

@return [Fixnum] The file format version

Public Instance Methods

encode() click to toggle source

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

@return [String] encoded cache

# File lib/rex/proto/kerberos/credential_cache/cache.rb, line 25
def encode
  encoded = ''
  encoded << encode_version
  encoded << encode_headers
  encoded << encode_primary_principal
  encoded << encode_credentials
end

Private Instance Methods

encode_credentials() click to toggle source

Encodes the credentials field

@return [String]

# File lib/rex/proto/kerberos/credential_cache/cache.rb, line 69
def encode_credentials
  encoded = ''
  credentials.each do |cred|
    encoded << cred.encode
  end
  encoded
end
encode_headers() click to toggle source

Encodes the headers field

@return [String]

# File lib/rex/proto/kerberos/credential_cache/cache.rb, line 45
def encode_headers
  headers_encoded = ''
  headers_encoded << [headers.length].pack('n')
  headers.each do |h|
    headers_encoded << h
  end

  encoded = ''
  encoded << [headers_encoded.length].pack('n')
  encoded << headers_encoded

  encoded
end
encode_primary_principal() click to toggle source

Encodes the primary_principal field

@return [String]

# File lib/rex/proto/kerberos/credential_cache/cache.rb, line 62
def encode_primary_principal
  primary_principal.encode
end
encode_version() click to toggle source

Encodes the version field

@return [String]

# File lib/rex/proto/kerberos/credential_cache/cache.rb, line 38
def encode_version
  [version].pack('n')
end