File tree Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -291,7 +291,14 @@ x509name_print(VALUE self, unsigned long iflag)
291291 * * OpenSSL::X509::Name::MULTILINE
292292 *
293293 * If _format_ is omitted, the largely broken and traditional OpenSSL format
294- * is used.
294+ * (<tt>X509_NAME_oneline()</tt> format) is chosen.
295+ *
296+ * <b>Use of this method is discouraged.</b> None of the formats other than
297+ * OpenSSL::X509::Name::RFC2253 is standardized and may show an inconsistent
298+ * behavior through \OpenSSL versions.
299+ *
300+ * It is recommended to use #to_utf8 instead, which is equivalent to calling
301+ * <tt>name.to_s(OpenSSL::X509::Name::RFC2253).force_encoding("UTF-8")</tt>.
295302 */
296303static VALUE
297304ossl_x509name_to_s (int argc , VALUE * argv , VALUE self )
@@ -498,7 +505,7 @@ ossl_x509name_to_der(VALUE self)
498505 * You can create a Name by parsing a distinguished name String or by
499506 * supplying the distinguished name as an Array.
500507 *
501- * name = OpenSSL::X509::Name.parse '/CN=nobody/ DC=example'
508+ * name = OpenSSL::X509::Name.parse_rfc2253 ' DC=example,CN=nobody '
502509 *
503510 * name = OpenSSL::X509::Name.new [['CN', 'nobody'], ['DC', 'example']]
504511 */
Original file line number Diff line number Diff line change @@ -279,11 +279,29 @@ def scan(dn)
279279 end
280280
281281 class << self
282+ # Parses the UTF-8 string representation of a distinguished name,
283+ # according to RFC 2253.
284+ #
285+ # See also #to_utf8 for the opposite operation.
282286 def parse_rfc2253 ( str , template = OBJECT_TYPE_TEMPLATE )
283287 ary = OpenSSL ::X509 ::Name ::RFC2253DN . scan ( str )
284288 self . new ( ary , template )
285289 end
286290
291+ # Parses the string representation of a distinguished name. Two
292+ # different forms are supported:
293+ #
294+ # - \OpenSSL format (<tt>X509_NAME_oneline()</tt>) used by
295+ # <tt>#to_s</tt>. For example: <tt>/DC=com/DC=example/CN=nobody</tt>
296+ # - \OpenSSL format (<tt>X509_NAME_print()</tt>)
297+ # used by <tt>#to_s(OpenSSL::X509::Name::COMPAT)</tt>. For example:
298+ # <tt>DC=com, DC=example, CN=nobody</tt>
299+ #
300+ # Neither of them is standardized and has quirks and inconsistencies
301+ # in handling of escaped characters or multi-valued RDNs.
302+ #
303+ # Use of this method is discouraged in new applications. See
304+ # Name.parse_rfc2253 and #to_utf8 for the alternative.
287305 def parse_openssl ( str , template = OBJECT_TYPE_TEMPLATE )
288306 if str . start_with? ( "/" )
289307 # /A=B/C=D format
You can’t perform that action at this time.
0 commit comments