BOOL CRYPT_AsnEncodePKCSDigestedData(const CRYPT_DIGESTED_DATA *digestedData,
void *pvData, DWORD *pcbData);
+typedef struct _CRYPT_ENCRYPTED_CONTENT_INFO
+{
+ LPSTR contentType;
+ CRYPT_ALGORITHM_IDENTIFIER contentEncryptionAlgorithm;
+ CRYPT_DATA_BLOB encryptedContent;
+} CRYPT_ENCRYPTED_CONTENT_INFO;
+
+typedef struct _CRYPT_ENVELOPED_DATA
+{
+ DWORD version;
+ DWORD cRecipientInfo;
+ PCMSG_KEY_TRANS_RECIPIENT_INFO rgRecipientInfo;
+ CRYPT_ENCRYPTED_CONTENT_INFO encryptedContentInfo;
+} CRYPT_ENVELOPED_DATA;
+
+BOOL CRYPT_AsnEncodePKCSEnvelopedData(const CRYPT_ENVELOPED_DATA *envelopedData,
+ void *pvData, DWORD *pcbData);
+
typedef struct _CRYPT_SIGNED_INFO
{
DWORD version;
return ret;
}
+static BOOL WINAPI CRYPT_AsnEncodeRecipientInfo(DWORD dwCertEncodingType,
+ LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags,
+ PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
+{
+ const CMSG_KEY_TRANS_RECIPIENT_INFO *info = pvStructInfo;
+ struct AsnEncodeSequenceItem items[] = {
+ { &info->dwVersion, CRYPT_AsnEncodeInt, 0 },
+ { &info->RecipientId.u.IssuerSerialNumber,
+ CRYPT_AsnEncodeIssuerSerialNumber, 0 },
+ { &info->KeyEncryptionAlgorithm,
+ CRYPT_AsnEncodeAlgorithmIdWithNullParams, 0 },
+ { &info->EncryptedKey, CRYPT_AsnEncodeOctets, 0 },
+ };
+
+ return CRYPT_AsnEncodeSequence(dwCertEncodingType, items,
+ sizeof(items) / sizeof(items[0]), dwFlags, pEncodePara, pbEncoded,
+ pcbEncoded);
+}
+
+static BOOL WINAPI CRYPT_AsnEncodeEncryptedContentInfo(DWORD dwCertEncodingType,
+ LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags,
+ PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
+{
+ const CRYPT_ENCRYPTED_CONTENT_INFO *info = pvStructInfo;
+ struct AsnEncodeTagSwappedItem swapped = { ASN_CONTEXT | 0,
+ &info->encryptedContent, CRYPT_AsnEncodeOctets };
+ struct AsnEncodeSequenceItem items[] = {
+ { info->contentType, CRYPT_AsnEncodeOid, 0 },
+ { &info->contentEncryptionAlgorithm,
+ CRYPT_AsnEncodeAlgorithmIdWithNullParams, 0 },
+ { &swapped, CRYPT_AsnEncodeSwapTag, 0 },
+ };
+
+ return CRYPT_AsnEncodeSequence(dwCertEncodingType, items,
+ sizeof(items) / sizeof(items[0]), dwFlags, pEncodePara, pbEncoded,
+ pcbEncoded);
+}
+
+BOOL CRYPT_AsnEncodePKCSEnvelopedData(const CRYPT_ENVELOPED_DATA *envelopedData,
+ void *pvData, DWORD *pcbData)
+{
+ struct DERSetDescriptor recipientInfosSet = { envelopedData->cRecipientInfo,
+ envelopedData->rgRecipientInfo, sizeof(CMSG_KEY_TRANS_RECIPIENT_INFO), 0,
+ CRYPT_AsnEncodeRecipientInfo };
+ struct AsnEncodeSequenceItem items[] = {
+ { &envelopedData->version, CRYPT_AsnEncodeInt, 0 },
+ { &recipientInfosSet, CRYPT_DEREncodeItemsAsSet, 0 },
+ { &envelopedData->encryptedContentInfo,
+ CRYPT_AsnEncodeEncryptedContentInfo, 0 },
+ };
+
+ return CRYPT_AsnEncodeSequence(X509_ASN_ENCODING, items,
+ sizeof(items) / sizeof(items[0]), 0, NULL, pvData, pcbData);
+}
+
static CryptEncodeObjectExFunc CRYPT_GetBuiltinEncoder(DWORD dwCertEncodingType,
LPCSTR lpszStructType)
{
return msg;
}
+typedef struct _CMSG_ENVELOPED_ENCODE_INFO_WITH_CMS
+{
+ DWORD cbSize;
+ HCRYPTPROV_LEGACY hCryptProv;
+ CRYPT_ALGORITHM_IDENTIFIER ContentEncryptionAlgorithm;
+ void *pvEncryptionAuxInfo;
+ DWORD cRecipients;
+ PCERT_INFO *rgpRecipientCert;
+ PCMSG_RECIPIENT_ENCODE_INFO rgCmsRecipients;
+ DWORD cCertEncoded;
+ PCERT_BLOB rgCertEncoded;
+ DWORD cCrlEncoded;
+ PCRL_BLOB rgCrlEncoded;
+ DWORD cAttrCertEncoded;
+ PCERT_BLOB rgAttrCertEncoded;
+ DWORD cUnprotectedAttr;
+ PCRYPT_ATTRIBUTE rgUnprotectedAttr;
+} CMSG_ENVELOPED_ENCODE_INFO_WITH_CMS, *PCMSG_ENVELOPED_ENCODE_INFO_WITH_CMS;
+
+typedef struct _CEnvelopedEncodeMsg
+{
+ CryptMsgBase base;
+ CRYPT_ALGORITHM_IDENTIFIER algo;
+ HCRYPTPROV prov;
+ HCRYPTKEY key;
+ DWORD cRecipientInfo;
+ CMSG_KEY_TRANS_RECIPIENT_INFO *recipientInfo;
+ CRYPT_DATA_BLOB data;
+} CEnvelopedEncodeMsg;
+
+static BOOL CRYPT_ConstructAlgorithmId(CRYPT_ALGORITHM_IDENTIFIER *out,
+ const CRYPT_ALGORITHM_IDENTIFIER *in)
+{
+ out->pszObjId = CryptMemAlloc(strlen(in->pszObjId) + 1);
+ if (out->pszObjId)
+ {
+ strcpy(out->pszObjId, in->pszObjId);
+ return CRYPT_ConstructBlob(&out->Parameters, &in->Parameters);
+ }
+ else
+ return FALSE;
+}
+
+static BOOL CRecipientInfo_Construct(CMSG_KEY_TRANS_RECIPIENT_INFO *info,
+ const CERT_INFO *cert, HCRYPTPROV prov, HCRYPTKEY key)
+{
+ HCRYPTKEY expKey;
+ BOOL ret = TRUE;
+
+ info->dwVersion = CMSG_KEY_TRANS_PKCS_1_5_VERSION;
+ info->RecipientId.dwIdChoice = CERT_ID_ISSUER_SERIAL_NUMBER;
+ ret = CRYPT_ConstructBlob(&info->RecipientId.u.IssuerSerialNumber.Issuer,
+ &cert->Issuer);
+ if (ret)
+ ret = CRYPT_ConstructBlob(
+ &info->RecipientId.u.IssuerSerialNumber.SerialNumber,
+ &cert->SerialNumber);
+ if (ret)
+ ret = CRYPT_ConstructAlgorithmId(&info->KeyEncryptionAlgorithm,
+ &cert->SubjectPublicKeyInfo.Algorithm);
+ info->EncryptedKey.cbData = 0;
+ info->EncryptedKey.pbData = NULL;
+
+ if (ret)
+ ret = CryptImportPublicKeyInfo(prov, X509_ASN_ENCODING,
+ (PCERT_PUBLIC_KEY_INFO)&cert->SubjectPublicKeyInfo, &expKey);
+ if (ret)
+ {
+ BYTE *keyBlob;
+ DWORD size;
+
+ ret = CryptExportKey(key, expKey, SIMPLEBLOB, 0, NULL, &size);
+ keyBlob = CryptMemAlloc(size);
+ if (keyBlob)
+ {
+ ret = CryptExportKey(key, expKey, SIMPLEBLOB, 0, keyBlob, &size);
+ if (ret)
+ {
+ DWORD head = sizeof(BLOBHEADER) + sizeof(ALG_ID);
+
+ info->EncryptedKey.pbData = CryptMemAlloc(size - head);
+ if (info->EncryptedKey.pbData)
+ {
+ DWORD i, k = 0;
+
+ info->EncryptedKey.cbData = size - head;
+ for (i = size - 1; i >= head; --i, ++k)
+ info->EncryptedKey.pbData[k] = keyBlob[i];
+ }
+ else
+ ret = FALSE;
+ }
+ CryptMemFree(keyBlob);
+ }
+ else
+ ret = FALSE;
+ CryptDestroyKey(expKey);
+ }
+ return ret;
+}
+
+static void CRecipientInfo_Free(CMSG_KEY_TRANS_RECIPIENT_INFO *info)
+{
+ CryptMemFree(info->RecipientId.u.IssuerSerialNumber.Issuer.pbData);
+ CryptMemFree(info->RecipientId.u.IssuerSerialNumber.SerialNumber.pbData);
+ CryptMemFree(info->KeyEncryptionAlgorithm.pszObjId);
+ CryptMemFree(info->KeyEncryptionAlgorithm.Parameters.pbData);
+ CryptMemFree(info->EncryptedKey.pbData);
+}
+
+static void CEnvelopedEncodeMsg_Close(HCRYPTMSG hCryptMsg)
+{
+ CEnvelopedEncodeMsg *msg = hCryptMsg;
+
+ CryptMemFree(msg->algo.pszObjId);
+ CryptMemFree(msg->algo.Parameters.pbData);
+ if (msg->base.open_flags & CMSG_CRYPT_RELEASE_CONTEXT_FLAG)
+ CryptReleaseContext(msg->prov, 0);
+ CryptDestroyKey(msg->key);
+ if (msg->recipientInfo)
+ {
+ DWORD i;
+
+ for (i = 0; i < msg->cRecipientInfo; ++i)
+ CRecipientInfo_Free(&msg->recipientInfo[i]);
+ CryptMemFree(msg->recipientInfo);
+ }
+ CryptMemFree(msg->data.pbData);
+}
+
+static BOOL CEnvelopedEncodeMsg_GetParam(HCRYPTMSG hCryptMsg, DWORD dwParamType,
+ DWORD dwIndex, void *pvData, DWORD *pcbData)
+{
+ CEnvelopedEncodeMsg *msg = hCryptMsg;
+ BOOL ret = FALSE;
+
+ switch (dwParamType)
+ {
+ case CMSG_BARE_CONTENT_PARAM:
+ if (msg->base.streamed)
+ SetLastError(E_INVALIDARG);
+ else
+ {
+ char oid_rsa_data[] = szOID_RSA_data;
+ CRYPT_ENVELOPED_DATA envelopedData = {
+ CMSG_ENVELOPED_DATA_PKCS_1_5_VERSION, msg->cRecipientInfo,
+ msg->recipientInfo, { oid_rsa_data, msg->algo, msg->data }
+ };
+
+ ret = CRYPT_AsnEncodePKCSEnvelopedData(&envelopedData, pvData,
+ pcbData);
+ }
+ break;
+ case CMSG_CONTENT_PARAM:
+ {
+ CRYPT_CONTENT_INFO info;
+
+ ret = CryptMsgGetParam(hCryptMsg, CMSG_BARE_CONTENT_PARAM, 0, NULL,
+ &info.Content.cbData);
+ if (ret)
+ {
+ info.Content.pbData = CryptMemAlloc(info.Content.cbData);
+ if (info.Content.pbData)
+ {
+ ret = CryptMsgGetParam(hCryptMsg, CMSG_BARE_CONTENT_PARAM, 0,
+ info.Content.pbData, &info.Content.cbData);
+ if (ret)
+ {
+ char oid_rsa_enveloped[] = szOID_RSA_envelopedData;
+
+ info.pszObjId = oid_rsa_enveloped;
+ ret = CryptEncodeObjectEx(X509_ASN_ENCODING,
+ PKCS_CONTENT_INFO, &info, 0, NULL, pvData, pcbData);
+ }
+ CryptMemFree(info.Content.pbData);
+ }
+ else
+ ret = FALSE;
+ }
+ break;
+ }
+ default:
+ SetLastError(CRYPT_E_INVALID_MSG_TYPE);
+ }
+ return ret;
+}
+
+static BOOL CEnvelopedEncodeMsg_Update(HCRYPTMSG hCryptMsg, const BYTE *pbData,
+ DWORD cbData, BOOL fFinal)
+{
+ CEnvelopedEncodeMsg *msg = hCryptMsg;
+ BOOL ret = FALSE;
+
+ if (msg->base.state == MsgStateFinalized)
+ SetLastError(CRYPT_E_MSG_ERROR);
+ else if (msg->base.streamed)
+ {
+ FIXME("streamed stub\n");
+ msg->base.state = fFinal ? MsgStateFinalized : MsgStateUpdated;
+ ret = TRUE;
+ }
+ else
+ {
+ if (!fFinal)
+ {
+ if (msg->base.open_flags & CMSG_DETACHED_FLAG)
+ SetLastError(E_INVALIDARG);
+ else
+ SetLastError(CRYPT_E_MSG_ERROR);
+ }
+ else
+ {
+ if (cbData)
+ {
+ DWORD dataLen = cbData;
+
+ msg->data.cbData = cbData;
+ msg->data.pbData = CryptMemAlloc(cbData);
+ if (msg->data.pbData)
+ {
+ memcpy(msg->data.pbData, pbData, cbData);
+ ret = CryptEncrypt(msg->key, 0, TRUE, 0, msg->data.pbData,
+ &dataLen, msg->data.cbData);
+ msg->data.cbData = dataLen;
+ if (dataLen > cbData)
+ {
+ msg->data.pbData = CryptMemRealloc(msg->data.pbData,
+ dataLen);
+ if (msg->data.pbData)
+ {
+ dataLen = cbData;
+ ret = CryptEncrypt(msg->key, 0, TRUE, 0,
+ msg->data.pbData, &dataLen, msg->data.cbData);
+ }
+ else
+ ret = FALSE;
+ }
+ if (!ret)
+ CryptMemFree(msg->data.pbData);
+ }
+ else
+ ret = FALSE;
+ if (!ret)
+ {
+ msg->data.cbData = 0;
+ msg->data.pbData = NULL;
+ }
+ }
+ else
+ ret = TRUE;
+ msg->base.state = MsgStateFinalized;
+ }
+ }
+ return ret;
+}
+
+static HCRYPTMSG CEnvelopedEncodeMsg_Open(DWORD dwFlags,
+ const void *pvMsgEncodeInfo, LPCSTR pszInnerContentObjID,
+ PCMSG_STREAM_INFO pStreamInfo)
+{
+ CEnvelopedEncodeMsg *msg;
+ const CMSG_ENVELOPED_ENCODE_INFO_WITH_CMS *info = pvMsgEncodeInfo;
+ HCRYPTPROV prov;
+ ALG_ID algID;
+
+ if (info->cbSize != sizeof(CMSG_ENVELOPED_ENCODE_INFO) &&
+ info->cbSize != sizeof(CMSG_ENVELOPED_ENCODE_INFO_WITH_CMS))
+ {
+ SetLastError(E_INVALIDARG);
+ return NULL;
+ }
+ if (info->cbSize == sizeof(CMSG_ENVELOPED_ENCODE_INFO_WITH_CMS))
+ FIXME("CMS fields unsupported\n");
+ if (!(algID = CertOIDToAlgId(info->ContentEncryptionAlgorithm.pszObjId)))
+ {
+ SetLastError(CRYPT_E_UNKNOWN_ALGO);
+ return NULL;
+ }
+ if (info->cRecipients && !info->rgpRecipientCert)
+ {
+ SetLastError(E_INVALIDARG);
+ return NULL;
+ }
+ if (info->hCryptProv)
+ prov = info->hCryptProv;
+ else
+ {
+ prov = CRYPT_GetProvForAlgId(algID);
+ if (!prov) return NULL;
+ dwFlags |= CMSG_CRYPT_RELEASE_CONTEXT_FLAG;
+ }
+ msg = CryptMemAlloc(sizeof(CEnvelopedEncodeMsg));
+ if (msg)
+ {
+ BOOL ret;
+ DWORD i;
+
+ CryptMsgBase_Init((CryptMsgBase *)msg, dwFlags, pStreamInfo,
+ CEnvelopedEncodeMsg_Close, CEnvelopedEncodeMsg_GetParam,
+ CEnvelopedEncodeMsg_Update, CRYPT_DefaultMsgControl);
+ ret = CRYPT_ConstructAlgorithmId(&msg->algo,
+ &info->ContentEncryptionAlgorithm);
+ msg->prov = prov;
+ msg->data.cbData = 0;
+ msg->data.pbData = NULL;
+ msg->cRecipientInfo = info->cRecipients;
+ msg->recipientInfo = CryptMemAlloc(info->cRecipients *
+ sizeof(CMSG_KEY_TRANS_RECIPIENT_INFO));
+ if (!msg->recipientInfo)
+ ret = FALSE;
+ if (ret)
+ ret = CryptGenKey(prov, algID, CRYPT_EXPORTABLE, &msg->key);
+ for (i = 0; ret && i < msg->cRecipientInfo; ++i)
+ ret = CRecipientInfo_Construct(&msg->recipientInfo[i],
+ info->rgpRecipientCert[i], prov, msg->key);
+ if (!ret)
+ {
+ CryptMsgClose(msg);
+ msg = NULL;
+ }
+ }
+ if (!msg && (dwFlags & CMSG_CRYPT_RELEASE_CONTEXT_FLAG))
+ CryptReleaseContext(prov, 0);
+ return msg;
+}
+
HCRYPTMSG WINAPI CryptMsgOpenToEncode(DWORD dwMsgEncodingType, DWORD dwFlags,
DWORD dwMsgType, const void *pvMsgEncodeInfo, LPSTR pszInnerContentObjID,
PCMSG_STREAM_INFO pStreamInfo)
pszInnerContentObjID, pStreamInfo);
break;
case CMSG_ENVELOPED:
- FIXME("unimplemented for type CMSG_ENVELOPED\n");
+ msg = CEnvelopedEncodeMsg_Open(dwFlags, pvMsgEncodeInfo,
+ pszInnerContentObjID, pStreamInfo);
break;
case CMSG_SIGNED_AND_ENVELOPED:
case CMSG_ENCRYPTED:
encryptedBlobSize = 255;
ret = CryptEncryptMessage(¶, 0, NULL, NULL, 0, NULL,
&encryptedBlobSize);
- todo_wine
ok(!ret && GetLastError() == CRYPT_E_UNKNOWN_ALGO,
"expected CRYPT_E_UNKNOWN_ALGO, got %08x\n", GetLastError());
ok(!encryptedBlobSize, "unexpected size %d\n", encryptedBlobSize);
encryptedBlobSize = 0;
ret = CryptEncryptMessage(¶, 0, NULL, NULL, 0, NULL,
&encryptedBlobSize);
- todo_wine
ok(ret, "CryptEncryptMessage failed: %08x\n", GetLastError());
- todo_wine
ok(encryptedBlobSize == sizeof(encryptedMessage),
"unexpected size of encrypted blob %d\n", encryptedBlobSize);
encryptedBlob = CryptMemAlloc(encryptedBlobSize);
SetLastError(0xdeadbeef);
ret = CryptEncryptMessage(¶, 0, NULL, NULL, 0, encryptedBlob,
&encryptedBlobSize);
- todo_wine
ok(ret, "CryptEncryptMessage failed: %08x\n", GetLastError());
ok(!memcmp(encryptedBlob, encryptedMessage, encryptedBlobSize),
"unexpected value\n");
encryptedBlobSize = 0;
ret = CryptEncryptMessage(¶, 2, certs, NULL, 0, NULL,
&encryptedBlobSize);
- todo_wine
ok(ret, "CryptEncryptMessage failed: %08x\n", GetLastError());
- todo_wine
ok(encryptedBlobSize == 431, "unexpected size of encrypted blob %d\n",
encryptedBlobSize);
encryptedBlob = CryptMemAlloc(encryptedBlobSize);
SetLastError(0xdeadbeef);
ret = CryptEncryptMessage(¶, 2, certs, NULL, 0, encryptedBlob,
&encryptedBlobSize);
- todo_wine
ok(ret, "CryptEncryptMessage failed: %08x\n", GetLastError());
CryptMemFree(encryptedBlob);
}
encryptedBlobSize = 0;
ret = CryptEncryptMessage(¶, 0, NULL, blob, sizeof(blob), NULL,
&encryptedBlobSize);
- todo_wine
ok(ret, "CryptEncryptMessage failed: %08x\n", GetLastError());
- todo_wine
ok(encryptedBlobSize == 55, "unexpected size of encrypted blob %d\n",
encryptedBlobSize);
encryptedBlob = CryptMemAlloc(encryptedBlobSize);
SetLastError(0xdeadbeef);
ret = CryptEncryptMessage(¶, 0, NULL, blob, sizeof(blob),
encryptedBlob, &encryptedBlobSize);
- todo_wine
ok(ret, "CryptEncryptMessage failed: %08x\n", GetLastError());
CryptMemFree(encryptedBlob);
}
encryptedBlobSize = 0;
ret = CryptEncryptMessage(¶, 2, certs, blob, sizeof(blob), NULL,
&encryptedBlobSize);
- todo_wine
ok(ret, "CryptEncryptMessage failed: %08x\n", GetLastError());
- todo_wine
ok(encryptedBlobSize == 435, "unexpected size of encrypted blob %d\n",
encryptedBlobSize);
encryptedBlob = CryptMemAlloc(encryptedBlobSize);
SetLastError(0xdeadbeef);
ret = CryptEncryptMessage(¶, 2, certs, blob, sizeof(blob),
encryptedBlob, &encryptedBlobSize);
- todo_wine
ok(ret, "CryptEncryptMessage failed: %08x\n", GetLastError());
CryptMemFree(encryptedBlob);
}
SetLastError(0xdeadbeef);
msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED,
&envelopedInfo, NULL, NULL);
- todo_wine
ok(!msg && GetLastError() == E_INVALIDARG,
"expected E_INVALIDARG, got %08x\n", GetLastError());
SetLastError(0xdeadbeef);
msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED,
&envelopedInfo, NULL, NULL);
- todo_wine
ok(!msg && GetLastError() == CRYPT_E_UNKNOWN_ALGO,
"expected CRYPT_E_UNKNOWN_ALGO, got %08x\n", GetLastError());
SetLastError(0xdeadbeef);
msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED,
&envelopedInfo, NULL, NULL);
- todo_wine
ok(msg != NULL, "CryptMsgOpenToEncode failed: %08x\n", GetLastError());
CryptMsgClose(msg);
SetLastError(0xdeadbeef);
msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED,
&envelopedInfo, NULL, NULL);
- todo_wine
ok(!msg && GetLastError() == E_INVALIDARG,
"expected E_INVALIDARG, got %08x\n", GetLastError());
SetLastError(0xdeadbeef);
msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED,
&envelopedInfo, NULL, NULL);
- todo_wine
ok(msg != NULL, "CryptMsgOpenToEncode failed: %08x\n", GetLastError());
CryptMsgClose(msg);
SetLastError(0xdeadbeef);
msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED,
&envelopedInfo, NULL, NULL);
- todo_wine
ok(msg != NULL, "CryptMsgOpenToEncode failed: %08x\n", GetLastError());
CryptMsgClose(msg);
SetLastError(0xdeadbeef);
msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED,
&envelopedInfo, NULL, NULL);
- todo_wine
ok(msg != NULL, "CryptMsgOpenToEncode failed: %08x\n", GetLastError());
if (msg)
{
SetLastError(0xdeadbeef);
ret = CryptMsgUpdate(msg, NULL, 0, FALSE);
- todo_wine
ok(!ret && GetLastError() == CRYPT_E_MSG_ERROR,
"expected CRYPT_E_MSG_ERROR, got %08x\n", GetLastError());
SetLastError(0xdeadbeef);
ret = CryptMsgUpdate(msg, NULL, 0, TRUE);
- todo_wine
ok(ret, "CryptMsgUpdate failed: %08x\n", GetLastError());
SetLastError(0xdeadbeef);
ret = CryptMsgUpdate(msg, NULL, 0, TRUE);
- todo_wine
ok(!ret && GetLastError() == CRYPT_E_MSG_ERROR,
"expected CRYPT_E_MSG_ERROR, got %08x\n", GetLastError());
CryptMsgClose(msg);
SetLastError(0xdeadbeef);
msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED,
&envelopedInfo, NULL, NULL);
- todo_wine
ok(msg != NULL, "CryptMsgOpenToEncode failed: %08x\n", GetLastError());
if (msg)
{
SetLastError(0xdeadbeef);
ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), FALSE);
- todo_wine
ok(!ret && GetLastError() == CRYPT_E_MSG_ERROR,
"expected CRYPT_E_MSG_ERROR, got %08x\n", GetLastError());
SetLastError(0xdeadbeef);
ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
- todo_wine
ok(ret, "CryptMsgUpdate failed: %08x\n", GetLastError());
SetLastError(0xdeadbeef);
ret = CryptMsgUpdate(msg, NULL, 0, TRUE);
- todo_wine
ok(!ret && GetLastError() == CRYPT_E_MSG_ERROR,
"expected CRYPT_E_MSG_ERROR, got %08x\n", GetLastError());
CryptMsgClose(msg);
SetLastError(0xdeadbeef);
msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, CMSG_DETACHED_FLAG,
CMSG_ENVELOPED, &envelopedInfo, NULL, NULL);
- todo_wine
ok(msg != NULL, "CryptMsgOpenToEncode failed: %08x\n", GetLastError());
if (msg)
{
SetLastError(0xdeadbeef);
ret = CryptMsgUpdate(msg, NULL, 0, FALSE);
- todo_wine
ok(!ret && GetLastError() == E_INVALIDARG,
"expected E_INVALIDARG, got %08x\n", GetLastError());
SetLastError(0xdeadbeef);
ret = CryptMsgUpdate(msg, NULL, 0, TRUE);
- todo_wine
ok(ret, "CryptMsgUpdate failed: %08x\n", GetLastError());
CryptMsgClose(msg);
}
SetLastError(0xdeadbeef);
msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, CMSG_DETACHED_FLAG,
CMSG_ENVELOPED, &envelopedInfo, NULL, NULL);
- todo_wine
ok(msg != NULL, "CryptMsgOpenToEncode failed: %08x\n", GetLastError());
if (msg)
{
SetLastError(0xdeadbeef);
ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), FALSE);
- todo_wine
ok(!ret && GetLastError() == E_INVALIDARG,
"expected E_INVALIDARG, got %08x\n", GetLastError());
SetLastError(0xdeadbeef);
ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
- todo_wine
ok(ret, "CryptMsgUpdate failed: %08x\n", GetLastError());
CryptMsgClose(msg);
}
SetLastError(0xdeadbeef);
msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED,
&envelopedInfo, NULL, &streamInfo);
- todo_wine
ok(msg != NULL, "CryptMsgOpenToEncode failed: %08x\n", GetLastError());
if (msg)
{
SetLastError(0xdeadbeef);
ret = CryptMsgUpdate(msg, NULL, 0, FALSE);
- todo_wine
ok(ret, "CryptMsgUpdate failed: %08x\n", GetLastError());
SetLastError(0xdeadbeef);
ret = CryptMsgUpdate(msg, NULL, 0, TRUE);
- todo_wine
ok(ret, "CryptMsgUpdate failed: %08x\n", GetLastError());
CryptMsgClose(msg);
}
SetLastError(0xdeadbeef);
msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED,
&envelopedInfo, NULL, &streamInfo);
- todo_wine
ok(msg != NULL, "CryptMsgOpenToEncode failed: %08x\n", GetLastError());
if (msg)
{
SetLastError(0xdeadbeef);
ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), FALSE);
- todo_wine
ok(ret, "CryptMsgUpdate failed: %08x\n", GetLastError());
SetLastError(0xdeadbeef);
ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
- todo_wine
ok(ret, "CryptMsgUpdate failed: %08x\n", GetLastError());
CryptMsgClose(msg);
}
SetLastError(0xdeadbeef);
msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED,
&envelopedInfo, NULL, NULL);
- todo_wine
ok(msg != NULL, "CryptMsgOpenToEncode failed: %08x\n", GetLastError());
if (msg)
{