<div dir="ltr">Hi Viktor,<div><br></div><div>Thanks a lot for your detailed response and the suggestion. I am going to implement it and let you know. </div><div>I really appreciate your quick feedback on my request. </div><div>Thank you and best regards</div><div>Olivier</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 19, 2022 at 5:49 PM Viktor Dukhovni <<a href="mailto:openssl-users@dukhovni.org">openssl-users@dukhovni.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Wed, Jan 19, 2022 at 05:21:27PM +0100, Olivier Germain via openssl-users wrote:<br>
<br>
> We have a requirement to implement the  Distinguished Name in the response<br>
> received by the client. Hopefully I am ok.<br>
<br>
More accurately, you're being asked to send a suitable non-empty list of<br>
"Distinguished Names" in server "certificate request" extensions, when<br>
soliciting client certificates.  This can be necessary to, e.g., solicit<br>
client certificates from Java applications, which select the certificate<br>
to use based on the names suggested by the server.<br>
<br>
> How can I set in my SSL code the value for the distinguished Name?<br>
<br>
Something along the lines of the below, which extracts the subject<br>
DNs from a PEM file with trusted issuer (root CA) certificates:<br>
<br>
    if (CAfile) {<br>
        STACK_OF(X509_NAME) *calist = SSL_load_client_CA_file(CAfile);<br>
<br>
        if (calist != NULL)<br>
            SSL_CTX_set_client_CA_list(ctx, calist);<br>
    }<br>
<br>
The operator of the server should be able to configure a file of trusted<br>
client cert issuers separately from the default list of trusted issuers.<br>
This would ideally hold just one or a few CAs actually used to issue<br>
client certificates trusted by the server in question.<br>
<br>
Note the documented ownership transfer:<br>
<br>
   SSL_CTX_set_client_CA_list() sets the list of CAs sent to the client<br>
   when requesting a client certificate for ctx. Ownership of list is<br>
   transferred to ctx and it should not be freed by the caller.<br>
<br>
There are other ways to construct a stack of CA X.509 names, but loading<br>
them from a PEM file of CA certs is typically the simplest option.<br>
<br>
-- <br>
    Viktor.<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr">Olivier GERMAIN<div>TIBCO Support</div><div><br></div><div><span style="color:rgb(0,0,0);font-size:12.8px">TIBCO software</span></div><div><span style="color:rgb(0,0,0);font-size:12.8px">18, rue du 4 Septembre</span><br style="color:rgb(0,0,0);font-size:12.8px"><span style="color:rgb(0,0,0);font-size:12.8px">75002 Paris, France</span><br></div><div><span style="color:rgb(0,0,0);font-size:12.8px">Mobile : +33 6 45 30 23 31</span></div></div></div></div></div>