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;
^
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;
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;
}
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.
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature