Class: CertificateAuthority::Extensions::SubjectAlternativeName
- Inherits:
-
Object
- Object
- CertificateAuthority::Extensions::SubjectAlternativeName
- Includes:
- ExtensionAPI
- Defined in:
- lib/certificate_authority/extensions.rb
Overview
Specifies additional “names” for which this certificate is valid. Reference: Section 4.2.1.7 of RFC3280 tools.ietf.org/html/rfc3280#section-4.2.1.7
Constant Summary collapse
- OPENSSL_IDENTIFIER =
"subjectAltName"
Instance Attribute Summary collapse
-
#critical ⇒ Object
Returns the value of attribute critical.
-
#dns_names ⇒ Object
Returns the value of attribute dns_names.
-
#emails ⇒ Object
Returns the value of attribute emails.
-
#ips ⇒ Object
Returns the value of attribute ips.
-
#uris ⇒ Object
Returns the value of attribute uris.
Class Method Summary collapse
Instance Method Summary collapse
- #==(o) ⇒ Object
-
#initialize ⇒ SubjectAlternativeName
constructor
A new instance of SubjectAlternativeName.
- #openssl_identifier ⇒ Object
- #to_s ⇒ Object
Methods included from ExtensionAPI
Constructor Details
#initialize ⇒ SubjectAlternativeName
Returns a new instance of SubjectAlternativeName.
413 414 415 416 417 418 419 |
# File 'lib/certificate_authority/extensions.rb', line 413 def initialize @critical = false @uris = [] @dns_names = [] @ips = [] @emails = [] end |
Instance Attribute Details
#critical ⇒ Object
Returns the value of attribute critical.
410 411 412 |
# File 'lib/certificate_authority/extensions.rb', line 410 def critical @critical end |
#dns_names ⇒ Object
Returns the value of attribute dns_names.
411 412 413 |
# File 'lib/certificate_authority/extensions.rb', line 411 def dns_names @dns_names end |
#emails ⇒ Object
Returns the value of attribute emails.
411 412 413 |
# File 'lib/certificate_authority/extensions.rb', line 411 def emails @emails end |
#ips ⇒ Object
Returns the value of attribute ips.
411 412 413 |
# File 'lib/certificate_authority/extensions.rb', line 411 def ips @ips end |
#uris ⇒ Object
Returns the value of attribute uris.
411 412 413 |
# File 'lib/certificate_authority/extensions.rb', line 411 def uris @uris end |
Class Method Details
.parse(value, critical) ⇒ Object
458 459 460 461 462 463 464 465 466 467 468 469 470 |
# File 'lib/certificate_authority/extensions.rb', line 458 def self.parse(value, critical) obj = self.new return obj if value.nil? obj.critical = critical value.split(/,\s*/).each do |v| c = v.split(':', 2) obj.uris << c.last if c.first == "URI" obj.dns_names << c.last if c.first == "DNS" obj.ips << c.last if c.first == "IP" obj.emails << c.last if c.first == "EMAIL" end obj end |
Instance Method Details
#==(o) ⇒ Object
454 455 456 |
# File 'lib/certificate_authority/extensions.rb', line 454 def ==(o) o.class == self.class && o.state == state end |
#openssl_identifier ⇒ Object
421 422 423 |
# File 'lib/certificate_authority/extensions.rb', line 421 def openssl_identifier OPENSSL_IDENTIFIER end |
#to_s ⇒ Object
445 446 447 448 449 450 451 452 |
# File 'lib/certificate_authority/extensions.rb', line 445 def to_s res = [] res += @uris.map {|u| "URI:#{u}" } res += @dns_names.map {|d| "DNS:#{d}" } res += @ips.map {|i| "IP:#{i}" } res += @emails.map {|i| "email:#{i}" } res.join(',') end |