What does EVP_PKEY_CTX_set_signature_md do?

Stef Bon <[email protected]> Wed, 10 Jun 2026 12:23:45 -0700 (PDT)
Newsgroups gmane.comp.encryption.openssl.user
Message-ID <[email protected]>
------=_Part_194880_1094574063.1781119425949
Content-Type: multipart/alternative; 
	boundary="----=_Part_194881_1476204242.1781119425949"

------=_Part_194881_1476204242.1781119425949
Content-Type: text/plain; charset="UTF-8"

Hi,

I'm working on software to sign a message. Now Ive read the example:

https://docs.openssl.org/3.4/man3/EVP_PKEY_sign/#rsa-with-pkcs1-padding-for-sha256

but what does EVP_PKEY_CTX_set_signature_md do? The sign function 
EVP_PKEY_sign does not use the md used for creating the hash, which is the 
input of this function. In the same page is written:

"Similarly, an RSA implementation usually expects additional details to be 
set, like the message digest algorithm that the input is supposed to be 
digested with, as well as the padding mode"

Why is that? The sign function accepts the input data as is, and by what 
digest it is created does not matter to the signing right?

Stef Bon

-- 
You received this message because you are subscribed to the Google Groups "openssl-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openssl-users+unsubscribe-MCmKBN63+Bmbup2nOX2J7Q@public.gmane.org
To view this discussion visit https://groups.google.com/a/openssl.org/d/msgid/openssl-users/f0cc43a9-4de6-4d70-8d8b-0f97512c61c8n%40openssl.org.

------=_Part_194881_1476204242.1781119425949
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div>Hi,</div><div><br /></div><div>I'm working on software to sign a messa=
ge. Now Ive read the example:<br /></div><div><br /></div><div>https://docs=
.openssl.org/3.4/man3/EVP_PKEY_sign/#rsa-with-pkcs1-padding-for-sha256</div=
><div><br /></div><div>but what does=C2=A0EVP_PKEY_CTX_set_signature_md do?=
 The sign function EVP_PKEY_sign does not use the md used for creating the =
hash, which is the input of this function. In the same page is written:</di=
v><div><br /></div><div>"Similarly, an RSA implementation usually expects a=
dditional details to=20
be set, like the message digest algorithm that the input is supposed to=20
be digested with, as well as the padding mode"</div><div><br /></div><div>W=
hy is that? The sign function accepts the input data as is, and by what dig=
est it is created does not matter to the signing right?</div><div><br /></d=
iv><div>Stef Bon</div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;openssl-users&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:openssl-users+unsubscribe-MCmKBN63+BlAfugRpC6u6w@public.gmane.org">openssl-us=
[email protected]</a>.<br />
To view this discussion visit <a href=3D"https://groups.google.com/a/openss=
l.org/d/msgid/openssl-users/f0cc43a9-4de6-4d70-8d8b-0f97512c61c8n%40openssl=
.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.com/a/op=
enssl.org/d/msgid/openssl-users/f0cc43a9-4de6-4d70-8d8b-0f97512c61c8n%40ope=
nssl.org</a>.<br />

------=_Part_194881_1476204242.1781119425949--

------=_Part_194880_1094574063.1781119425949--