Class: Ronin::DB::CertOrganization
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Ronin::DB::CertOrganization
- Includes:
- Model
- Defined in:
- lib/ronin/db/cert_organization.rb
Overview
Base class for CertIssuer and CertSubject.
Direct Known Subclasses
Constant Summary collapse
- X509_ATTRIBUTES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Mapping of X509 names to Symbols.
{ 'CN' => :common_name, 'emailAddress' => :email_address, 'O' => :organization, 'OU' => :organizational_unit, 'L' => :locality, 'ST' => :state, 'C' => :country }
Instance Attribute Summary collapse
-
#country ⇒ String
The two letter country code (
C
). -
#created_at ⇒ Time
When the organization was first created.
-
#id ⇒ Integer
The primary key of the certificate organization.
-
#locality ⇒ String?
The locality (
L
).. -
#organization ⇒ String
The organization name (
O
). -
#organizational_unit ⇒ String?
The organizational unit (
OU
). -
#state ⇒ String?
The state (
ST
).
Class Method Summary collapse
-
.parse(name) ⇒ Hash{Symbol => String}
private
Parses an X509 Name into attributes.
Methods included from Model
Instance Attribute Details
#country ⇒ String
The two letter country code (C
).
71 |
# File 'lib/ronin/db/cert_organization.rb', line 71 attribute :country, :string |
#created_at ⇒ Time
When the organization was first created.
79 |
# File 'lib/ronin/db/cert_organization.rb', line 79 attribute :created_at, :datetime |
#id ⇒ Integer
The primary key of the certificate organization.
40 |
# File 'lib/ronin/db/cert_organization.rb', line 40 attribute :id, :integer |
#locality ⇒ String?
The locality (L
)..
59 |
# File 'lib/ronin/db/cert_organization.rb', line 59 attribute :locality, :string |
#organization ⇒ String
The organization name (O
).
46 |
# File 'lib/ronin/db/cert_organization.rb', line 46 attribute :organization, :string |
#organizational_unit ⇒ String?
The organizational unit (OU
).
53 |
# File 'lib/ronin/db/cert_organization.rb', line 53 attribute :organizational_unit, :string |
#state ⇒ String?
The state (ST
).
65 |
# File 'lib/ronin/db/cert_organization.rb', line 65 attribute :state, :string |
Class Method Details
.parse(name) ⇒ Hash{Symbol => String}
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Parses an X509 Name into attributes.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/ronin/db/cert_organization.rb', line 105 def self.parse(name) x509_name = case name when OpenSSL::X509::Name then name when String OpenSSL::X509::Name.parse(name) else raise(ArgumentError,"value must be either an OpenSSL::X509::Name or a String: #{name.inspect}") end attributes = {} x509_name.to_a.each do |(oid,value,type)| if (key = X509_ATTRIBUTES[oid]) attributes[key] = value.force_encoding(Encoding::UTF_8) end end return attributes end |