Class: Rex::Proto::Kerberos::Model::HostAddress
- Defined in:
- lib/rex/proto/kerberos/model/host_address.rb
Overview
This class provides a representation for Kerberos pre authenticated data
https://datatracker.ietf.org/doc/html/rfc4120#section-5.2.5
HostAddress ::= SEQUENCE {
addr-type [0] Int32,
address [1] OCTET STRING
}
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
-
#address ⇒ String
The address value.
-
#type ⇒ Rex::Proto::Kerberos::Model::AddressType, Integer
The address addr-type.
Instance Method Summary collapse
-
#decode(input) ⇒ self
Decodes a Rex::Proto::Kerberos::Model::HostAddress.
-
#encode ⇒ String
Encodes a Rex::Proto::Kerberos::Model::HostAddress into an ASN.1 String.
-
#to_asn1 ⇒ OpenSSL::ASN1::ASN1Data
Encodes a Rex::Proto::Kerberos::Model::HostAddress into ASN.1.
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
#address ⇒ String
Returns The address value.
16 17 18 |
# File 'lib/rex/proto/kerberos/model/host_address.rb', line 16 def address @address end |
#type ⇒ Rex::Proto::Kerberos::Model::AddressType, Integer
Returns The address addr-type.
13 14 15 |
# File 'lib/rex/proto/kerberos/model/host_address.rb', line 13 def type @type end |
Instance Method Details
#decode(input) ⇒ self
Decodes a Rex::Proto::Kerberos::Model::HostAddress
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rex/proto/kerberos/model/host_address.rb', line 23 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 HostAddress, invalid input' end self end |
#encode ⇒ String
Encodes a Rex::Proto::Kerberos::Model::HostAddress into an ASN.1 String
39 40 41 |
# File 'lib/rex/proto/kerberos/model/host_address.rb', line 39 def encode to_asn1.to_der end |
#to_asn1 ⇒ OpenSSL::ASN1::ASN1Data
Encodes a Rex::Proto::Kerberos::Model::HostAddress into ASN.1
46 47 48 49 50 51 52 |
# File 'lib/rex/proto/kerberos/model/host_address.rb', line 46 def to_asn1 type_asn1 = OpenSSL::ASN1::ASN1Data.new([encode_type], 0, :CONTEXT_SPECIFIC) address_asn1 = OpenSSL::ASN1::ASN1Data.new([encode_address], 1, :CONTEXT_SPECIFIC) seq = OpenSSL::ASN1::Sequence.new([type_asn1, address_asn1]) seq end |