Class: Rex::Proto::Kerberos::Model::Checksum
- Defined in:
- lib/rex/proto/kerberos/model/checksum.rb
Overview
This class provides a representation of a Kerberos Checksum 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
-
#checksum ⇒ String
The checksum itself.
-
#type ⇒ Integer
The algorithm used to generate the checksum.
Instance Method Summary collapse
-
#decode(input) ⇒ self
Decodes the Rex::Proto::Kerberos::Model::Checksum from an input.
-
#encode ⇒ String
Encodes a Rex::Proto::Kerberos::Model::Checksum 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
#checksum ⇒ String
Returns The checksum itself.
15 16 17 |
# File 'lib/rex/proto/kerberos/model/checksum.rb', line 15 def checksum @checksum end |
#type ⇒ Integer
Returns The algorithm used to generate the checksum.
12 13 14 |
# File 'lib/rex/proto/kerberos/model/checksum.rb', line 12 def type @type end |
Instance Method Details
#decode(input) ⇒ self
Decodes the Rex::Proto::Kerberos::Model::Checksum from an input
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rex/proto/kerberos/model/checksum.rb', line 22 def decode(input) case input when String decode_string(input) when OpenSSL::ASN1::ASN1Data decode_asn1(input) else raise ::Rex::Proto::Kerberos::Model::Error::KerberosDecodingError, 'Failed to decode Checksum, invalid input' end self end |
#encode ⇒ String
Encodes a Rex::Proto::Kerberos::Model::Checksum into an ASN.1 String
38 39 40 41 42 43 44 45 46 |
# File 'lib/rex/proto/kerberos/model/checksum.rb', line 38 def encode elems = [] elems << OpenSSL::ASN1::ASN1Data.new([encode_type], 0, :CONTEXT_SPECIFIC) elems << OpenSSL::ASN1::ASN1Data.new([encode_checksum], 1, :CONTEXT_SPECIFIC) seq = OpenSSL::ASN1::Sequence.new(elems) seq.to_der end |