Skip to content

Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →

class method

OpenSSL::X509::Name.parse_openssl

parse_openssl(str, template=OBJECT_TYPE_TEMPLATE)

Parses the string representation of a distinguished name. Two different forms are supported:

  • OpenSSL format (X509_NAME_oneline()) used by to_s. For example: /DC=com/DC=example/CN=nobody

  • OpenSSL format (X509_NAME_print()) used by #to_s(OpenSSL::X509::Name::COMPAT). For example: DC=com, DC=example, CN=nobody

Neither of them is standardized and has quirks and inconsistencies in handling of escaped characters or multi-valued RDNs.

Use of this method is discouraged in new applications. See Name.parse_rfc2253 and to_utf8 for the alternative.

See also .parse .parse_rfc2253 .new #<=> also in 4.1 · 4.0 · 3.4 · 3.2 · 3.1 · 3.0