<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Yeah, agreed, although I'd like the parser to work with the output of "openssl x509 ... -subject", i.e. RFC-4514 format, which is "CN=name, O=Acme Corporation, C=US" ... etc.<div class=""><br class=""></div><div class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jul 23, 2021, at 12:57 AM, David von Oheimb <<a href="mailto:dev@ddvo.net" class="">dev@ddvo.net</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">
  
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" class="">
  
  <div class=""><p class="">What I use is<br class="">
    </p><p class="">        X509_NAME *nname = parse_name(string, MBSTRING_ASC, 1,
      desc);<br class="">
    </p><p class="">which is not an official API function but defined in
      apps/lib/apps.c:<br class="">
      <br class="">
      /*<br class="">
       * name is expected to be in the format
      /type0=value0/type1=value1/type2=...<br class="">
       * where + can be used instead of / to form multi-valued RDNs if
      canmulti<br class="">
       * and characters may be escaped by \<br class="">
       */<br class="">
      X509_NAME *parse_name(const char *cp, int chtype, int canmulti,
      const char *desc)</p><p class="">Would be good to have such a function as part of the X.509 API.<br class="">
    </p><p class="">    David<br class="">
    </p>
    <div class="moz-cite-prefix">On 23.07.21 07:49, Viktor Dukhovni
      wrote:<br class="">
    </div>
    <blockquote type="cite" cite="mid:2D71ED82-D22D-406A-8A64-5C52DC5CB0F9@dukhovni.org" class="">
      <blockquote type="cite" class="">
        <pre class="moz-quote-pre" wrap="">On 22 Jul 2021, at 9:29 pm, Philip Prindeville <a class="moz-txt-link-rfc2396E" href="mailto:philipp_subx@redfish-solutions.com"><philipp_subx@redfish-solutions.com></a> wrote:

I'm wondering what the function is that takes a string and returns X509_NAME with the attribute/value pairs of the parsed DN.
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">There is no such function in general, since the are many potential
string forms of X.509 names, not all of which are unambiguously
machine readable.

There are various functions for augmenting a partially built name
with an attribute-value pair, but the parsing of a string a list
of such attribute-value pairs is up to you. :-(

</pre>
    </blockquote>
  </div>

</div></blockquote></div><br class=""></div></body></html>