Class: Rex::Proto::Kerberos::Model::EncryptionKey
- Defined in:
- lib/rex/proto/kerberos/model/encryption_key.rb
Overview
This class provides a representation of a Kerberos EncryptionKey data definition
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
-
#key ⇒ Integer
The type of encryption key.
-
#type ⇒ Object
Returns the value of attribute type.
-
#value ⇒ String
The key itself.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#decode(input) ⇒ self
Decodes a Rex::Proto::Kerberos::Model::EncryptionKey.
-
#encode ⇒ String
Encodes a Rex::Proto::Kerberos::Model::EncryptionKey into an ASN.1 String.
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
#key ⇒ Integer
Returns The type of encryption key.
13 |
# File 'lib/rex/proto/kerberos/model/encryption_key.rb', line 13 attr_accessor :type |
#type ⇒ Object
Returns the value of attribute type.
13 14 15 |
# File 'lib/rex/proto/kerberos/model/encryption_key.rb', line 13 def type @type end |
#value ⇒ String
Returns the key itself.
16 17 18 |
# File 'lib/rex/proto/kerberos/model/encryption_key.rb', line 16 def value @value end |
Instance Method Details
#==(other) ⇒ Object
18 19 20 21 |
# File 'lib/rex/proto/kerberos/model/encryption_key.rb', line 18 def ==(other) type == other.type && value == other.value end |
#decode(input) ⇒ self
Decodes a Rex::Proto::Kerberos::Model::EncryptionKey
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/rex/proto/kerberos/model/encryption_key.rb', line 28 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 EncryptionKey, invalid input' end self end |
#encode ⇒ String
Encodes a Rex::Proto::Kerberos::Model::EncryptionKey into an ASN.1 String
45 46 47 48 49 50 51 52 |
# File 'lib/rex/proto/kerberos/model/encryption_key.rb', line 45 def encode elems = [] elems << OpenSSL::ASN1::ASN1Data.new([encode_type], 0, :CONTEXT_SPECIFIC) elems << OpenSSL::ASN1::ASN1Data.new([encode_value], 1, :CONTEXT_SPECIFIC) seq = OpenSSL::ASN1::Sequence.new(elems) seq.to_der end |