Module: X509Helper

Defined in:
app/helpers/x509_helper.rb

Instance Method Summary collapse

Instance Method Details

#x509_subject(subject, search_keys) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/helpers/x509_helper.rb', line 6

def x509_subject(subject, search_keys)
  subjects = {}

  Net::LDAP::DN.new(subject).each_pair do |key, value|
    if key.upcase.start_with?(*search_keys.map(&:upcase))
      subjects[key.upcase] = value
    end
  end

  subjects
rescue StandardError
  {}
end