Class: Rex::Proto::Kerberos::Model::Element
- Inherits:
-
Object
- Object
- Rex::Proto::Kerberos::Model::Element
- Includes:
- Crypto, Rex::Proto::Kerberos::Model
- Defined in:
- lib/rex/proto/kerberos/model/element.rb
Overview
This class provides a representation of a principal, an asset (e.g., a workstation user or a network server) on a network.
Direct Known Subclasses
ApRep, ApReq, Authenticator, AuthorizationData, Checksum, EncApRepPart, EncKdcResponse, EncKrbCredPart, EncryptedData, EncryptionKey, HostAddress, KdcRequest, KdcRequestBody, KdcResponse, KrbCred, KrbCredInfo, KrbError, LastRequest, PreAuthDataEntry, PreAuthEncTimeStamp, PreAuthEtypeInfo2, PreAuthEtypeInfo2Entry, PreAuthForUser, PreAuthPacOptions, PreAuthPacRequest, PreAuthPwSalt, PrincipalName, Ticket, TicketEncPart, TransitedEncoding
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
Class Method Summary collapse
- .attr_accessor(*vars) ⇒ Object
-
.attributes ⇒ Array
Retrieves the element class fields.
- .decode(input) ⇒ Object
Instance Method Summary collapse
-
#attributes ⇒ Array
Retrieves the element instance fields.
-
#decode(input) ⇒ Object
Decodes the Rex::Proto::Kerberos::Model::Element from the input.
-
#encode ⇒ Object
Encodes the Rex::Proto::Kerberos::Model::Element into an ASN.1 String.
-
#initialize(options = {}) ⇒ Element
constructor
A new instance of Element.
Constructor Details
#initialize(options = {}) ⇒ Element
Returns a new instance of Element.
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/rex/proto/kerberos/model/element.rb', line 32 def initialize( = {}) raise ArgumentError, "Invalid options, expected hash, got #{.class}" unless .is_a?(Hash) self.class.attributes.each do |attr| if .has_key?(attr) m = (attr.to_s + '=').to_sym self.send(m, [attr]) end end end |
Class Method Details
.attr_accessor(*vars) ⇒ Object
14 15 16 17 18 |
# File 'lib/rex/proto/kerberos/model/element.rb', line 14 def self.attr_accessor(*vars) @attributes ||= [] @attributes.concat vars super(*vars) end |
.attributes ⇒ Array
Retrieves the element class fields
23 24 25 |
# File 'lib/rex/proto/kerberos/model/element.rb', line 23 def self.attributes @attributes end |
.decode(input) ⇒ Object
27 28 29 30 |
# File 'lib/rex/proto/kerberos/model/element.rb', line 27 def self.decode(input) elem = self.new elem.decode(input) end |
Instance Method Details
#attributes ⇒ Array
Retrieves the element instance fields
46 47 48 |
# File 'lib/rex/proto/kerberos/model/element.rb', line 46 def attributes self.class.attributes end |
#decode(input) ⇒ Object
Decodes the Rex::Proto::Kerberos::Model::Element from the input. This method has been designed to be overridden by subclasses.
54 55 56 |
# File 'lib/rex/proto/kerberos/model/element.rb', line 54 def decode(input) raise ::NoMethodError, 'Method designed to be overridden' end |
#encode ⇒ Object
Encodes the Rex::Proto::Kerberos::Model::Element into an ASN.1 String. This method has been designed to be overridden by subclasses.
62 63 64 |
# File 'lib/rex/proto/kerberos/model/element.rb', line 62 def encode raise ::NoMethodError, 'Method designed to be overridden' end |