imj...@gmail.com
unread,Jul 17, 2012, 7:23:21 AM7/17/12You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
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))