class SSLyze::X509::Name

Wrapper object for [OpenSSL::X509::Name].

[1]: www.rubydoc.info/stdlib/openssl/OpenSSL/X509/Name

@since 1.0.0

Attributes

entries[R]

The parsed entries of the name.

@return [Array<(String, String, Integer)>]

name[R]

Public Class Methods

new(name) click to toggle source

@param [OpenSSL::X509::Name] name

The OpenSSL X509 name object.
# File lib/sslyze/x509/name.rb, line 29
def initialize(name)
  @name    = name
  @entries = name.to_a
end

Public Instance Methods

[](key) click to toggle source

Finds the entry with the matcing OID (Object IDentifier).

@param [String] key

@return [String, nil]

# File lib/sslyze/x509/name.rb, line 61
def [](key)
  each do |oid,value,type|
    return value if oid == key
  end

  return nil
end
c()
Alias for: country_name
cmp(other) click to toggle source

@see www.rubydoc.info/stdlib/openssl/OpenSSL/X509/Name#cmp-instance_method

# File lib/sslyze/x509/name.rb, line 156
def cmp(other)
  @name.cmp(other.name)
end
cn()
Alias for: common_name
common_name() click to toggle source

The Common Name (`CN`) entry.

@return [Domain]

# File lib/sslyze/x509/name.rb, line 86
def common_name
  @common_name ||= Domain.new(self['CN'])
end
Also aliased as: cn
country()
Alias for: country_name
country_name() click to toggle source

The Country (`C`) entry.

@return [String]

# File lib/sslyze/x509/name.rb, line 74
def country_name
  @country_name ||= self['C']
end
Also aliased as: country, c
dc()
Alias for: domain_component
domain_component() click to toggle source

The Domain Component (`DC`) entry.

@return [String, nil]

# File lib/sslyze/x509/name.rb, line 97
def domain_component
  @domain_component ||= self['DC']
end
Also aliased as: dc
each() { |oid, value, type| ... } click to toggle source

Enumerates over the entries.

@yield [oid, value, type]

@yieldparam [String] oid

The Object IDentifier.

@yieldparam [String] value

The entry's value.

@yieldparam [Integer] type

The entry type.
# File lib/sslyze/x509/name.rb, line 48
def each(&block)
  @entries.each do |(oid,value,type)|
    yield oid, value, type
  end
end
eql?(other) click to toggle source

@see www.rubydoc.info/stdlib/openssl/OpenSSL/X509/Name#eql%3F-instance_method

# File lib/sslyze/x509/name.rb, line 163
def eql?(other)
  @name.eql?(other.name)
end
l()
Alias for: location_name
location()
Alias for: location_name
location_name() click to toggle source

The Location (`L`) entry.

@return [String, nil]

# File lib/sslyze/x509/name.rb, line 146
def location_name
  @location ||= self['L']
end
Also aliased as: location, l
o()
Alias for: organization_name
organization()
Alias for: organization_name
organization_name() click to toggle source

The Organization Name (`O`) entry.

@return [String]

# File lib/sslyze/x509/name.rb, line 108
def organization_name
  @organization_name ||= self['O']
end
Also aliased as: organization, o
organizational_unit()
organizational_unit_name() click to toggle source

The Organization Unit Name (`OU`) entry.

@return [String]

# File lib/sslyze/x509/name.rb, line 120
def organizational_unit_name
  @organizational_unit_name ||= self['OU']
end
Also aliased as: organizational_unit, ou
ou()
province()
Alias for: province_name
province_name()
Also aliased as: province
Alias for: state_name
st()
Alias for: state_name
state()
Alias for: state_name
state_name() click to toggle source

The State/Province Name (`ST`) entry.

@return [String, nil]

# File lib/sslyze/x509/name.rb, line 132
def state_name
  @state_name ||= self['ST']
end
Also aliased as: state, province_name, st
to_a() click to toggle source

@see www.rubydoc.info/stdlib/openssl/OpenSSL/X509/Name#to_a-instance_method

# File lib/sslyze/x509/name.rb, line 170
def to_a
  @name.to_a
end
to_der() click to toggle source

@see www.rubydoc.info/stdlib/openssl/OpenSSL/X509/Name#to_der-instance_method

# File lib/sslyze/x509/name.rb, line 177
def to_der
  @name.to_der
end
to_s(*args) click to toggle source

@see www.rubydoc.info/stdlib/openssl/OpenSSL/X509/Name#to_s-instance_method

# File lib/sslyze/x509/name.rb, line 184
def to_s(*args)
  @name.to_s(*args)
end