Skip to content

End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

class method

OpenSSL::X509::Name.parse

parse(str, template=OBJECT_TYPE_TEMPLATE)

Alias of .parse_openssl

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_openssl .new .parse_rfc2253 also in 4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0