Class: SSLyze::X509::Extensions::SubjectAltName
- Inherits:
-
SSLyze::X509::Extension
- Object
- SimpleDelegator
- SSLyze::X509::Extension
- SSLyze::X509::Extensions::SubjectAltName
- Includes:
- Enumerable
- Defined in:
- lib/sslyze/x509/extensions/subject_alt_name.rb
Overview
Represents the subjectAltName
X509v3 extension.
Constant Summary collapse
- TYPES =
Known subject name types.
{ 'DNS' => :dns, 'IP' => :ip, 'URI' => :uri, 'RID' => :rid, 'email' => :email, 'dirName' => :dir_name, 'otherName' => :other_name }
Instance Method Summary collapse
-
#dir_name ⇒ Array<String>
All
dirName:
alternative names within the extension's value. -
#dns ⇒ Array<String>
All
DNS:
alternative names within the extension's value. -
#each {|type, name| ... } ⇒ Enumerator
Enumerates over every alternative name within the extension's value.
-
#email ⇒ Array<String>
All
email:
alternative names within the extension's value. -
#ip ⇒ Array<IPAddr>
All
IP:
alternative names within the extension's value. -
#other_name ⇒ Array<String>
All
otherName:
alternative names within the extension's value. -
#rid ⇒ Array<String>
All
RID:
alternative names within the extension's value. -
#uri ⇒ Array<URI::Generic>
All
URI:
alternative names within the extension's value.
Instance Method Details
#dir_name ⇒ Array<String>
All dirName:
alternative names within the extension's value.
124 125 126 127 128 |
# File 'lib/sslyze/x509/extensions/subject_alt_name.rb', line 124 def dir_name @dir_name ||= select { |type,value| type == :dir_name }.map do |(type,value)| value end end |
#dns ⇒ Array<String>
All DNS:
alternative names within the extension's value.
69 70 71 72 73 |
# File 'lib/sslyze/x509/extensions/subject_alt_name.rb', line 69 def dns @dns ||= select { |type,value| type == :dns }.map do |(type,value)| value end end |
#each {|type, name| ... } ⇒ Enumerator
Enumerates over every alternative name within the extension's value.
50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/sslyze/x509/extensions/subject_alt_name.rb', line 50 def each return enum_for unless block_given? value.split(', ').each do |type_value| type, value = type_value.split(':',2) unless TYPES.has_key?(type) raise(NotImplementedError,"unsupported subjectAltName type: #{type}") end yield TYPES[type], value end end |
#email ⇒ Array<String>
All email:
alternative names within the extension's value.
102 103 104 105 106 |
# File 'lib/sslyze/x509/extensions/subject_alt_name.rb', line 102 def email @email ||= select { |type,value| type == :email }.map do |(type,value)| value end end |
#ip ⇒ Array<IPAddr>
All IP:
alternative names within the extension's value.
80 81 82 83 84 |
# File 'lib/sslyze/x509/extensions/subject_alt_name.rb', line 80 def ip @ip ||= select { |type,value| type == :ip }.map do |(type,value)| IPAddr.new(value) end end |
#other_name ⇒ Array<String>
All otherName:
alternative names within the extension's value.
135 136 137 138 139 |
# File 'lib/sslyze/x509/extensions/subject_alt_name.rb', line 135 def other_name @other_name ||= select { |type,value| type == :other_name }.map do |(type,value)| value end end |
#rid ⇒ Array<String>
All RID:
alternative names within the extension's value.
113 114 115 116 117 |
# File 'lib/sslyze/x509/extensions/subject_alt_name.rb', line 113 def rid @rid ||= select { |type,value| type == :rid }.map do |(type,value)| value end end |
#uri ⇒ Array<URI::Generic>
All URI:
alternative names within the extension's value.
91 92 93 94 95 |
# File 'lib/sslyze/x509/extensions/subject_alt_name.rb', line 91 def uri @uri ||= select { |type,value| type == :uri }.map do |(type,value)| URI.parse(value) end end |