Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Is the output of CryptSignMessageWithKey always the same for the same input and environment (certificate)?

34 views
Skip to first unread message

imj...@gmail.com

unread,
Jul 17, 2012, 7:23:21 AM7/17/12
to
Hi,

Does the output of CryptSignMessageWithKey is always the same for the same input?

What I want to know is if the certificate is the same in two machines the output will always:
- be the same for the same input;
- it is not influenced by time (the output is the same today, tomorrow, in a year, ...).

The code I use can be found below:

CRYPT_KEY_SIGN_MESSAGE_PARA signParams;
signParams.cbSize = sizeof(CRYPT_KEY_SIGN_MESSAGE_PARA);
signParams.dwMsgAndCertEncodingType = PKCS_7_ASN_ENCODING;
signParams.hCryptProv = static_cast<HCRYPTPROV>(security_context->GetCryptProvOrNCryptKey());
signParams.dwKeySpec = security_context->GetKeySpec();
signParams.HashAlgorithm.pszObjId = szOID_RSA_MD5;
signParams.HashAlgorithm.Parameters.pbData = nullptr;
signParams.HashAlgorithm.Parameters.cbData = 0;
signParams.pvHashAuxInfo = nullptr;
signParams.PubKeyAlgorithm.pszObjId = szOID_RSA_RSA;
signParams.PubKeyAlgorithm.Parameters.pbData = nullptr;
signParams.PubKeyAlgorithm.Parameters.cbData = 0;

// first there is a call to CryptSignMessageWithKey to get the size of signed data

// then buffer pbSignedData is allocated with necessary size

if (!CryptSignMessageWithKey(
&signParams,
pbData,
cbData,
pbSignedData,
&cbSignedData))

Varun Tewari

unread,
Apr 24, 2014, 3:14:34 PM4/24/14
to
Yes, If data to be signed is same, cert used to sign is same, then irrespective where u sign, signature will be same!
Hope this helps
0 new messages