Object
A handy ruby wrapper around OpenSSL’s Name object. This was created to make it really easy to extract information out of the certificate.
Initializes the Name object with the underlying OpenSSL Name object. You generally do not need to use this. Rather use the Certificates subject or issuer methods.
# File lib/ezsig.rb, line 385 def initialize(name) @name=name @attributes={} name.to_s.split(/\//).each do |field| key, val = field.split(/=/,2) if key @attributes[key.to_sym]=val end end end
Lookup fields in the certificate.
# File lib/ezsig.rb, line 463 def [](attr_key) @attributes[attr_key.to_sym] end
The common name. For SSL this means the domain name. For personal certificates it is the name.
# File lib/ezsig.rb, line 454 def common_name self[:CN] end
The 2 letter country code of the name
# File lib/ezsig.rb, line 412 def country self[:C] end
Returns the email if present in the name
# File lib/ezsig.rb, line 406 def email self[:emailAddress] end
The locality
# File lib/ezsig.rb, line 428 def locality self[:L] end
# File lib/ezsig.rb, line 467 def method_missing(method) self[method] end
The Organization
# File lib/ezsig.rb, line 445 def organization self[:O] end
The Organizational Unit
# File lib/ezsig.rb, line 436 def organizational_unit self[:OU] end
Generated with the Darkfish Rdoc Generator 2.