Class: Rex::Proto::Kerberos::Model::PreAuthEncTimeStamp
- Defined in:
- lib/rex/proto/kerberos/model/pre_auth_enc_time_stamp.rb
Overview
This class is a representation of a PA-ENC-TIMESTAMP, an encrypted timestamp sent as pre authenticated data
Constant Summary
Constants included from Rex::Proto::Kerberos::Model
AP_REP, AP_REQ, AS_REP, AS_REQ, AUTHENTICATOR, ENC_KRB_CRED_PART, KRB_CRED, KRB_ERROR, TGS_REP, TGS_REQ, TICKET, VERSION
Instance Attribute Summary collapse
-
#pa_time_stamp ⇒ Time
Client’s time.
-
#pausec ⇒ Integer
Optional microseconds client’s time.
Instance Method Summary collapse
-
#decode(input) ⇒ self
Decodes a Rex::Proto::Kerberos::Model::PreAuthEncTimeStamp.
-
#encode ⇒ String
Encodes a Rex::Proto::Kerberos::Model::PreAuthEncTimeStamp into an ASN.1 String.
-
#encrypt(etype, key) ⇒ String
Encrypts the Rex::Proto::Kerberos::Model::PreAuthEncTimeStamp.
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
#pa_time_stamp ⇒ Time
Returns client’s time.
13 14 15 |
# File 'lib/rex/proto/kerberos/model/pre_auth_enc_time_stamp.rb', line 13 def pa_time_stamp @pa_time_stamp end |
#pausec ⇒ Integer
Returns optional microseconds client’s time.
16 17 18 |
# File 'lib/rex/proto/kerberos/model/pre_auth_enc_time_stamp.rb', line 16 def pausec @pausec end |
Instance Method Details
#decode(input) ⇒ self
Decodes a Rex::Proto::Kerberos::Model::PreAuthEncTimeStamp
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rex/proto/kerberos/model/pre_auth_enc_time_stamp.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 PreAuthEncTimeStamp, invalid input' end self end |
#encode ⇒ String
Encodes a Rex::Proto::Kerberos::Model::PreAuthEncTimeStamp into an ASN.1 String
40 41 42 43 44 45 46 |
# File 'lib/rex/proto/kerberos/model/pre_auth_enc_time_stamp.rb', line 40 def encode pa_time_stamp_asn1 = OpenSSL::ASN1::ASN1Data.new([encode_pa_time_stamp], 0, :CONTEXT_SPECIFIC) pausec_asn1 = OpenSSL::ASN1::ASN1Data.new([encode_pausec], 1, :CONTEXT_SPECIFIC) seq = OpenSSL::ASN1::Sequence.new([pa_time_stamp_asn1, pausec_asn1]) seq.to_der end |
#encrypt(etype, key) ⇒ String
Encrypts the Rex::Proto::Kerberos::Model::PreAuthEncTimeStamp
54 55 56 57 58 |
# File 'lib/rex/proto/kerberos/model/pre_auth_enc_time_stamp.rb', line 54 def encrypt(etype, key) data = self.encode encryptor = Rex::Proto::Kerberos::Crypto::Encryption::from_etype(etype) encryptor.encrypt(data, key, Rex::Proto::Kerberos::Crypto::KeyUsage::AS_REQ_PA_ENC_TIMESTAMP) end |