Class: Rex::Proto::Kerberos::Model::KrbCredInfo

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

Overview

This class provides a representation of a KrbCredInfo object

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

#auth_timeTime

Returns the time of initial authentication for the named principal.

Returns:

  • (Time)

    the time of initial authentication for the named principal



24
25
26
# File 'lib/rex/proto/kerberos/model/krb_cred_info.rb', line 24

def auth_time
  @auth_time
end

#caddrRex::Proto::Kerberos::Model::HostAddress

Returns These are the addresses from which the ticket can be used.

Returns:



45
46
47
# File 'lib/rex/proto/kerberos/model/krb_cred_info.rb', line 45

def caddr
  @caddr
end

#end_timeTime

not be honored (its expiration time)

Returns:

  • (Time)

    This field contains the time after which the ticket will



31
32
33
# File 'lib/rex/proto/kerberos/model/krb_cred_info.rb', line 31

def end_time
  @end_time
end

#flagsRex::Proto::Kerberos::Model::KdcOptionFlags

requested when the ticket was issued

Returns:



21
22
23
# File 'lib/rex/proto/kerberos/model/krb_cred_info.rb', line 21

def flags
  @flags
end

#keyRex::Proto::Kerberos::Model::EncryptionKey

Returns The session key associated with a corresponding ticket in the enclosing KrbCred object.

Returns:



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

def key
  @key
end

#pnameRex::Proto::Kerberos::Model::PrincipalName

Returns The name of the principal identity.

Returns:



17
18
19
# File 'lib/rex/proto/kerberos/model/krb_cred_info.rb', line 17

def pname
  @pname
end

#prealmString

Returns The realm for the principal identity.

Returns:

  • (String)

    The realm for the principal identity



14
15
16
# File 'lib/rex/proto/kerberos/model/krb_cred_info.rb', line 14

def prealm
  @prealm
end

#renew_tillTime

RENEWABLE flag set in the flags field. It indicates the maximum endtime that may be included in a renewal

Returns:

  • (Time)

    This field is only present in tickets that have the



36
37
38
# File 'lib/rex/proto/kerberos/model/krb_cred_info.rb', line 36

def renew_till
  @renew_till
end

#snameRex::Proto::Kerberos::Model::PrincipalName

Returns The name part of the server's identity.

Returns:



42
43
44
# File 'lib/rex/proto/kerberos/model/krb_cred_info.rb', line 42

def sname
  @sname
end

#srealmString

Returns The realm part of the server's principal identifier.

Returns:

  • (String)

    The realm part of the server's principal identifier



39
40
41
# File 'lib/rex/proto/kerberos/model/krb_cred_info.rb', line 39

def srealm
  @srealm
end

#start_timeTime

Returns Specifies the time after which the ticket is valid.

Returns:

  • (Time)

    Specifies the time after which the ticket is valid



27
28
29
# File 'lib/rex/proto/kerberos/model/krb_cred_info.rb', line 27

def start_time
  @start_time
end

Instance Method Details

#==(other) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/rex/proto/kerberos/model/krb_cred_info.rb', line 47

def ==(other)
  key == other.key &&
    prealm == other.prealm &&
    pname == other.pname &&
    flags == other.flags &&
    auth_time == other.auth_time &&
    start_time == other.start_time &&
    end_time == other.end_time &&
    renew_till == other.renew_till &&
    srealm == other.srealm &&
    sname == other.sname &&
    caddr == other.caddr
end

#decode(input) ⇒ self

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

Parameters:

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

    the input to decode from

Returns:

  • (self)

    if decoding succeeds

Raises:



66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/rex/proto/kerberos/model/krb_cred_info.rb', line 66

def decode(input)
  case input
  when String
    decode_string(input)
  when OpenSSL::ASN1::Sequence
    decode_asn1(input)
  else
    raise ::Rex::Proto::Kerberos::Model::Error::KerberosDecodingError, 'Failed to decode KrbCredInfo, invalid input'
  end

  self
end

#encodeObject



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/rex/proto/kerberos/model/krb_cred_info.rb', line 79

def encode
  elems = []
  elems << OpenSSL::ASN1::ASN1Data.new([encode_key], 0, :CONTEXT_SPECIFIC)
  elems << OpenSSL::ASN1::ASN1Data.new([encode_prealm], 1, :CONTEXT_SPECIFIC) if prealm
  elems << OpenSSL::ASN1::ASN1Data.new([encode_pname], 2, :CONTEXT_SPECIFIC) if pname
  elems << OpenSSL::ASN1::ASN1Data.new([encode_flags], 3, :CONTEXT_SPECIFIC) if flags
  elems << OpenSSL::ASN1::ASN1Data.new([encode_auth_time], 4, :CONTEXT_SPECIFIC) if auth_time
  elems << OpenSSL::ASN1::ASN1Data.new([encode_start_time], 5, :CONTEXT_SPECIFIC) if start_time
  elems << OpenSSL::ASN1::ASN1Data.new([encode_end_time], 6, :CONTEXT_SPECIFIC) if end_time
  elems << OpenSSL::ASN1::ASN1Data.new([encode_renew_till], 7, :CONTEXT_SPECIFIC) if renew_till
  elems << OpenSSL::ASN1::ASN1Data.new([encode_srealm], 8, :CONTEXT_SPECIFIC) if srealm
  elems << OpenSSL::ASN1::ASN1Data.new([encode_sname], 9, :CONTEXT_SPECIFIC) if sname
  elems << OpenSSL::ASN1::ASN1Data.new([encode_caddr], 10, :CONTEXT_SPECIFIC) if caddr
  seq = OpenSSL::ASN1::Sequence.new(elems)
  seq.to_der
end