<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=windows-1252">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 18/06/2016 18:02, Marc Heuse wrote:<br>
    </div>
    <blockquote class=" cite"
      id="mid_e8f0acb9_3918_9ab6_030d_9719a64818e8_mh_sec_de"
      cite="mid:e8f0acb9-3918-9ab6-030d-9719a64818e8@mh-sec.de"
      type="cite">
      <pre wrap="">Hi,

I have a problem with porting OpenSSL code from 1.0 to 1.1.
Please do not complain that it does not look like it make sense what
this code does here - complain to Microsoft who implements certs with
RDP non-standard ...

The goal of the following code is to change the ASN.1 value of the
signature algorithm in a certificate.

  // OpenSSL 1.0 code, well, really written already when 0.9 was there

  nid = OBJ_obj2nid(cert->cert_info->key->algor->algorithm);
  if ((nid == NID_md5WithRSAEncryption) || (nid ==
NID_shaWithRSAEncryption)) {
    ASN1_OBJECT_free(cert->cert_info->key->algor->algorithm);
    cert->cert_info->key->algor->algorithm = OBJ_nid2obj(NID_rsaEncryption);
  }


  // OpenSSL 1.1 code

  nid = X509_get_signature_nid(cert);
  if ((nid == NID_md5WithRSAEncryption) || (nid ==
NID_shaWithRSAEncryption)) {
    ... how to set the algorithm in the cert to NID_rsaEncryption in
OpenSSL v1.1.x?


Any help how to implement this with the new 1.1 functions is highly
appreciated :)

</pre>
    </blockquote>
    <tt>Strangely, when I look at certificates generated by the "openssl
      ca" <br>
      utility, they already say "Public Key Algorithm: rsaEncryption", <br>
      where did you get certificates that specified
      "md5WithRSAEncryption" <br>
      or "shaWithRsaEncryption" as the subject public key algorithm?</tt><tt><br>
    </tt><br>
    <pre class="moz-signature" cols="72">Enjoy

Jakob
-- 
Jakob Bohm, CIO, Partner, WiseMo A/S.  <a class="moz-txt-link-freetext" href="https://www.wisemo.com">https://www.wisemo.com</a>
Transformervej 29, 2860 Søborg, Denmark.  Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded </pre>
  </body>
</html>