小编use*_*783的帖子

Microsoft Crypto API禁用RSAES-OAEP密钥传输算法

我正在使用CryptEncryptMessage生成PKCS#7包络消息.我szOID_NIST_AES256_CBC用作加密算法.

生成的消息似乎是有效的,但是RSAES-OAEP密钥传输算法在野外具有有限的支持(Thunderbird,OpenSSL SMIME模块和许多其他人不支持它).

我希望CAPI能够恢复到旧版RSAencryption的密钥传输.

有没有可能的方法,如果有一种方法而不是使用我可以恢复到低级消息传递功能,CryptEncryptMessage但即使使用低级函数我也找不到办法.

码:

CRYPT_ENCRYPT_MESSAGE_PARA EncryptMessageParams;
EncryptMessageParams.cbSize = sizeof(CMSG_ENVELOPED_ENCODE_INFO);

EncryptMessageParams.dwMsgEncodingType = PKCS_7_ASN_ENCODING;

EncryptMessageParams.ContentEncryptionAlgorithm.pszObjId = szOID_NIST_AES256_CBC;
EncryptMessageParams.ContentEncryptionAlgorithm.Parameters.cbData = 0;
EncryptMessageParams.ContentEncryptionAlgorithm.Parameters.pbData = 0;

EncryptMessageParams.hCryptProv = NULL;
EncryptMessageParams.pvEncryptionAuxInfo = NULL;
EncryptMessageParams.dwFlags = 0;
EncryptMessageParams.dwInnerContentType = 0;

BYTE pbEncryptedBlob[640000];
DWORD pcbEncryptedBlob = 640000;

BOOL retval =  CryptEncryptMessage(&EncryptMessageParams, cRecipientCert, pRecipCertContextArray, pbMsgText, dwMsgTextSize, pbEncryptedBlob, &pcbEncryptedBlob);
Run Code Online (Sandbox Code Playgroud)

c windows encryption cryptography mscapi

70
推荐指数
1
解决办法
2142
查看次数

标签 统计

c ×1

cryptography ×1

encryption ×1

mscapi ×1

windows ×1