Re: What does EVP_PKEY_CTX_set_signature_md do?
"'Tomas Mraz' via openssl-users" <[email protected]> Thu, 11 Jun 2026 08:32:20 +0200
| Newsgroups | gmane.comp.encryption.openssl.user |
|---|---|
| Message-ID | <0f405a1d4df8e478908a497cc2cc4cdc17d7f356.camel@openssl.foundation> |
Hi Stef, It really depends on an algorithm. In particular the RSA PKCS#1v1.5 signatures encode the hash algorithm in the signature itself so the signing operation needs to know the hash algorithm for proper operation. Regards, Tomas Mraz, CTO, OpenSSL Foundation On Wed, 2026-06-10 at 12:23 -0700, Stef Bon wrote: > Hi, >=20 > I'm working on software to sign a message. Now Ive read the example: >=20 > https://docs.openssl.org/3.4/man3/EVP_PKEY_sign/#rsa-with-pkcs1-padding-f= or-sha256 >=20 > 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: >=20 > "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" >=20 > 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? >=20 > Stef Bon > --=20 > 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-4d= e6-4d70-8d8b-0f97512c61c8n%40openssl.org > . --=20 Tom=C3=A1=C5=A1 Mr=C3=A1z, Chief Technology Officer, OpenSSL Foundation We need your support! Help us protect digital privacy=E2=80=A6 everywhere. https://openssl.foundation/donate/ways-to-give --=20 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 e= mail to openssl-users+unsubscribe-MCmKBN63+Bmbup2nOX2J7Q@public.gmane.org To view this discussion visit https://groups.google.com/a/openssl.org/d/msg= id/openssl-users/0f405a1d4df8e478908a497cc2cc4cdc17d7f356.camel%40openssl.f= oundation.