Class: OpenSSL::X509::Name

Inherits:
Object
  • Object
show all
Includes:
Marshal
Defined in:
lib/openssl/x509.rb

Defined Under Namespace

Modules: RFC2253DN

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Marshal

#_dump, included

Class Method Details

.parse_openssl(str, template = OBJECT_TYPE_TEMPLATE) ⇒ Object Also known as: parse



287
288
289
290
291
292
293
294
295
296
# File 'lib/openssl/x509.rb', line 287

def parse_openssl(str, template=OBJECT_TYPE_TEMPLATE)
  if str.start_with?("/")
    # /A=B/C=D format
    ary = str[1..-1].split("/").map { |i| i.split("=", 2) }
  else
    # Comma-separated
    ary = str.split(",").map { |i| i.strip.split("=", 2) }
  end
  self.new(ary, template)
end

.parse_rfc2253(str, template = OBJECT_TYPE_TEMPLATE) ⇒ Object



282
283
284
285
# File 'lib/openssl/x509.rb', line 282

def parse_rfc2253(str, template=OBJECT_TYPE_TEMPLATE)
  ary = OpenSSL::X509::Name::RFC2253DN.scan(str)
  self.new(ary, template)
end

Instance Method Details

#pretty_print(q) ⇒ Object



301
302
303
304
305
306
# File 'lib/openssl/x509.rb', line 301

def pretty_print(q)
  q.object_group(self) {
    q.text ' '
    q.text to_s(OpenSSL::X509::Name::RFC2253)
  }
end