OSSL api example to write DH params

Samiya Khanum samiya.khanum at broadcom.com
Fri Oct 28 12:45:06 UTC 2022


Hi All,

"PEM_write_DHparams" is deprecated in openssl3.0.
I am trying to replace "PEM_write_DHparams" with the OSSL api. But  getting
below compilation error while assigning the dh.
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.

FYI, I have included the openssl/evp.h and openssl/dh.h header files.



*error: dereferencing pointer to incomplete type       dh = pkey->pkey.dh;
              ^*

PEM_write_DHparams code is replaced with OSSL_ENCODER_CTX_new_for_pkey.



* EVP_PKEY *pkey = NULL; OSSL_ENCODER_CTX *ectx = NULL;*















* ectx = OSSL_ENCODER_CTX_new_for_pkey(pkey,
         OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS,
             "PEM",                                         NULL, NULL);
if (NULL != ectx)    {      if (!OSSL_ENCODER_to_fp(ectx, fp))      {
  OSSL_ENCODER_CTX_free(ectx);        EVP_PKEY_free(dhkey);
fclose(fp);        return ;      }      dh = pkey->pkey.dh;    }*

Thanks & Regards,
Samiya khanum

-- 
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mta.openssl.org/pipermail/openssl-users/attachments/20221028/b6d24350/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4212 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://mta.openssl.org/pipermail/openssl-users/attachments/20221028/b6d24350/attachment.p7s>


More information about the openssl-users mailing list