class Rex::Proto::Kerberos::Model::Checksum
This class provides a representation of a Kerberos
Checksum
definition.
Attributes
checksum[RW]
@!attribute checksum
@return [String] The checksum itself
type[RW]
@!attribute type
@return [Fixnum] The algorithm used to generate the checksum
Public Instance Methods
decode(input)
click to toggle source
Rex::Proto::Kerberos::Model::Checksum
decoding isn't supported
@raise [NotImplementedError]
# File lib/rex/proto/kerberos/model/checksum.rb, line 19 def decode(input) raise ::NotImplementedError, 'Checksum decoding not supported' end
encode()
click to toggle source
Encodes a Rex::Proto::Kerberos::Model::Checksum
into an ASN.1 String
@return [String]
# File lib/rex/proto/kerberos/model/checksum.rb, line 26 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
Private Instance Methods
encode_checksum()
click to toggle source
Encodes the checksum field
@return [OpenSSL::ASN1::OctetString]
# File lib/rex/proto/kerberos/model/checksum.rb, line 51 def encode_checksum OpenSSL::ASN1::OctetString.new(checksum) end
encode_type()
click to toggle source
Encodes the type field
@return [OpenSSL::ASN1::Integer]
# File lib/rex/proto/kerberos/model/checksum.rb, line 41 def encode_type bn = OpenSSL::BN.new(type.to_s) int = OpenSSL::ASN1::Integer.new(bn) int end