<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi All,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">"PEM_write_DHparams" is deprecated in openssl3.0. <br></div><div class="gmail_default" style="font-size:small">I am trying to replace "PEM_write_DHparams" with the OSSL api. But  getting below compilation error while assigning the dh.</div><div class="gmail_default" style="font-size:small">Could you please provide an example to use "OSSL_ENCODER_CTX_new_for_pkey" in the correct way and also please provide your inputs on the below error.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">FYI, I have included the openssl/evp.h and openssl/dh.h header files.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><i><b><font color="#990000">error: dereferencing pointer to incomplete type<br>       dh = pkey->pkey.dh;<br>                ^</font></b></i><br></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">PEM_write_DHparams code is replaced with OSSL_ENCODER_CTX_new_for_pkey.<br></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><i> EVP_PKEY *pkey = NULL;<br> OSSL_ENCODER_CTX *ectx = NULL;<br></i></div><div class="gmail_default" style="font-size:small"><i> ectx = OSSL_ENCODER_CTX_new_for_pkey(pkey,<br>                                         OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS,<br>                                         "PEM",<br>                                         NULL, NULL);<br><br>    if (NULL != ectx)<br>    {<br>      if (!OSSL_ENCODER_to_fp(ectx, fp))<br>      {<br>        OSSL_ENCODER_CTX_free(ectx);<br>        EVP_PKEY_free(dhkey);<br>        fclose(fp);<br>        return ;<br>      }<br>      dh = pkey->pkey.dh;<br>    }</i><br></div><div class="gmail_default" style="font-size:small"><br></div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr">Thanks & Regards,<br></div><div dir="ltr"><div>Samiya khanum</div></div></div></div></div></div></div>

<br>
<span style="background-color:rgb(255,255,255)"><font size="2">This electronic communication and the information and any files transmitted with it, or attached to it, are confidential and are intended solely for the use of the individual or entity to whom it is addressed and may contain information that is confidential, legally privileged, protected by privacy laws, or otherwise restricted from disclosure to anyone else. If you are not the intended recipient or the person responsible for delivering the e-mail to the intended recipient, you are hereby notified that any use, copying, distributing, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited. If you received this e-mail in error, please return the e-mail to the sender, delete it from your computer, and destroy any printed copy of it.</font></span>