Class: Rex::Proto::Kerberos::Model::TransitedEncoding
- Defined in:
- lib/rex/proto/kerberos/model/transited_encoding.rb
Overview
This class provides a representation of a Kerberos ticket that helps a client authenticate to a service.
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
-
#contents ⇒ String
- 1
-
OCTET STRING.
-
#tr_type ⇒ Integer
- 0
-
Int32 – must be registered –.
Instance Method Summary collapse
-
#decode(input) ⇒ self
Decodes the Rex::Proto::Kerberos::Model::TransitedEncoding from an input.
-
#encode ⇒ String
Encodes a Rex::Proto::Kerberos::Model::TransitedEncoding into an ASN.1 String.
-
#to_asn1 ⇒ OpenSSL::ASN1::ASN1Data
Encodes a Rex::Proto::Kerberos::Model::TransitedEncoding 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
#contents ⇒ String
Returns [1] OCTET STRING.
11 12 13 |
# File 'lib/rex/proto/kerberos/model/transited_encoding.rb', line 11 def contents @contents end |
#tr_type ⇒ Integer
Returns [0] Int32 – must be registered –.
9 10 11 |
# File 'lib/rex/proto/kerberos/model/transited_encoding.rb', line 9 def tr_type @tr_type end |
Instance Method Details
#decode(input) ⇒ self
Decodes the Rex::Proto::Kerberos::Model::TransitedEncoding from an input
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/rex/proto/kerberos/model/transited_encoding.rb', line 19 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 TransitedEncoding, invalid input' end self end |
#encode ⇒ String
Encodes a Rex::Proto::Kerberos::Model::TransitedEncoding into an ASN.1 String
35 36 37 |
# File 'lib/rex/proto/kerberos/model/transited_encoding.rb', line 35 def encode to_asn1.to_der end |
#to_asn1 ⇒ OpenSSL::ASN1::ASN1Data
Encodes a Rex::Proto::Kerberos::Model::TransitedEncoding into ASN.1
42 43 44 45 46 47 48 |
# File 'lib/rex/proto/kerberos/model/transited_encoding.rb', line 42 def to_asn1 elems = [] elems << OpenSSL::ASN1::ASN1Data.new([encode_tr_type], 0, :CONTEXT_SPECIFIC) elems << OpenSSL::ASN1::ASN1Data.new([encode_contents], 1, :CONTEXT_SPECIFIC) OpenSSL::ASN1::Sequence.new(elems) end |