Class: KRB5::Entry
Instance Attribute Summary collapse
-
#bytes ⇒ Sting?
Place to store byte array for #to_bytes.
-
#enctype ⇒ Object
Returns the value of attribute enctype.
-
#key ⇒ Object
Returns the value of attribute key.
- #keytab ⇒ KRB5::Keytab
-
#kvno32 ⇒ Object
Returns the value of attribute kvno32.
-
#kvno8 ⇒ Object
Returns the value of attribute kvno8.
-
#principal ⇒ Object
Returns the value of attribute principal.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(keytab) ⇒ Entry
constructor
A new instance of Entry.
-
#kvno ⇒ Integer
The 32-bit key version overrides the 8-bit key version.
-
#to_bytes ⇒ Object
entry ::= principal timestamp (32 bits) key version (8 bits) enctype (16 bits) key length (16 bits) key contents key version (32 bits) [in release 1.14 and later].
Methods included from Mixin::Packer
#pack_bytes, #pack_int16, #pack_int32, #pack_int8
Constructor Details
#initialize(keytab) ⇒ Entry
Returns a new instance of Entry.
21 22 23 |
# File 'lib/krb5/entry.rb', line 21 def initialize(keytab) @keytab = keytab end |
Instance Attribute Details
#bytes ⇒ Sting?
Place to store byte array for #to_bytes
19 20 21 |
# File 'lib/krb5/entry.rb', line 19 def bytes @bytes end |
#enctype ⇒ Object
Returns the value of attribute enctype.
13 14 15 |
# File 'lib/krb5/entry.rb', line 13 def enctype @enctype end |
#key ⇒ Object
Returns the value of attribute key.
14 15 16 |
# File 'lib/krb5/entry.rb', line 14 def key @key end |
#kvno32 ⇒ Object
Returns the value of attribute kvno32.
15 16 17 |
# File 'lib/krb5/entry.rb', line 15 def kvno32 @kvno32 end |
#kvno8 ⇒ Object
Returns the value of attribute kvno8.
12 13 14 |
# File 'lib/krb5/entry.rb', line 12 def kvno8 @kvno8 end |
#principal ⇒ Object
Returns the value of attribute principal.
10 11 12 |
# File 'lib/krb5/entry.rb', line 10 def principal @principal end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
11 12 13 |
# File 'lib/krb5/entry.rb', line 11 def @timestamp end |
Instance Method Details
#==(other) ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/krb5/entry.rb', line 51 def ==(other) %i[principal timestamp kvno8 enctype key kvno32].each do |state| return false unless other.send(state) == self.send(state) end true end |
#kvno ⇒ Integer
The 32-bit key version overrides the 8-bit key version.
27 28 29 |
# File 'lib/krb5/entry.rb', line 27 def kvno kvno32 ? kvno32 : kvno8 end |
#to_bytes ⇒ Object
entry ::=
principal
timestamp (32 bits)
key version (8 bits)
enctype (16 bits)
key length (16 bits)
key contents
key version (32 bits) [in release 1.14 and later]
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/krb5/entry.rb', line 39 def to_bytes pack_bytes(principal.to_bytes) pack_int32(.strftime('%s').to_i) pack_int8(kvno8) pack_int16(enctype) pack_int16(key.length) pack_bytes(key) pack_int32(kvno32) if kvno32 @bytes.join end |