ReactOS 0.4.16-dev-1946-g52006dd
msg.c File Reference
#include <stdio.h>
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winerror.h>
#include <wincrypt.h>
#include "wine/test.h"
Include dependency graph for msg.c:

Go to the source code of this file.

Classes

struct  update_accum
 

Macros

#define CMSG_SIGNER_ENCODE_INFO_HAS_CMS_FIELDS
 
#define CMSG_SIGNED_ENCODE_INFO_HAS_CMS_FIELDS
 

Functions

static void test_msg_open_to_encode (void)
 
static void test_msg_open_to_decode (void)
 
static void test_msg_get_param (void)
 
static void test_msg_close (void)
 
static void check_param (LPCSTR test, HCRYPTMSG msg, DWORD param, const BYTE *expected, DWORD expectedSize)
 
static void test_data_msg_open (void)
 
static BOOL WINAPI nop_stream_output (const void *pvArg, BYTE *pb, DWORD cb, BOOL final)
 
static void test_data_msg_update (void)
 
static void test_data_msg_get_param (void)
 
static BOOL WINAPI accumulating_stream_output (const void *pvArg, BYTE *pb, DWORD cb, BOOL final)
 
static void check_updates (LPCSTR header, const struct update_accum *expected, const struct update_accum *got)
 
static void free_updates (struct update_accum *accum)
 
static void test_data_msg_encoding (void)
 
static void test_data_msg (void)
 
static void test_hash_msg_open (void)
 
static void test_hash_msg_update (void)
 
static void test_hash_msg_get_param (void)
 
static void test_hash_msg_encoding (void)
 
static void test_hash_msg (void)
 
static void test_signed_msg_open (void)
 
static void test_signed_msg_update (void)
 
static void test_signed_msg_encoding (void)
 
static void test_signed_msg_get_param (void)
 
static void test_signed_msg (void)
 
static void test_enveloped_msg_open (void)
 
static void test_enveloped_msg_update (void)
 
static void test_enveloped_msg_encoding (void)
 
static void test_enveloped_msg (void)
 
static void test_decode_msg_update (void)
 
static void compare_signer_info (const CMSG_SIGNER_INFO *got, const CMSG_SIGNER_INFO *expected)
 
static void compare_cms_signer_info (const CMSG_CMS_SIGNER_INFO *got, const CMSG_CMS_SIGNER_INFO *expected)
 
static void test_decode_msg_get_param (void)
 
static void test_decode_msg (void)
 
static void test_msg_control (void)
 
static void test_msg_get_and_verify_signer (void)
 
static void test_verify_ecc_signature (void)
 
 START_TEST (msg)
 

Variables

static char oid_rsa_md5 [] = szOID_RSA_MD5
 
static const BYTE msgData [] = { 1, 2, 3, 4 }
 
static const BYTE dataEmptyBareContent [] = { 0x04,0x00 }
 
static const BYTE dataEmptyContent []
 
static const BYTE dataBareContent [] = { 0x04,0x04,0x01,0x02,0x03,0x04 }
 
static const BYTE dataContent []
 
static BYTE u1 []
 
static BYTE u2 [] = { 0x01,0x02,0x03,0x04 }
 
static CRYPT_DATA_BLOB b1 []
 
static const struct update_accum a1 = { ARRAY_SIZE(b1), b1 }
 
static BYTE u3 []
 
static CRYPT_DATA_BLOB b2 []
 
static const struct update_accum a2 = { ARRAY_SIZE(b2), b2 }
 
static BYTE u4 []
 
static BYTE u5 [] = { 0x04,0x04 }
 
static BYTE u6 [] = { 0x00,0x00,0x00,0x00,0x00,0x00 }
 
static CRYPT_DATA_BLOB b3 []
 
static const struct update_accum a3 = { ARRAY_SIZE(b3), b3 }
 
static const BYTE emptyHashParam []
 
static const BYTE hashEmptyBareContent []
 
static const BYTE hashEmptyContent []
 
static const BYTE hashBareContent []
 
static const BYTE hashContent []
 
static const BYTE detachedHashNonFinalBareContent []
 
static const BYTE detachedHashNonFinalContent []
 
static const BYTE detachedHashBareContent []
 
static const BYTE detachedHashContent []
 
static const CHAR cspNameA []
 
static BYTE serialNum [] = { 1 }
 
static BYTE encodedCommonName []
 
static const BYTE privKey []
 
static BYTE pubKey []
 
static const BYTE unsignedEmptyBareContent []
 
static const BYTE unsignedEmptyContent []
 
static const BYTE detachedUnsignedBareContent []
 
static const BYTE detachedUnsignedContent []
 
static const BYTE signedEmptyBareContent []
 
static const BYTE signedEmptyContent []
 
static const BYTE detachedSignedBareContent []
 
static const BYTE detachedSignedContent []
 
static const BYTE signedBareContent []
 
static const BYTE signedContent []
 
static const BYTE signedHash []
 
static const BYTE signedKeyIdEmptyContent []
 
static const BYTE signedEncodedSigner []
 
static const BYTE signedWithAuthAttrsBareContent []
 
static BYTE cert []
 
static BYTE v1CertWithPubKey []
 
static const BYTE signedWithCertEmptyBareContent []
 
static const BYTE signedWithCertBareContent []
 
static BYTE crl []
 
static const BYTE signedWithCrlEmptyBareContent []
 
static const BYTE signedWithCrlBareContent []
 
static const BYTE signedWithCertAndCrlEmptyBareContent []
 
static const BYTE signedWithCertAndCrlBareContent []
 
static const BYTE signedWithCertWithPubKeyBareContent []
 
static BYTE v1CertWithValidPubKey []
 
static const BYTE signedWithCertWithValidPubKeyEmptyContent []
 
static const BYTE signedWithCertWithValidPubKeyContent []
 
static char oid_rsa_rc4 [] = szOID_RSA_RC4
 
static const BYTE envelopedEmptyBareContent []
 
static const BYTE envelopedEmptyContent []
 
static CRYPT_DATA_BLOB b4 = { 0, NULL }
 
static const struct update_accum a4 = { 1, &b4 }
 
static const BYTE bogusOIDContent []
 
static const BYTE bogusHashContent []
 
static const BYTE envelopedBareContentWithoutData []
 
static const BYTE hashParam []
 
static const BYTE signedWithCertAndCrlComputedHash []
 
static BYTE keyIdIssuer []
 
static const BYTE publicPrivateKeyPair []
 
static const BYTE envelopedMessage []
 
static const BYTE envelopedBareMessage []
 
static const BYTE envelopedMessageWith3Recps []
 
static const BYTE serialNumber []
 
static const BYTE issuer []
 
static BYTE aKey [] = { 0,1,2,3,4,5,6,7,8,9,0xa,0xb,0xc,0xd,0xe,0xf }
 
static BYTE encodedPubKey []
 
static BYTE mod_encoded []
 
static const BYTE msg_signed_ecc_prime256v1 []
 

Macro Definition Documentation

◆ CMSG_SIGNED_ENCODE_INFO_HAS_CMS_FIELDS

#define CMSG_SIGNED_ENCODE_INFO_HAS_CMS_FIELDS

Definition at line 27 of file msg.c.

◆ CMSG_SIGNER_ENCODE_INFO_HAS_CMS_FIELDS

#define CMSG_SIGNER_ENCODE_INFO_HAS_CMS_FIELDS

Definition at line 26 of file msg.c.

Function Documentation

◆ accumulating_stream_output()

static BOOL WINAPI accumulating_stream_output ( const void pvArg,
BYTE pb,
DWORD  cb,
BOOL  final 
)
static

Definition at line 498 of file msg.c.

500{
501 struct update_accum *accum = (struct update_accum *)pvArg;
502 BOOL ret = FALSE;
503
504 if (accum->cUpdates)
505 accum->updates = CryptMemRealloc(accum->updates,
506 (accum->cUpdates + 1) * sizeof(CRYPT_DATA_BLOB));
507 else
508 accum->updates = CryptMemAlloc(sizeof(CRYPT_DATA_BLOB));
509 if (accum->updates)
510 {
511 CRYPT_DATA_BLOB *blob = &accum->updates[accum->cUpdates];
512
513 blob->pbData = CryptMemAlloc(cb);
514 if (blob->pbData)
515 {
516 memcpy(blob->pbData, pb, cb);
517 blob->cbData = cb;
518 ret = TRUE;
519 }
520 accum->cUpdates++;
521 }
522 return ret;
523}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LPVOID WINAPI CryptMemAlloc(ULONG cbSize)
Definition: main.c:131
LPVOID WINAPI CryptMemRealloc(LPVOID pv, ULONG cbSize)
Definition: main.c:136
return ret
Definition: mutex.c:146
unsigned int BOOL
Definition: ntddk_ex.h:94
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
Definition: image.c:134
DWORD cUpdates
Definition: msg.c:494
CRYPT_DATA_BLOB * updates
Definition: msg.c:495

Referenced by test_data_msg_encoding(), test_decode_msg_update(), test_get_digest_stream(), and test_hash_msg_encoding().

◆ check_param()

static void check_param ( LPCSTR  test,
HCRYPTMSG  msg,
DWORD  param,
const BYTE expected,
DWORD  expectedSize 
)
static

Definition at line 266 of file msg.c.

268{
269 DWORD size;
270 LPBYTE buf;
271 BOOL ret;
272
273 size = 0xdeadbeef;
275 ok(ret, "%s: CryptMsgGetParam failed: %08lx\n", test, GetLastError());
276
277 buf = malloc(size);
279 ok(ret, "%s: CryptMsgGetParam failed: %08lx\n", test, GetLastError());
280 ok(size == expectedSize, "%s: expected size %ld, got %ld\n", test,
281 expectedSize, size);
282 if (size == expectedSize && size)
283 ok(!memcmp(buf, expected, size), "%s: unexpected data\n", test);
284 free(buf);
285}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define ok(value,...)
Definition: atltest.h:57
#define msg(x)
Definition: auth_time.c:54
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
BOOL WINAPI CryptMsgGetParam(HCRYPTMSG hCryptMsg, DWORD dwParamType, DWORD dwIndex, void *pvData, DWORD *pcbData)
Definition: msg.c:3626
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizeiptr size
Definition: glext.h:5919
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLfloat param
Definition: glext.h:5796
BOOL expected
Definition: store.c:2000
#define test
Definition: rosglue.h:37
unsigned char * LPBYTE
Definition: typedefs.h:53
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

Referenced by test_data_msg_encoding(), test_decode_msg_get_param(), test_enveloped_msg_encoding(), test_hash_msg_encoding(), and test_signed_msg_encoding().

◆ check_updates()

static void check_updates ( LPCSTR  header,
const struct update_accum expected,
const struct update_accum got 
)
static

Definition at line 558 of file msg.c.

560{
561 DWORD i;
562
563 ok(expected->cUpdates == got->cUpdates,
564 "%s: expected %ld updates, got %ld\n", header, expected->cUpdates,
565 got->cUpdates);
566 if (expected->cUpdates == got->cUpdates)
567 for (i = 0; i < min(expected->cUpdates, got->cUpdates); i++)
568 {
569 ok(expected->updates[i].cbData == got->updates[i].cbData,
570 "%s, update %ld: expected %ld bytes, got %ld\n", header, i,
571 expected->updates[i].cbData, got->updates[i].cbData);
572 if (expected->updates[i].cbData && expected->updates[i].cbData ==
573 got->updates[i].cbData)
574 ok(!memcmp(expected->updates[i].pbData, got->updates[i].pbData,
575 got->updates[i].cbData), "%s, update %ld: unexpected value\n",
576 header, i);
577 }
578}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define min(a, b)
Definition: monoChain.cc:55
BYTE * pbData
Definition: wincrypt.h:112

Referenced by test_data_msg_encoding(), test_decode_msg_update(), test_get_digest_stream(), and test_hash_msg_encoding().

◆ compare_cms_signer_info()

static void compare_cms_signer_info ( const CMSG_CMS_SIGNER_INFO got,
const CMSG_CMS_SIGNER_INFO expected 
)
static

Definition at line 2545 of file msg.c.

2547{
2548 ok(got->dwVersion == expected->dwVersion, "Expected version %ld, got %ld\n",
2549 expected->dwVersion, got->dwVersion);
2550 ok(got->SignerId.dwIdChoice == expected->SignerId.dwIdChoice,
2551 "Expected id choice %ld, got %ld\n", expected->SignerId.dwIdChoice,
2552 got->SignerId.dwIdChoice);
2553 if (got->SignerId.dwIdChoice == expected->SignerId.dwIdChoice)
2554 {
2556 {
2558 expected->SignerId.IssuerSerialNumber.Issuer.cbData,
2559 "Expected issuer size %ld, got %ld\n",
2560 expected->SignerId.IssuerSerialNumber.Issuer.cbData,
2563 expected->SignerId.IssuerSerialNumber.Issuer.pbData,
2565 "Unexpected issuer\n");
2567 expected->SignerId.IssuerSerialNumber.SerialNumber.cbData,
2568 "Expected serial number size %ld, got %ld\n",
2569 expected->SignerId.IssuerSerialNumber.SerialNumber.cbData,
2572 expected->SignerId.IssuerSerialNumber.SerialNumber.pbData,
2574 "Unexpected serial number\n");
2575 }
2576 else
2577 {
2578 ok(got->SignerId.KeyId.cbData == expected->SignerId.KeyId.cbData,
2579 "expected key id size %ld, got %ld\n",
2580 expected->SignerId.KeyId.cbData, got->SignerId.KeyId.cbData);
2581 ok(!memcmp(expected->SignerId.KeyId.pbData,
2583 "unexpected key id\n");
2584 }
2585 }
2586 /* FIXME: check more things */
2587}
CRYPT_HASH_BLOB KeyId
Definition: wincrypt.h:3833
CERT_ISSUER_SERIAL_NUMBER IssuerSerialNumber
Definition: wincrypt.h:3832
DWORD dwIdChoice
Definition: wincrypt.h:3830
CERT_NAME_BLOB Issuer
Definition: wincrypt.h:3824
CRYPT_INTEGER_BLOB SerialNumber
Definition: wincrypt.h:3825
#define CERT_ID_ISSUER_SERIAL_NUMBER
Definition: wincrypt.h:3838

Referenced by test_decode_msg_get_param().

◆ compare_signer_info()

static void compare_signer_info ( const CMSG_SIGNER_INFO got,
const CMSG_SIGNER_INFO expected 
)
static

Definition at line 2527 of file msg.c.

2529{
2530 ok(got->dwVersion == expected->dwVersion, "Expected version %ld, got %ld\n",
2531 expected->dwVersion, got->dwVersion);
2532 ok(got->Issuer.cbData == expected->Issuer.cbData,
2533 "Expected issuer size %ld, got %ld\n", expected->Issuer.cbData,
2534 got->Issuer.cbData);
2535 ok(!memcmp(got->Issuer.pbData, expected->Issuer.pbData, got->Issuer.cbData),
2536 "Unexpected issuer\n");
2537 ok(got->SerialNumber.cbData == expected->SerialNumber.cbData,
2538 "Expected serial number size %ld, got %ld\n", expected->SerialNumber.cbData,
2539 got->SerialNumber.cbData);
2540 ok(!memcmp(got->SerialNumber.pbData, expected->SerialNumber.pbData,
2541 got->SerialNumber.cbData), "Unexpected serial number\n");
2542 /* FIXME: check more things */
2543}
CERT_NAME_BLOB Issuer
Definition: wincrypt.h:882
CRYPT_INTEGER_BLOB SerialNumber
Definition: wincrypt.h:883

Referenced by test_decode_msg_get_param().

◆ free_updates()

static void free_updates ( struct update_accum accum)
static

Definition at line 581 of file msg.c.

582{
583 DWORD i;
584
585 for (i = 0; i < accum->cUpdates; i++)
586 CryptMemFree(accum->updates[i].pbData);
587 CryptMemFree(accum->updates);
588 accum->updates = NULL;
589 accum->cUpdates = 0;
590}
VOID WINAPI CryptMemFree(LPVOID pv)
Definition: main.c:141

Referenced by test_data_msg_encoding(), test_decode_msg_update(), test_get_digest_stream(), and test_hash_msg_encoding().

◆ nop_stream_output()

static BOOL WINAPI nop_stream_output ( const void pvArg,
BYTE pb,
DWORD  cb,
BOOL  final 
)
static

◆ START_TEST()

START_TEST ( msg  )

Definition at line 3661 of file msg.c.

3662{
3663 /* Basic parameter checking tests */
3669
3670 /* Message-type specific tests */
3671 test_data_msg();
3672 test_hash_msg();
3676
3679}
static void test_msg_open_to_decode(void)
Definition: msg.c:79
static void test_signed_msg(void)
Definition: msg.c:1987
static void test_msg_get_and_verify_signer(void)
Definition: msg.c:3400
static void test_enveloped_msg(void)
Definition: msg.c:2180
static void test_msg_close(void)
Definition: msg.c:248
static void test_data_msg(void)
Definition: msg.c:671
static void test_msg_control(void)
Definition: msg.c:3029
static void test_msg_open_to_encode(void)
Definition: msg.c:34
static void test_decode_msg(void)
Definition: msg.c:3012
static void test_hash_msg(void)
Definition: msg.c:1001
static void test_verify_ecc_signature(void)
Definition: msg.c:3585
static void test_msg_get_param(void)
Definition: msg.c:142

◆ test_data_msg()

static void test_data_msg ( void  )
static

Definition at line 671 of file msg.c.

672{
677}
static void test_data_msg_get_param(void)
Definition: msg.c:436
static void test_data_msg_open(void)
Definition: msg.c:287
static void test_data_msg_encoding(void)
Definition: msg.c:592
static void test_data_msg_update(void)
Definition: msg.c:340

Referenced by START_TEST().

◆ test_data_msg_encoding()

static void test_data_msg_encoding ( void  )
static

Definition at line 592 of file msg.c.

593{
595 BOOL ret;
596 static char oid[] = "1.2.3";
597 struct update_accum accum = { 0, NULL };
598 CMSG_STREAM_INFO streamInfo = { 0, accumulating_stream_output, &accum };
599
601 NULL);
602 check_param("data empty bare content", msg, CMSG_BARE_CONTENT_PARAM,
604 check_param("data empty content", msg, CMSG_CONTENT_PARAM, dataEmptyContent,
605 sizeof(dataEmptyContent));
607 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
608 check_param("data bare content", msg, CMSG_BARE_CONTENT_PARAM,
611 sizeof(dataContent));
613 /* Same test, but with CMSG_BARE_CONTENT_FLAG set */
616 check_param("data empty bare content", msg, CMSG_BARE_CONTENT_PARAM,
618 check_param("data empty content", msg, CMSG_CONTENT_PARAM, dataEmptyContent,
619 sizeof(dataEmptyContent));
621 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
622 check_param("data bare content", msg, CMSG_BARE_CONTENT_PARAM,
625 sizeof(dataContent));
627 /* The inner OID is apparently ignored */
629 NULL);
630 check_param("data bogus oid bare content", msg, CMSG_BARE_CONTENT_PARAM,
632 check_param("data bogus oid content", msg, CMSG_CONTENT_PARAM,
635 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
636 check_param("data bare content", msg, CMSG_BARE_CONTENT_PARAM,
639 sizeof(dataContent));
641 /* A streaming message is DER encoded if the length is not 0xffffffff, but
642 * curiously, updates aren't validated to make sure they don't exceed the
643 * stated length. (The resulting output will of course fail to decode.)
644 */
646 NULL, &streamInfo);
650 check_updates("bogus data message with definite length", &a1, &accum);
651 free_updates(&accum);
652 /* A valid definite-length encoding: */
653 streamInfo.cbContent = sizeof(msgData);
655 NULL, &streamInfo);
658 check_updates("data message with definite length", &a2, &accum);
659 free_updates(&accum);
660 /* An indefinite-length encoding: */
661 streamInfo.cbContent = 0xffffffff;
663 NULL, &streamInfo);
667 check_updates("data message with indefinite length", &a3, &accum);
668 free_updates(&accum);
669}
HCRYPTMSG WINAPI CryptMsgOpenToEncode(DWORD dwMsgEncodingType, DWORD dwFlags, DWORD dwMsgType, const void *pvMsgEncodeInfo, LPSTR pszInnerContentObjID, PCMSG_STREAM_INFO pStreamInfo)
Definition: msg.c:2034
BOOL WINAPI CryptMsgUpdate(HCRYPTMSG hCryptMsg, const BYTE *pbData, DWORD cbData, BOOL fFinal)
Definition: msg.c:3616
BOOL WINAPI CryptMsgClose(HCRYPTMSG hCryptMsg)
Definition: msg.c:3597
static const BYTE dataBareContent[]
Definition: msg.c:487
static void check_updates(LPCSTR header, const struct update_accum *expected, const struct update_accum *got)
Definition: msg.c:558
static BOOL WINAPI accumulating_stream_output(const void *pvArg, BYTE *pb, DWORD cb, BOOL final)
Definition: msg.c:498
static void check_param(LPCSTR test, HCRYPTMSG msg, DWORD param, const BYTE *expected, DWORD expectedSize)
Definition: msg.c:266
static const struct update_accum a1
Definition: msg.c:534
static const struct update_accum a2
Definition: msg.c:542
static const BYTE dataEmptyContent[]
Definition: msg.c:484
static const BYTE dataContent[]
Definition: msg.c:488
static void free_updates(struct update_accum *accum)
Definition: msg.c:581
static const struct update_accum a3
Definition: msg.c:556
static const BYTE dataEmptyBareContent[]
Definition: msg.c:338
static const BYTE msgData[]
Definition: msg.c:330
#define CMSG_DATA
Definition: wincrypt.h:3844
#define CMSG_BARE_CONTENT_FLAG
Definition: wincrypt.h:4025
#define CMSG_BARE_CONTENT_PARAM
Definition: wincrypt.h:4092
#define PKCS_7_ASN_ENCODING
Definition: wincrypt.h:2503
#define CMSG_CONTENT_PARAM
Definition: wincrypt.h:4091

Referenced by test_data_msg().

◆ test_data_msg_get_param()

static void test_data_msg_get_param ( void  )
static

Definition at line 436 of file msg.c.

437{
439 DWORD size;
440 BOOL ret;
441 CMSG_STREAM_INFO streamInfo = { 0, nop_stream_output, NULL };
442
444 NULL);
445
446 /* Content and bare content are always gettable when not streaming */
447 size = 0;
449 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
450 size = 0;
452 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
453 /* But for this type of message, the signer and hash aren't applicable,
454 * and the type isn't available.
455 */
456 size = 0;
457 SetLastError(0xdeadbeef);
460 "Expected CRYPT_E_INVALID_MSG_TYPE, got %lx\n", GetLastError());
461 SetLastError(0xdeadbeef);
464 "Expected CRYPT_E_INVALID_MSG_TYPE, got %lx\n", GetLastError());
467 "Expected CRYPT_E_INVALID_MSG_TYPE, got %lx\n", GetLastError());
469
470 /* Can't get content or bare content when streaming */
472 NULL, &streamInfo);
473 SetLastError(0xdeadbeef);
476 "Expected E_INVALIDARG, got %lx\n", GetLastError());
477 SetLastError(0xdeadbeef);
480 "Expected E_INVALIDARG, got %lx\n", GetLastError());
482}
#define E_INVALIDARG
Definition: ddrawi.h:101
#define SetLastError(x)
Definition: compat.h:752
static BOOL WINAPI nop_stream_output(const void *pvArg, BYTE *pb, DWORD cb, BOOL final)
Definition: msg.c:332
#define CMSG_COMPUTED_HASH_PARAM
Definition: wincrypt.h:4110
#define CMSG_TYPE_PARAM
Definition: wincrypt.h:4090
#define CMSG_ENCODED_SIGNER
Definition: wincrypt.h:4113
#define CRYPT_E_INVALID_MSG_TYPE
Definition: winerror.h:4402

Referenced by test_data_msg().

◆ test_data_msg_open()

static void test_data_msg_open ( void  )
static

Definition at line 287 of file msg.c.

288{
290 CMSG_HASHED_ENCODE_INFO hashInfo = { 0 };
291 CMSG_STREAM_INFO streamInfo = { 0 };
292 char oid[] = "1.2.3";
293
294 /* The data message type takes no additional info */
295 SetLastError(0xdeadbeef);
297 NULL, NULL);
299 "Expected E_INVALIDARG, got %lx\n", GetLastError());
301 NULL);
302 ok(msg != NULL, "CryptMsgOpenToEncode failed: %lx\n", GetLastError());
304
305 /* An empty stream info is allowed. */
307 &streamInfo);
308 ok(msg != NULL, "CryptMsgOpenToEncode failed: %lx\n", GetLastError());
310
311 /* Passing a bogus inner OID succeeds for a non-streamed message.. */
313 NULL);
314 ok(msg != NULL, "CryptMsgOpenToEncode failed: %lx\n", GetLastError());
316 /* and still succeeds when CMSG_DETACHED_FLAG is passed.. */
318 CMSG_DATA, NULL, oid, NULL);
319 ok(msg != NULL, "CryptMsgOpenToEncode failed: %lx\n", GetLastError());
321 /* and when a stream info is given, even though you're not supposed to be
322 * able to use anything but szOID_RSA_data when streaming is being used.
323 */
325 CMSG_DATA, NULL, oid, &streamInfo);
326 ok(msg != NULL, "CryptMsgOpenToEncode failed: %lx\n", GetLastError());
328}
#define CMSG_DETACHED_FLAG
Definition: wincrypt.h:4027

Referenced by test_data_msg().

◆ test_data_msg_update()

static void test_data_msg_update ( void  )
static

Definition at line 340 of file msg.c.

341{
343 BOOL ret;
344 CMSG_STREAM_INFO streamInfo = { 0 };
345
347 NULL);
348 /* Can't update a message that wasn't opened detached with final = FALSE */
349 SetLastError(0xdeadbeef);
352 "Expected CRYPT_E_MSG_ERROR, got %lx\n", GetLastError());
353 /* Updating it with final = TRUE succeeds */
355 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
356 /* Any subsequent update will fail, as the last was final */
357 SetLastError(0xdeadbeef);
360 "Expected CRYPT_E_MSG_ERROR, got %lx\n", GetLastError());
362
364 NULL);
365 /* Starting with Vista, can update a message with no data. */
367 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
368 if (ret)
369 {
370 DWORD size;
371
373 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
374 if (ret)
375 {
377
378 if (buf)
379 {
381 &size);
382 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
383 if (ret)
384 {
385 ok(size == sizeof(dataEmptyBareContent),
386 "unexpected size %ld\n", size);
388 "unexpected value\n");
389 }
391 }
392 }
393 }
395
398
399 SetLastError(0xdeadbeef);
402 "Expected E_INVALIDARG, got %lx\n", GetLastError());
403 SetLastError(0xdeadbeef);
406 "Expected E_INVALIDARG, got %lx\n", GetLastError());
407
409 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
411
412 /* Calling update after opening with an empty stream info (with a bogus
413 * output function) yields an error:
414 */
416 &streamInfo);
417 SetLastError(0xdeadbeef);
420 "Expected STATUS_ACCESS_VIOLATION, got %lx\n", GetLastError());
422
423 /* Calling update with a valid output function succeeds, even if the data
424 * exceeds the size specified in the stream info.
425 */
428 &streamInfo);
430 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
432 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
434}
#define STATUS_ACCESS_VIOLATION
PFN_CMSG_STREAM_OUTPUT pfnStreamOutput
Definition: wincrypt.h:3818
#define CRYPT_E_MSG_ERROR
Definition: winerror.h:4399

Referenced by test_data_msg().

◆ test_decode_msg()

static void test_decode_msg ( void  )
static

Definition at line 3012 of file msg.c.

3013{
3016}
static void test_decode_msg_update(void)
Definition: msg.c:2216
static void test_decode_msg_get_param(void)
Definition: msg.c:2720

Referenced by START_TEST().

◆ test_decode_msg_get_param()

static void test_decode_msg_get_param ( void  )
static

Definition at line 2720 of file msg.c.

2721{
2722 HCRYPTMSG msg;
2723 HCRYPTPROV hCryptProv;
2724 HCRYPTKEY key = 0;
2725 BOOL ret;
2726 DWORD size = 0, value, req_size;
2727 LPBYTE buf;
2728 CMSG_CTRL_DECRYPT_PARA decryptPara = { sizeof(decryptPara), 0 };
2729
2731 SetLastError(0xdeadbeef);
2734 "Expected CRYPT_E_INVALID_MSG_TYPE, got %lx\n", GetLastError());
2736 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
2737 check_param("data content", msg, CMSG_CONTENT_PARAM, msgData,
2738 sizeof(msgData));
2740
2743
2744 check_param("empty hash content", msg, CMSG_CONTENT_PARAM, NULL, 0);
2745 check_param("empty hash hash data", msg, CMSG_HASH_DATA_PARAM, NULL, 0);
2746 check_param("empty hash computed hash", msg, CMSG_COMPUTED_HASH_PARAM,
2748
2752 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
2753 check_param("hash content", msg, CMSG_CONTENT_PARAM, msgData,
2754 sizeof(msgData));
2755 check_param("hash hash data", msg, CMSG_HASH_DATA_PARAM, hashParam,
2756 sizeof(hashParam));
2757 check_param("hash computed hash", msg, CMSG_COMPUTED_HASH_PARAM,
2758 hashParam, sizeof(hashParam));
2759
2761 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
2763 if (buf)
2764 {
2766 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
2767 ok(size == sizeof(hashParam), "Unexpected size %ld\n", size);
2768 ok(!memcmp(buf, hashParam, size), "Unexpected value\n");
2770 }
2772 (const BYTE *)szOID_RSA_data, strlen(szOID_RSA_data) + 1);
2774 check_param("hash version", msg, CMSG_VERSION_PARAM, (const BYTE *)&value,
2775 sizeof(value));
2777
2780 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
2781 check_param("signed content", msg, CMSG_CONTENT_PARAM, msgData,
2782 sizeof(msgData));
2784 (const BYTE *)szOID_RSA_data, strlen(szOID_RSA_data) + 1);
2785 size = sizeof(value);
2786 value = 2112;
2788 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
2789 ok(value == 1, "Expected 1 signer, got %ld\n", value);
2790 size = 0;
2792 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
2794 if (buf)
2795 {
2796 CMSG_SIGNER_INFO signer = { 0 };
2797
2798 signer.dwVersion = 1;
2799 signer.Issuer.cbData = sizeof(encodedCommonName);
2801 signer.SerialNumber.cbData = sizeof(serialNum);
2802 signer.SerialNumber.pbData = serialNum;
2804 req_size = size;
2805 size += 10;
2807 ok(size == req_size, "size = %lu, expected %lu\n", size, req_size);
2810 }
2811 /* Getting the CMS signer info of a PKCS7 message is possible. */
2812 size = 0;
2814 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
2816 if (buf)
2817 {
2818 CMSG_CMS_SIGNER_INFO signer = { 0 };
2819
2820 signer.dwVersion = 1;
2830 }
2831 /* index is ignored when getting signer count */
2832 size = sizeof(value);
2834 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
2835 ok(value == 1, "Expected 1 signer, got %ld\n", value);
2837 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
2838 ok(value == 0, "Expected 0 certs, got %ld\n", value);
2840 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
2841 ok(value == 0, "Expected 0 CRLs, got %ld\n", value);
2844 NULL);
2847 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
2849 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
2850 ok(value == 1, "Expected 1 cert, got %ld\n", value);
2851 check_param("cert", msg, CMSG_CERT_PARAM, cert, sizeof(cert));
2853 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
2854 ok(value == 1, "Expected 1 CRL, got %ld\n", value);
2855 check_param("crl", msg, CMSG_CRL_PARAM, crl, sizeof(crl));
2856 check_param("signed with cert and CRL computed hash", msg,
2860
2863 sizeof(signedKeyIdEmptyContent), TRUE);
2864 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
2865 size = sizeof(value);
2867 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
2868 ok(value == 1, "Expected 1 signer, got %ld\n", value);
2869 /* Getting the regular (non-CMS) signer info from a CMS message is also
2870 * possible..
2871 */
2872 size = 0;
2874 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
2876 if (buf)
2877 {
2878 CMSG_SIGNER_INFO signer;
2879 BYTE zero = 0;
2880
2881 /* and here's the little oddity: for a CMS message using the key id
2882 * variant of a SignerId, retrieving the CMSG_SIGNER_INFO param yields
2883 * a signer with a zero (not empty) serial number, and whose issuer is
2884 * an RDN with OID szOID_KEYID_RDN, value type CERT_RDN_OCTET_STRING,
2885 * and value of the key id.
2886 */
2888 signer.Issuer.cbData = sizeof(keyIdIssuer);
2889 signer.Issuer.pbData = keyIdIssuer;
2890 signer.SerialNumber.cbData = 1;
2891 signer.SerialNumber.pbData = &zero;
2895 }
2896 size = 0;
2898 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
2900 if (buf)
2901 {
2902 CMSG_CMS_SIGNER_INFO signer = { 0 };
2903
2906 signer.SignerId.KeyId.cbData = sizeof(serialNum);
2907 signer.SignerId.KeyId.pbData = serialNum;
2912 }
2914
2916 NULL);
2919 check_param("enveloped empty bare content", msg, CMSG_CONTENT_PARAM, NULL,
2920 0);
2922
2925 TRUE);
2926 check_param("enveloped empty content", msg, CMSG_CONTENT_PARAM, NULL, 0);
2928
2931 SetLastError(0xdeadbeef);
2933 sizeof(publicPrivateKeyPair), 0, 0, &key);
2934 ok(ret, "CryptImportKey failed: %08lx\n", GetLastError());
2935
2938 check_param("enveloped message before decrypting", msg, CMSG_CONTENT_PARAM,
2939 envelopedMessage + sizeof(envelopedMessage) - 4, 4);
2940
2941 decryptPara.hCryptProv = hCryptProv;
2942 SetLastError(0xdeadbeef);
2943 ret = CryptMsgControl(msg, 0, CMSG_CTRL_DECRYPT, &decryptPara);
2944 ok(ret, "CryptMsgControl failed: %08lx\n", GetLastError());
2945 decryptPara.hCryptProv = 0;
2946 SetLastError(0xdeadbeef);
2947 ret = CryptMsgControl(msg, 0, CMSG_CTRL_DECRYPT, &decryptPara);
2949 "expected CRYPT_E_ALREADY_DECRYPTED, got %08lx\n", GetLastError());
2950 check_param("enveloped message", msg, CMSG_CONTENT_PARAM, msgData, sizeof(msgData));
2952
2954 NULL);
2956 TRUE);
2957 check_param("enveloped bare message before decrypting", msg,
2959 sizeof(envelopedBareMessage) - 4, 4);
2960
2961 decryptPara.hCryptProv = hCryptProv;
2962 SetLastError(0xdeadbeef);
2963 ret = CryptMsgControl(msg, 0, CMSG_CTRL_DECRYPT, &decryptPara);
2964 ok(ret, "CryptMsgControl failed: %08lx\n", GetLastError());
2965 check_param("enveloped bare message", msg, CMSG_CONTENT_PARAM, msgData, sizeof(msgData));
2967
2968 if (key)
2970 CryptReleaseContext(hCryptProv, 0);
2971
2975 value = 3;
2976 check_param("recipient count", msg, CMSG_RECIPIENT_COUNT_PARAM,
2977 (const BYTE *)&value, sizeof(value));
2978 size = 0;
2979 SetLastError(0xdeadbeef);
2982 "expected CRYPT_E_INVALID_INDEX, got %08lx\n", GetLastError());
2983 size = 0;
2984 SetLastError(0xdeadbeef);
2986 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
2987 ok(size >= 142, "unexpected size: %lu\n", size);
2988 if (ret)
2990 else
2991 buf = NULL;
2992 if (buf)
2993 {
2994 CERT_INFO *certInfo = (CERT_INFO *)buf;
2995
2996 SetLastError(0xdeadbeef);
2998 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
2999 ok(certInfo->SerialNumber.cbData == sizeof(serialNumber),
3000 "unexpected serial number size: %lu\n", certInfo->SerialNumber.cbData);
3002 sizeof(serialNumber)), "unexpected serial number\n");
3003 ok(certInfo->Issuer.cbData == sizeof(issuer),
3004 "unexpected issuer size: %lu\n", certInfo->Issuer.cbData);
3005 ok(!memcmp(certInfo->Issuer.pbData, issuer, sizeof(issuer)),
3006 "unexpected issuer\n");
3008 }
3010}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
BOOL WINAPI CryptDestroyKey(HCRYPTKEY hKey)
Definition: crypt.c:930
BOOL WINAPI CryptReleaseContext(HCRYPTPROV hProv, DWORD dwFlags)
Definition: crypt.c:648
BOOL WINAPI CryptAcquireContextA(HCRYPTPROV *phProv, LPCSTR pszContainer, LPCSTR pszProvider, DWORD dwProvType, DWORD dwFlags)
Definition: crypt.c:569
BOOL WINAPI CryptImportKey(HCRYPTPROV hProv, const BYTE *pbData, DWORD dwDataLen, HCRYPTKEY hPubKey, DWORD dwFlags, HCRYPTKEY *phKey)
Definition: crypt.c:1850
HCRYPTMSG WINAPI CryptMsgOpenToDecode(DWORD dwMsgEncodingType, DWORD dwFlags, DWORD dwMsgType, HCRYPTPROV_LEGACY hCryptProv, PCERT_INFO pRecipientInfo, PCMSG_STREAM_INFO pStreamInfo)
Definition: msg.c:3552
BOOL WINAPI CryptMsgControl(HCRYPTMSG hCryptMsg, DWORD dwFlags, DWORD dwCtrlType, const void *pvCtrlPara)
Definition: msg.c:3636
static WCHAR issuer[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1905
static BYTE serialNum[]
Definition: msg.c:1011
static const BYTE signedWithCertAndCrlComputedHash[]
Definition: msg.c:2589
static void compare_cms_signer_info(const CMSG_CMS_SIGNER_INFO *got, const CMSG_CMS_SIGNER_INFO *expected)
Definition: msg.c:2545
static const BYTE envelopedBareMessage[]
Definition: msg.c:2654
static const BYTE publicPrivateKeyPair[]
Definition: msg.c:2595
static const BYTE envelopedMessageWith3Recps[]
Definition: msg.c:2671
static const BYTE envelopedEmptyContent[]
Definition: msg.c:2156
static BYTE encodedCommonName[]
Definition: msg.c:1012
static const BYTE envelopedEmptyBareContent[]
Definition: msg.c:2152
static const BYTE hashContent[]
Definition: msg.c:879
static const BYTE signedWithCertAndCrlBareContent[]
Definition: msg.c:1481
static BYTE cert[]
Definition: msg.c:1374
static const BYTE signedContent[]
Definition: msg.c:1323
static const BYTE hashParam[]
Definition: msg.c:2524
static const BYTE signedKeyIdEmptyContent[]
Definition: msg.c:1340
static void compare_signer_info(const CMSG_SIGNER_INFO *got, const CMSG_SIGNER_INFO *expected)
Definition: msg.c:2527
static const BYTE serialNumber[]
Definition: msg.c:2714
static BYTE crl[]
Definition: msg.c:1432
static const BYTE hashEmptyContent[]
Definition: msg.c:870
static const BYTE envelopedMessage[]
Definition: msg.c:2636
static const BYTE emptyHashParam[]
Definition: msg.c:772
static BYTE keyIdIssuer[]
Definition: msg.c:2592
static char oid_rsa_md5[]
Definition: msg.c:32
int zero
Definition: sehframes.cpp:29
CERT_NAME_BLOB Issuer
Definition: wincrypt.h:253
CRYPT_INTEGER_BLOB SerialNumber
Definition: wincrypt.h:251
CRYPT_ALGORITHM_IDENTIFIER HashAlgorithm
Definition: wincrypt.h:4129
CRYPT_ALGORITHM_IDENTIFIER HashAlgorithm
Definition: wincrypt.h:884
Definition: copy.c:22
Definition: pdh_main.c:96
#define CMSG_VERSION_PARAM
Definition: wincrypt.h:4115
#define PROV_RSA_FULL
Definition: wincrypt.h:2243
#define CRYPT_VERIFYCONTEXT
Definition: wincrypt.h:2273
ULONG_PTR HCRYPTPROV
Definition: wincrypt.h:55
#define CERT_ID_KEY_IDENTIFIER
Definition: wincrypt.h:3839
#define CMSG_SIGNED_DATA_V3
Definition: wincrypt.h:4139
#define CMSG_CMS_SIGNER_INFO_PARAM
Definition: wincrypt.h:4124
#define CMSG_INNER_CONTENT_TYPE_PARAM
Definition: wincrypt.h:4093
#define CMSG_ENVELOPED
Definition: wincrypt.h:3846
#define CMSG_CTRL_DECRYPT
Definition: wincrypt.h:4035
#define CMSG_RECIPIENT_INFO_PARAM
Definition: wincrypt.h:4107
#define CMSG_SIGNER_INFO_PARAM
Definition: wincrypt.h:4095
#define CMSG_SIGNED
Definition: wincrypt.h:3845
#define CMSG_HASHED_DATA_V0
Definition: wincrypt.h:4148
#define CMSG_CRL_PARAM
Definition: wincrypt.h:4103
#define MS_ENHANCED_PROV_A
Definition: wincrypt.h:2125
#define CMSG_SIGNER_COUNT_PARAM
Definition: wincrypt.h:4094
#define szOID_RSA_data
Definition: wincrypt.h:3181
#define CMSG_HASH_DATA_PARAM
Definition: wincrypt.h:4109
ULONG_PTR HCRYPTKEY
Definition: wincrypt.h:58
#define CMSG_CERT_COUNT_PARAM
Definition: wincrypt.h:4100
#define CMSG_RECIPIENT_COUNT_PARAM
Definition: wincrypt.h:4105
#define CMSG_CRL_COUNT_PARAM
Definition: wincrypt.h:4102
#define CMSG_CERT_PARAM
Definition: wincrypt.h:4101
#define CRYPT_E_INVALID_INDEX
Definition: winerror.h:4406
#define CRYPT_E_ALREADY_DECRYPTED
Definition: winerror.h:4407
unsigned char BYTE
Definition: xxhash.c:193

Referenced by test_decode_msg().

◆ test_decode_msg_update()

static void test_decode_msg_update ( void  )
static

Definition at line 2216 of file msg.c.

2217{
2218 HCRYPTMSG msg;
2219 BOOL ret;
2220 CMSG_STREAM_INFO streamInfo = { 0 };
2221 DWORD i;
2222 struct update_accum accum = { 0, NULL };
2223
2225 /* Update with a full message in a final update */
2227 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
2228 /* Can't update after a final update */
2229 SetLastError(0xdeadbeef);
2232 "Expected CRYPT_E_MSG_ERROR, got %lx\n", GetLastError());
2234
2236 /* Can't send a non-final update without streaming */
2237 SetLastError(0xdeadbeef);
2239 FALSE);
2241 "Expected CRYPT_E_MSG_ERROR, got %lx\n", GetLastError());
2242 /* A subsequent final update succeeds */
2244 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
2246
2247 msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, &streamInfo);
2248 /* Updating a message that has a NULL stream callback fails */
2249 SetLastError(0xdeadbeef);
2251 todo_wine
2253 "Expected STATUS_ACCESS_VIOLATION, got %lx\n", GetLastError());
2254 /* Changing the callback pointer after the fact yields the same error (so
2255 * the message must copy the stream info, not just store a pointer to it)
2256 */
2258 SetLastError(0xdeadbeef);
2260 todo_wine
2262 "Expected STATUS_ACCESS_VIOLATION or STATUS_ILLEGAL_INSTRUCTION, got %lx\n", GetLastError());
2264
2265 /* Empty non-final updates are allowed when streaming.. */
2266 msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, &streamInfo);
2268 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
2269 /* but final updates aren't when not enough data has been received. */
2270 SetLastError(0xdeadbeef);
2271 ret = CryptMsgUpdate(msg, NULL, 0, TRUE);
2272 todo_wine
2274 "Expected CRYPT_E_STREAM_INSUFFICIENT_DATA, got %lx\n", GetLastError());
2276
2277 /* Updating the message byte by byte is legal */
2279 streamInfo.pvArg = &accum;
2280 msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, &streamInfo);
2281 for (i = 0, ret = TRUE; ret && i < sizeof(dataEmptyContent); i++)
2283 ok(ret, "CryptMsgUpdate failed on byte %ld: %lx\n", i, GetLastError());
2284 ret = CryptMsgUpdate(msg, NULL, 0, TRUE);
2285 ok(ret, "CryptMsgUpdate failed on byte %ld: %lx\n", i, GetLastError());
2287 todo_wine
2288 check_updates("byte-by-byte empty content", &a4, &accum);
2289 free_updates(&accum);
2290
2291 /* Decoding bogus content fails in non-streaming mode.. */
2293 SetLastError(0xdeadbeef);
2294 ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
2296 "Expected CRYPT_E_ASN1_BADTAG, got %lx\n",
2297 GetLastError());
2299 /* and as the final update in streaming mode.. */
2301 msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, &streamInfo);
2302 SetLastError(0xdeadbeef);
2303 ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
2305 "Expected CRYPT_E_ASN1_BADTAG, got %lx\n",
2306 GetLastError());
2308 /* and even as a non-final update in streaming mode. */
2310 msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, &streamInfo);
2311 SetLastError(0xdeadbeef);
2312 ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), FALSE);
2313 todo_wine
2315 "Expected CRYPT_E_ASN1_BADTAG, got %lx\n", GetLastError());
2317
2318 /* An empty message can be opened with undetermined type.. */
2321 TRUE);
2322 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
2324 /* but decoding it as an explicitly typed message fails. */
2326 NULL);
2327 SetLastError(0xdeadbeef);
2329 TRUE);
2331 "Expected CRYPT_E_ASN1_BADTAG, got %lx\n", GetLastError());
2333 /* On the other hand, decoding the bare content of an empty message fails
2334 * with unspecified type..
2335 */
2337 SetLastError(0xdeadbeef);
2339 sizeof(dataEmptyBareContent), TRUE);
2341 "Expected CRYPT_E_ASN1_BADTAG, got %lx\n", GetLastError());
2343 /* but succeeds with explicit type. */
2345 NULL);
2347 sizeof(dataEmptyBareContent), TRUE);
2348 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
2350
2351 /* Decoding valid content with an unsupported OID fails */
2353 SetLastError(0xdeadbeef);
2356 "Expected CRYPT_E_INVALID_MSG_TYPE, got %lx\n", GetLastError());
2358
2359 /* Similarly, opening an empty hash with unspecified type succeeds.. */
2361 SetLastError(0xdeadbeef);
2363 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
2365 /* while with specified type it fails. */
2367 NULL);
2368 SetLastError(0xdeadbeef);
2371 "Expected CRYPT_E_ASN1_BADTAG, got %lx\n", GetLastError());
2373 /* On the other hand, decoding the bare content of an empty hash message
2374 * fails with unspecified type..
2375 */
2377 SetLastError(0xdeadbeef);
2379 sizeof(hashEmptyBareContent), TRUE);
2381 "Expected CRYPT_E_ASN1_BADTAG, got %lx\n", GetLastError());
2383 /* but succeeds with explicit type. */
2385 NULL);
2387 sizeof(hashEmptyBareContent), TRUE);
2388 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
2390
2391 /* And again, opening a (non-empty) hash message with unspecified type
2392 * succeeds..
2393 */
2395 SetLastError(0xdeadbeef);
2397 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
2399 /* while with specified type it fails.. */
2401 NULL);
2402 SetLastError(0xdeadbeef);
2405 "Expected CRYPT_E_ASN1_BADTAG, got %lx\n", GetLastError());
2407 /* and decoding the bare content of a non-empty hash message fails with
2408 * unspecified type..
2409 */
2411 SetLastError(0xdeadbeef);
2414 "Expected CRYPT_E_ASN1_BADTAG, got %lx\n",
2415 GetLastError());
2417 /* but succeeds with explicit type. */
2419 NULL);
2421 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
2423
2424 /* Opening a (non-empty) hash message with unspecified type and a bogus
2425 * hash value succeeds..
2426 */
2428 SetLastError(0xdeadbeef);
2430 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
2432
2435 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
2438 SetLastError(0xdeadbeef);
2442 "Expected CRYPT_E_ASN1_BADTAG, got %08lx\n", GetLastError());
2445 NULL);
2448 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
2450
2452 NULL, NULL);
2453 /* The first update succeeds.. */
2455 sizeof(detachedSignedContent), TRUE);
2456 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
2457 /* as does a second (probably to update the detached portion).. */
2459 sizeof(detachedSignedContent), TRUE);
2460 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
2461 /* while a third fails. */
2463 sizeof(detachedSignedContent), TRUE);
2465 "expected CRYPT_E_MSG_ERROR, got %08lx\n", GetLastError());
2467
2470 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
2471 ret = CryptMsgUpdate(msg, NULL, 0, TRUE);
2472 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
2474 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
2475 ret = CryptMsgUpdate(msg, NULL, 0, TRUE);
2476 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
2477
2480 "expected CRYPT_E_MSG_ERROR, got %08lx\n", GetLastError());
2482
2484 NULL);
2485 SetLastError(0xdeadbeef);
2488 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
2490
2492 NULL);
2493 SetLastError(0xdeadbeef);
2495 sizeof(envelopedEmptyContent), TRUE);
2497 "expected CRYPT_E_ASN1_BADTAG, got %08lx\n", GetLastError());
2499
2501 SetLastError(0xdeadbeef);
2505 "expected CRYPT_E_ASN1_BADTAG, got %08lx\n", GetLastError());
2507
2509 SetLastError(0xdeadbeef);
2511 sizeof(envelopedEmptyContent), TRUE);
2512 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
2514
2516 NULL);
2517 SetLastError(0xdeadbeef);
2520 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
2522}
#define todo_wine
Definition: minitest.h:80
static const BYTE bogusOIDContent[]
Definition: msg.c:2190
static const BYTE hashEmptyBareContent[]
Definition: msg.c:867
static const BYTE hashBareContent[]
Definition: msg.c:874
static const BYTE bogusHashContent[]
Definition: msg.c:2193
static const BYTE envelopedBareContentWithoutData[]
Definition: msg.c:2199
static const BYTE detachedSignedContent[]
Definition: msg.c:1298
static const struct update_accum a4
Definition: msg.c:2188
#define CMSG_HASHED
Definition: wincrypt.h:3848
#define CRYPT_E_STREAM_INSUFFICIENT_DATA
Definition: winerror.h:4415
#define CRYPT_E_ASN1_BADTAG
Definition: winerror.h:4510

Referenced by test_decode_msg().

◆ test_enveloped_msg()

static void test_enveloped_msg ( void  )
static

Definition at line 2180 of file msg.c.

2181{
2185}
static void test_enveloped_msg_encoding(void)
Definition: msg.c:2162
static void test_enveloped_msg_update(void)
Definition: msg.c:2053
static void test_enveloped_msg_open(void)
Definition: msg.c:1997

Referenced by START_TEST().

◆ test_enveloped_msg_encoding()

static void test_enveloped_msg_encoding ( void  )
static

Definition at line 2162 of file msg.c.

2163{
2164 HCRYPTMSG msg;
2165 CMSG_ENVELOPED_ENCODE_INFO envelopedInfo = { sizeof(envelopedInfo), 0,
2166 { oid_rsa_rc4, { 0, NULL } }, NULL };
2167
2168 SetLastError(0xdeadbeef);
2170 &envelopedInfo, NULL, NULL);
2171 ok(msg != NULL, "CryptMsgOpenToEncode failed: %08lx\n", GetLastError());
2172 check_param("enveloped empty bare content", msg,
2175 check_param("enveloped empty content", msg, CMSG_CONTENT_PARAM,
2178}
static char oid_rsa_rc4[]
Definition: msg.c:1995

Referenced by test_enveloped_msg().

◆ test_enveloped_msg_open()

static void test_enveloped_msg_open ( void  )
static

Definition at line 1997 of file msg.c.

1998{
1999 HCRYPTMSG msg;
2000 BOOL ret;
2001 CMSG_ENVELOPED_ENCODE_INFO envelopedInfo = { 0 };
2003
2004 SetLastError(0xdeadbeef);
2006 &envelopedInfo, NULL, NULL);
2008 "expected E_INVALIDARG, got %08lx\n", GetLastError());
2009
2010 envelopedInfo.cbSize = sizeof(envelopedInfo);
2011 SetLastError(0xdeadbeef);
2013 &envelopedInfo, NULL, NULL);
2015 "expected CRYPT_E_UNKNOWN_ALGO, got %08lx\n", GetLastError());
2016
2018 SetLastError(0xdeadbeef);
2020 &envelopedInfo, NULL, NULL);
2021 ok(msg != NULL, "CryptMsgOpenToEncode failed: %08lx\n", GetLastError());
2023
2024 envelopedInfo.cRecipients = 1;
2025 SetLastError(0xdeadbeef);
2027 &envelopedInfo, NULL, NULL);
2029 "expected E_INVALIDARG, got %08lx\n", GetLastError());
2030
2033
2034 envelopedInfo.rgpRecipientCert = (PCERT_INFO *)&context->pCertInfo;
2035 SetLastError(0xdeadbeef);
2037 &envelopedInfo, NULL, NULL);
2038 ok(msg != NULL, "CryptMsgOpenToEncode failed: %08lx\n", GetLastError());
2040 SetLastError(0xdeadbeef);
2041 ret = CryptAcquireContextA(&envelopedInfo.hCryptProv, NULL, NULL,
2043 ok(ret, "CryptAcquireContextA failed: %08lx\n", GetLastError());
2044 SetLastError(0xdeadbeef);
2046 &envelopedInfo, NULL, NULL);
2047 ok(msg != NULL, "CryptMsgOpenToEncode failed: %08lx\n", GetLastError());
2049 CryptReleaseContext(envelopedInfo.hCryptProv, 0);
2051}
BOOL WINAPI CertFreeCertificateContext(PCCERT_CONTEXT pCertContext)
Definition: cert.c:371
PCCERT_CONTEXT WINAPI CertCreateCertificateContext(DWORD dwCertEncodingType, const BYTE *pbCertEncoded, DWORD cbCertEncoded)
Definition: cert.c:316
static BYTE v1CertWithValidPubKey[]
Definition: msg.c:1522
HCRYPTPROV_LEGACY hCryptProv
Definition: wincrypt.h:3984
PCERT_INFO * rgpRecipientCert
Definition: wincrypt.h:3988
CRYPT_ALGORITHM_IDENTIFIER ContentEncryptionAlgorithm
Definition: wincrypt.h:3985
Definition: http.c:7252
#define X509_ASN_ENCODING
Definition: wincrypt.h:2501
#define CRYPT_E_UNKNOWN_ALGO
Definition: winerror.h:4400

Referenced by test_enveloped_msg().

◆ test_enveloped_msg_update()

static void test_enveloped_msg_update ( void  )
static

Definition at line 2053 of file msg.c.

2054{
2055 HCRYPTMSG msg;
2056 BOOL ret;
2057 CMSG_ENVELOPED_ENCODE_INFO envelopedInfo = { sizeof(envelopedInfo), 0,
2058 { oid_rsa_rc4, { 0, NULL } }, NULL };
2059 CMSG_STREAM_INFO streamInfo = { 0, nop_stream_output, NULL };
2060
2061 SetLastError(0xdeadbeef);
2063 &envelopedInfo, NULL, NULL);
2064 ok(msg != NULL, "CryptMsgOpenToEncode failed: %08lx\n", GetLastError());
2065
2066 SetLastError(0xdeadbeef);
2069 "expected CRYPT_E_MSG_ERROR, got %08lx\n", GetLastError());
2070 SetLastError(0xdeadbeef);
2071 ret = CryptMsgUpdate(msg, NULL, 0, TRUE);
2072 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
2073 SetLastError(0xdeadbeef);
2074 ret = CryptMsgUpdate(msg, NULL, 0, TRUE);
2076 "expected CRYPT_E_MSG_ERROR, got %08lx\n", GetLastError());
2078
2079 SetLastError(0xdeadbeef);
2081 &envelopedInfo, NULL, NULL);
2082 ok(msg != NULL, "CryptMsgOpenToEncode failed: %08lx\n", GetLastError());
2083
2084 SetLastError(0xdeadbeef);
2085 ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), FALSE);
2087 "expected CRYPT_E_MSG_ERROR, got %08lx\n", GetLastError());
2088 SetLastError(0xdeadbeef);
2089 ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
2090 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
2091 SetLastError(0xdeadbeef);
2092 ret = CryptMsgUpdate(msg, NULL, 0, TRUE);
2094 "expected CRYPT_E_MSG_ERROR, got %08lx\n", GetLastError());
2096
2097 SetLastError(0xdeadbeef);
2099 CMSG_ENVELOPED, &envelopedInfo, NULL, NULL);
2100 ok(msg != NULL, "CryptMsgOpenToEncode failed: %08lx\n", GetLastError());
2101
2102 SetLastError(0xdeadbeef);
2105 "expected E_INVALIDARG, got %08lx\n", GetLastError());
2106 SetLastError(0xdeadbeef);
2107 ret = CryptMsgUpdate(msg, NULL, 0, TRUE);
2108 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
2110
2111 SetLastError(0xdeadbeef);
2113 CMSG_ENVELOPED, &envelopedInfo, NULL, NULL);
2114 ok(msg != NULL, "CryptMsgOpenToEncode failed: %08lx\n", GetLastError());
2115
2116 SetLastError(0xdeadbeef);
2117 ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), FALSE);
2119 "expected E_INVALIDARG, got %08lx\n", GetLastError());
2120 SetLastError(0xdeadbeef);
2121 ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
2122 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
2124
2125 SetLastError(0xdeadbeef);
2127 &envelopedInfo, NULL, &streamInfo);
2128 ok(msg != NULL, "CryptMsgOpenToEncode failed: %08lx\n", GetLastError());
2129
2130 SetLastError(0xdeadbeef);
2132 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
2133 SetLastError(0xdeadbeef);
2134 ret = CryptMsgUpdate(msg, NULL, 0, TRUE);
2135 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
2137
2138 SetLastError(0xdeadbeef);
2140 &envelopedInfo, NULL, &streamInfo);
2141 ok(msg != NULL, "CryptMsgOpenToEncode failed: %08lx\n", GetLastError());
2142
2143 SetLastError(0xdeadbeef);
2144 ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), FALSE);
2145 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
2146 SetLastError(0xdeadbeef);
2147 ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
2148 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
2150}

Referenced by test_enveloped_msg().

◆ test_hash_msg()

static void test_hash_msg ( void  )
static

Definition at line 1001 of file msg.c.

1002{
1007}
static void test_hash_msg_update(void)
Definition: msg.c:711
static void test_hash_msg_get_param(void)
Definition: msg.c:776
static void test_hash_msg_encoding(void)
Definition: msg.c:907
static void test_hash_msg_open(void)
Definition: msg.c:679

Referenced by START_TEST().

◆ test_hash_msg_encoding()

static void test_hash_msg_encoding ( void  )
static

Definition at line 907 of file msg.c.

908{
910 CMSG_HASHED_ENCODE_INFO hashInfo = { sizeof(hashInfo), 0 };
911 BOOL ret;
912 struct update_accum accum = { 0, NULL }, empty_accum = { 0, NULL };
913 CMSG_STREAM_INFO streamInfo = { 0, accumulating_stream_output, &accum };
914
917 NULL, NULL);
918 check_param("hash empty bare content", msg, CMSG_BARE_CONTENT_PARAM,
920 check_param("hash empty content", msg, CMSG_CONTENT_PARAM,
923 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
924 check_param("hash bare content", msg, CMSG_BARE_CONTENT_PARAM,
926 check_param("hash content", msg, CMSG_CONTENT_PARAM,
927 hashContent, sizeof(hashContent));
929 /* Same test, but with CMSG_BARE_CONTENT_FLAG set */
931 CMSG_HASHED, &hashInfo, NULL, NULL);
932 check_param("hash empty bare content", msg, CMSG_BARE_CONTENT_PARAM,
934 check_param("hash empty content", msg, CMSG_CONTENT_PARAM,
937 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
938 check_param("hash bare content", msg, CMSG_BARE_CONTENT_PARAM,
940 check_param("hash content", msg, CMSG_CONTENT_PARAM,
941 hashContent, sizeof(hashContent));
943 /* Same test, but with CMSG_DETACHED_FLAG set */
945 CMSG_HASHED, &hashInfo, NULL, NULL);
946 check_param("detached hash empty bare content", msg,
948 sizeof(hashEmptyBareContent));
949 check_param("detached hash empty content", msg, CMSG_CONTENT_PARAM,
952 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
953 check_param("detached hash not final bare content", msg,
956 check_param("detached hash not final content", msg, CMSG_CONTENT_PARAM,
959 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
960 check_param("detached hash bare content", msg, CMSG_BARE_CONTENT_PARAM,
962 check_param("detached hash content", msg, CMSG_CONTENT_PARAM,
964 check_param("detached hash bare content", msg, CMSG_BARE_CONTENT_PARAM,
966 check_param("detached hash content", msg, CMSG_CONTENT_PARAM,
969 /* In what appears to be a bug, streamed updates to hash messages don't
970 * call the output function.
971 */
973 NULL, &streamInfo);
975 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
977 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
979 check_updates("empty hash message", &empty_accum, &accum);
980 free_updates(&accum);
981
982 streamInfo.cbContent = sizeof(msgData);
984 NULL, &streamInfo);
986 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
988 check_updates("hash message", &empty_accum, &accum);
989 free_updates(&accum);
990
991 streamInfo.cbContent = sizeof(msgData);
993 CMSG_HASHED, &hashInfo, NULL, &streamInfo);
995 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
997 check_updates("detached hash message", &empty_accum, &accum);
998 free_updates(&accum);
999}
static const BYTE detachedHashContent[]
Definition: msg.c:900
static const BYTE detachedHashBareContent[]
Definition: msg.c:895
static const BYTE detachedHashNonFinalBareContent[]
Definition: msg.c:886
static const BYTE detachedHashNonFinalContent[]
Definition: msg.c:890
CRYPT_ALGORITHM_IDENTIFIER HashAlgorithm
Definition: wincrypt.h:4014

Referenced by test_hash_msg().

◆ test_hash_msg_get_param()

static void test_hash_msg_get_param ( void  )
static

Definition at line 776 of file msg.c.

777{
779 BOOL ret;
780 CMSG_HASHED_ENCODE_INFO hashInfo = { sizeof(hashInfo), 0,
781 { oid_rsa_md5, { 0, NULL } }, NULL };
783 CMSG_STREAM_INFO streamInfo = { 0, nop_stream_output, NULL };
784 BYTE buf[16];
785
787 NULL, NULL);
788 /* Content and bare content are always gettable for non-streamed messages */
789 size = 0;
791 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
792 size = 0;
794 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
795 /* For an encoded hash message, the hash data aren't available */
796 SetLastError(0xdeadbeef);
799 "Expected CRYPT_E_INVALID_MSG_TYPE, got %08lx\n",
800 GetLastError());
801 /* The hash is also available. */
802 size = 0;
804 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
805 ok(size == sizeof(buf), "Unexpected size %ld\n", size);
807 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
808 ok(size == sizeof(buf), "Unexpected size %ld\n", size);
809 if (size == sizeof(buf))
810 ok(!memcmp(buf, emptyHashParam, size), "Unexpected value\n");
811 /* By getting the hash, further updates are not allowed */
812 SetLastError(0xdeadbeef);
815 "Expected CRYPT_E_MSG_ERROR, got 0x%lx\n", GetLastError());
816
817 /* Even after a final update, the hash data aren't available */
818 SetLastError(0xdeadbeef);
821 "Expected CRYPT_E_INVALID_MSG_TYPE, got %08lx\n", GetLastError());
822 /* The version is also available, and should be zero for this message. */
823 size = 0;
825 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
826 size = sizeof(value);
828 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
829 if (ret)
830 ok(value == 0, "Expected version 0, got %ld\n", value);
831 /* As usual, the type isn't available. */
833 ok(!ret, "Expected failure\n");
835
837 NULL, &streamInfo);
838 /* Streamed messages don't allow you to get the content or bare content. */
839 SetLastError(0xdeadbeef);
842 "Expected E_INVALIDARG, got %lx\n", GetLastError());
843 SetLastError(0xdeadbeef);
846 "Expected E_INVALIDARG, got %lx\n", GetLastError());
847 /* The hash is still available. */
848 size = 0;
850 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
851 ok(size == sizeof(buf), "Unexpected size %ld\n", size);
853 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
854 if (size == sizeof(buf))
855 ok(!memcmp(buf, emptyHashParam, size), "Unexpected value\n");
856 /* After updating the hash, further updates aren't allowed on streamed
857 * messages either.
858 */
859 SetLastError(0xdeadbeef);
862 "Expected CRYPT_E_MSG_ERROR, got 0x%lx\n", GetLastError());
863
865}
#define NTE_BAD_HASH_STATE
Definition: winerror.h:4259

Referenced by test_hash_msg().

◆ test_hash_msg_open()

static void test_hash_msg_open ( void  )
static

Definition at line 679 of file msg.c.

680{
682 CMSG_HASHED_ENCODE_INFO hashInfo = { 0 };
683 CMSG_STREAM_INFO streamInfo = { 0, nop_stream_output, NULL };
684
685 SetLastError(0xdeadbeef);
687 NULL, NULL);
689 "Expected E_INVALIDARG, got %lx\n", GetLastError());
690 hashInfo.cbSize = sizeof(hashInfo);
691 SetLastError(0xdeadbeef);
693 NULL, NULL);
695 "Expected CRYPT_E_UNKNOWN_ALGO, got %lx\n", GetLastError());
698 NULL, NULL);
699 ok(msg != NULL, "CryptMsgOpenToEncode failed: %lx\n", GetLastError());
702 CMSG_HASHED, &hashInfo, NULL, NULL);
703 ok(msg != NULL, "CryptMsgOpenToEncode failed: %lx\n", GetLastError());
706 CMSG_HASHED, &hashInfo, NULL, &streamInfo);
707 ok(msg != NULL, "CryptMsgOpenToEncode failed: %lx\n", GetLastError());
709}

Referenced by test_hash_msg().

◆ test_hash_msg_update()

static void test_hash_msg_update ( void  )
static

Definition at line 711 of file msg.c.

712{
714 BOOL ret;
715 CMSG_HASHED_ENCODE_INFO hashInfo = { sizeof(hashInfo), 0,
716 { oid_rsa_md5, { 0, NULL } }, NULL };
717 CMSG_STREAM_INFO streamInfo = { 0, nop_stream_output, NULL };
718
720 CMSG_HASHED, &hashInfo, NULL, NULL);
721 /* Detached hashed messages opened in non-streaming mode allow non-final
722 * updates..
723 */
725 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
726 /* including non-final updates with no data.. */
728 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
729 /* and final updates with no data. */
731 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
732 /* But no updates are allowed after the final update. */
733 SetLastError(0xdeadbeef);
736 "Expected CRYPT_E_MSG_ERROR, got %lx\n", GetLastError());
737 SetLastError(0xdeadbeef);
740 "Expected CRYPT_E_MSG_ERROR, got %lx\n", GetLastError());
742 /* Non-detached messages, in contrast, don't allow non-final updates in
743 * non-streaming mode.
744 */
746 NULL, NULL);
747 SetLastError(0xdeadbeef);
750 "Expected CRYPT_E_MSG_ERROR, got %lx\n", GetLastError());
751 /* Final updates (including empty ones) are allowed. */
753 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
755 /* And, of course, streaming mode allows non-final updates */
757 NULL, &streamInfo);
759 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
761 /* Setting pfnStreamOutput to NULL results in no error. (In what appears
762 * to be a bug, it isn't actually used - see encoding tests.)
763 */
764 streamInfo.pfnStreamOutput = NULL;
766 NULL, &streamInfo);
768 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
770}

Referenced by test_hash_msg().

◆ test_msg_close()

static void test_msg_close ( void  )
static

Definition at line 248 of file msg.c.

249{
250 BOOL ret;
252
253 /* NULL succeeds.. */
255 ok(ret, "CryptMsgClose failed: %lx\n", GetLastError());
256 /* but an arbitrary pointer crashes. */
257 if (0)
260 NULL);
261 ok(msg != NULL, "CryptMsgOpenToEncode failed: %lx\n", GetLastError());
263 ok(ret, "CryptMsgClose failed: %lx\n", GetLastError());
264}

Referenced by START_TEST().

◆ test_msg_control()

static void test_msg_control ( void  )
static

Definition at line 3029 of file msg.c.

3030{
3031 static char oid_rsa_rsa[] = szOID_RSA_RSA;
3032 BOOL ret;
3033 HCRYPTMSG msg;
3034 DWORD i;
3035 CERT_INFO certInfo = { 0 };
3036 CMSG_HASHED_ENCODE_INFO hashInfo = { 0 };
3037 CMSG_SIGNED_ENCODE_INFO signInfo = { sizeof(signInfo), 0 };
3038 CMSG_CTRL_DECRYPT_PARA decryptPara = { sizeof(decryptPara), 0 };
3039
3040 /* Crashes
3041 ret = CryptMsgControl(NULL, 0, 0, NULL);
3042 */
3043
3044 /* Data encode messages don't allow any sort of control.. */
3046 NULL);
3047 /* either with no prior update.. */
3048 for (i = 1; i <= CMSG_CTRL_ADD_CMS_SIGNER_INFO; i++)
3049 {
3050 SetLastError(0xdeadbeef);
3051 ret = CryptMsgControl(msg, 0, i, NULL);
3053 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
3054 }
3055 ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
3056 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
3057 /* or after an update. */
3058 for (i = 1; i <= CMSG_CTRL_ADD_CMS_SIGNER_INFO; i++)
3059 {
3060 SetLastError(0xdeadbeef);
3061 ret = CryptMsgControl(msg, 0, i, NULL);
3063 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
3064 }
3066
3067 /* Hash encode messages don't allow any sort of control.. */
3068 hashInfo.cbSize = sizeof(hashInfo);
3071 NULL, NULL);
3072 /* either with no prior update.. */
3073 for (i = 1; i <= CMSG_CTRL_ADD_CMS_SIGNER_INFO; i++)
3074 {
3075 SetLastError(0xdeadbeef);
3076 ret = CryptMsgControl(msg, 0, i, NULL);
3078 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
3079 }
3080 ret = CryptMsgUpdate(msg, NULL, 0, TRUE);
3081 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
3082 /* or after an update. */
3083 for (i = 1; i <= CMSG_CTRL_ADD_CMS_SIGNER_INFO; i++)
3084 {
3085 SetLastError(0xdeadbeef);
3086 ret = CryptMsgControl(msg, 0, i, NULL);
3088 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
3089 }
3091
3092 /* Signed encode messages likewise don't allow any sort of control.. */
3093 signInfo.cbSize = sizeof(signInfo);
3095 NULL, NULL);
3096 /* either before an update.. */
3097 for (i = 1; i <= CMSG_CTRL_ADD_CMS_SIGNER_INFO; i++)
3098 {
3099 SetLastError(0xdeadbeef);
3100 ret = CryptMsgControl(msg, 0, i, NULL);
3102 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
3103 }
3104 ret = CryptMsgUpdate(msg, NULL, 0, TRUE);
3105 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
3106 /* or after an update. */
3107 for (i = 1; i <= CMSG_CTRL_ADD_CMS_SIGNER_INFO; i++)
3108 {
3109 SetLastError(0xdeadbeef);
3110 ret = CryptMsgControl(msg, 0, i, NULL);
3112 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
3113 }
3115
3116 /* Decode messages behave a bit differently. */
3118 /* Bad control type */
3119 SetLastError(0xdeadbeef);
3120 ret = CryptMsgControl(msg, 0, 0, NULL);
3122 "Expected CRYPT_E_CONTROL_TYPE, got %08lx\n", GetLastError());
3123 SetLastError(0xdeadbeef);
3124 ret = CryptMsgControl(msg, 1, 0, NULL);
3126 "Expected CRYPT_E_CONTROL_TYPE, got %08lx\n", GetLastError());
3127 /* Can't verify the hash of an indeterminate-type message */
3128 SetLastError(0xdeadbeef);
3131 "Expected CRYPT_E_INVALID_MSG_TYPE, got %08lx\n", GetLastError());
3132 /* Crashes
3133 ret = CryptMsgControl(msg, 0, CMSG_CTRL_DECRYPT, NULL);
3134 */
3135 /* Can't decrypt an indeterminate-type message */
3136 ret = CryptMsgControl(msg, 0, CMSG_CTRL_DECRYPT, &decryptPara);
3138 "Expected CRYPT_E_INVALID_MSG_TYPE, got %08lx\n", GetLastError());
3140
3142 /* Can't verify the hash of an empty message */
3143 SetLastError(0xdeadbeef);
3145 todo_wine
3147 "Expected STATUS_ACCESS_VIOLATION, got %08lx\n", GetLastError());
3148 /* Crashes
3149 ret = CryptMsgControl(msg, 0, CMSG_CTRL_VERIFY_SIGNATURE, NULL);
3150 */
3151 /* Can't verify the signature of a hash message */
3154 "Expected CRYPT_E_INVALID_MSG_TYPE, got %08lx\n", GetLastError());
3157 ok(!ret, "Expected failure\n");
3159
3161 NULL);
3164 ok(ret, "CryptMsgControl failed: %08lx\n", GetLastError());
3165 /* Can't decrypt an indeterminate-type message */
3166 SetLastError(0xdeadbeef);
3167 ret = CryptMsgControl(msg, 0, CMSG_CTRL_DECRYPT, &decryptPara);
3169 "Expected CRYPT_E_INVALID_MSG_TYPE, got %08lx\n", GetLastError());
3171
3173 NULL, NULL);
3174 /* Can't verify the hash of a detached message before it's been updated. */
3175 SetLastError(0xdeadbeef);
3178 "Expected CRYPT_E_INVALID_MSG_TYPE, got %08lx\n", GetLastError());
3180 TRUE);
3181 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
3182 /* Still can't verify the hash of a detached message with the content
3183 * of the detached hash given..
3184 */
3185 SetLastError(0xdeadbeef);
3188 "Expected CRYPT_E_HASH_VALUE, got %08lx\n", GetLastError());
3189 /* and giving the content of the message after attempting to verify the
3190 * hash fails.
3191 */
3192 SetLastError(0xdeadbeef);
3193 ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
3194 todo_wine
3195 ok(!ret && (GetLastError() == NTE_BAD_HASH_STATE || GetLastError() == CRYPT_E_MSG_ERROR), /* Vista */
3196 "Expected NTE_BAD_HASH_STATE or NTE_BAD_ALGID or CRYPT_E_MSG_ERROR, "
3197 "got %08lx\n", GetLastError());
3199
3200 /* Finally, verifying the hash of a detached message in the correct order:
3201 * 1. Update with the detached hash message
3202 * 2. Update with the content of the message
3203 * 3. Verifying the hash of the message
3204 * succeeds.
3205 */
3207 NULL, NULL);
3209 TRUE);
3210 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
3211 ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
3212 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
3213 SetLastError(0xdeadbeef);
3215 ok(ret, "CryptMsgControl failed: %08lx\n", GetLastError());
3217
3219 NULL);
3220 /* Can't verify the hash of a signed message */
3221 SetLastError(0xdeadbeef);
3224 "Expected CRYPT_E_INVALID_MSG_TYPE, got %08lx\n", GetLastError());
3225 /* Can't decrypt a signed message */
3226 SetLastError(0xdeadbeef);
3227 ret = CryptMsgControl(msg, 0, CMSG_CTRL_DECRYPT, &decryptPara);
3229 "Expected CRYPT_E_INVALID_MSG_TYPE, got %08lx\n", GetLastError());
3230 /* Crash
3231 ret = CryptMsgControl(msg, 0, CMSG_CTRL_VERIFY_SIGNATURE, NULL);
3232 ret = CryptMsgControl(msg, 0, CMSG_CTRL_VERIFY_SIGNATURE, &certInfo);
3233 */
3236 /* With an empty cert info, the signer can't be found in the message (and
3237 * the signature can't be verified.
3238 */
3239 SetLastError(0xdeadbeef);
3242 "Expected CRYPT_E_SIGNER_NOT_FOUND, got %08lx\n", GetLastError());
3243 /* The cert info is expected to have an issuer, serial number, and public
3244 * key info set.
3245 */
3246 certInfo.SerialNumber.cbData = sizeof(serialNum);
3247 certInfo.SerialNumber.pbData = serialNum;
3248 certInfo.Issuer.cbData = sizeof(encodedCommonName);
3249 certInfo.Issuer.pbData = encodedCommonName;
3250 SetLastError(0xdeadbeef);
3253 "Expected CRYPT_E_ASN1_EOD, got %08lx\n", GetLastError());
3255 /* This cert has a public key, but it's not in a usable form */
3257 NULL);
3260 if (ret)
3261 {
3262 /* Again, cert info needs to have a public key set */
3263 SetLastError(0xdeadbeef);
3265 ok(!ret &&
3267 GetLastError() == TRUST_E_NOSIGNATURE /* Vista */),
3268 "Expected CRYPT_E_ASN1_EOD or TRUST_E_NOSIGNATURE, got %08lx\n", GetLastError());
3269 /* The public key is supposed to be in encoded form.. */
3270 certInfo.SubjectPublicKeyInfo.Algorithm.pszObjId = oid_rsa_rsa;
3271 certInfo.SubjectPublicKeyInfo.PublicKey.cbData = sizeof(aKey);
3273 SetLastError(0xdeadbeef);
3275 ok(!ret &&
3277 GetLastError() == TRUST_E_NOSIGNATURE /* Vista */),
3278 "Expected CRYPT_E_ASN1_BADTAG or TRUST_E_NOSIGNATURE, got %08lx\n", GetLastError());
3279 /* but not as a X509_PUBLIC_KEY_INFO.. */
3283 SetLastError(0xdeadbeef);
3285 ok(!ret &&
3287 GetLastError() == TRUST_E_NOSIGNATURE /* Vista */),
3288 "Expected CRYPT_E_ASN1_BADTAG or TRUST_E_NOSIGNATURE, got %08lx\n", GetLastError());
3289 /* This decodes successfully, but it doesn't match any key in the message */
3292 SetLastError(0xdeadbeef);
3294 /* In Wine's rsaenh, this fails to decode because the key length is too
3295 * small. Not sure if that's a bug in rsaenh, so leaving todo_wine for
3296 * now.
3297 */
3298 todo_wine
3299 ok(!ret &&
3301 GetLastError() == TRUST_E_NOSIGNATURE /* Vista */),
3302 "Expected NTE_BAD_SIGNATURE or TRUST_E_NOSIGNATURE, got %08lx\n", GetLastError());
3303 }
3305 /* A message with no data doesn't have a valid signature */
3309 if (ret)
3310 {
3311 certInfo.SubjectPublicKeyInfo.Algorithm.pszObjId = oid_rsa_rsa;
3312 certInfo.SubjectPublicKeyInfo.PublicKey.cbData = sizeof(pubKey);
3314 SetLastError(0xdeadbeef);
3316 ok(!ret &&
3318 GetLastError() == TRUST_E_NOSIGNATURE /* Vista */),
3319 "Expected NTE_BAD_SIGNATURE or TRUST_E_NOSIGNATURE, got %08lx\n", GetLastError());
3320 }
3322 /* Finally, this succeeds */
3327 ok(ret, "CryptMsgControl failed: %08lx\n", GetLastError());
3329
3330 /* Test verifying signature of a detached signed message */
3332 NULL, NULL);
3334 sizeof(detachedSignedContent), TRUE);
3335 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
3336 /* Can't verify the sig without having updated the data */
3337 SetLastError(0xdeadbeef);
3340 "expected NTE_BAD_SIGNATURE, got %08lx\n",
3341 GetLastError());
3342 /* Now that the signature's been checked, can't do the final update */
3343 SetLastError(0xdeadbeef);
3344 ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
3345 todo_wine
3346 ok(!ret && (GetLastError() == NTE_BAD_HASH_STATE || GetLastError() == CRYPT_E_MSG_ERROR), /* Vista */
3347 "expected NTE_BAD_HASH_STATE or CRYPT_E_MSG_ERROR, got %08lx\n", GetLastError());
3349 /* Updating with the detached portion of the message and the data of the
3350 * the message allows the sig to be verified.
3351 */
3353 NULL, NULL);
3355 sizeof(detachedSignedContent), TRUE);
3356 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
3357 ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
3358 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
3360 ok(ret, "CryptMsgControl failed: %08lx\n", GetLastError());
3362
3364 NULL);
3365 decryptPara.cbSize = 0;
3366 SetLastError(0xdeadbeef);
3367 ret = CryptMsgControl(msg, 0, CMSG_CTRL_DECRYPT, &decryptPara);
3369 "expected E_INVALIDARG, got %08lx\n", GetLastError());
3370 decryptPara.cbSize = sizeof(decryptPara);
3371
3372 SetLastError(0xdeadbeef);
3373 ret = CryptMsgControl(msg, 0, CMSG_CTRL_DECRYPT, &decryptPara);
3375 "expected CRYPT_E_INVALID_MSG_TYPE, got %08lx\n", GetLastError());
3376
3377 SetLastError(0xdeadbeef);
3380 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
3381 SetLastError(0xdeadbeef);
3382 ret = CryptMsgControl(msg, 0, CMSG_CTRL_DECRYPT, &decryptPara);
3384 "expected CRYPT_E_INVALID_INDEX, got %08lx\n", GetLastError());
3386
3388 NULL);
3389 SetLastError(0xdeadbeef);
3391 sizeof(envelopedBareMessage), TRUE);
3392 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
3393 SetLastError(0xdeadbeef);
3394 ret = CryptMsgControl(msg, 0, CMSG_CTRL_DECRYPT, &decryptPara);
3396 "expected ERROR_INVALID_PARAMETER, got %08lx\n", GetLastError());
3398}
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
static BYTE pubKey[]
Definition: msg.c:1147
static BYTE mod_encoded[]
Definition: msg.c:3025
static const BYTE signedWithCertWithPubKeyBareContent[]
Definition: msg.c:1505
static const BYTE signedWithCertBareContent[]
Definition: msg.c:1411
static const BYTE signedWithCertWithValidPubKeyEmptyContent[]
Definition: msg.c:1537
static BYTE aKey[]
Definition: msg.c:3018
static BYTE encodedPubKey[]
Definition: msg.c:3020
static const BYTE signedWithCertWithValidPubKeyContent[]
Definition: msg.c:1560
CERT_PUBLIC_KEY_INFO SubjectPublicKeyInfo
Definition: wincrypt.h:257
CRYPT_BIT_BLOB PublicKey
Definition: wincrypt.h:235
CRYPT_ALGORITHM_IDENTIFIER Algorithm
Definition: wincrypt.h:234
BYTE * pbData
Definition: wincrypt.h:206
#define CMSG_CTRL_VERIFY_HASH
Definition: wincrypt.h:4036
#define CMSG_CTRL_ADD_CMS_SIGNER_INFO
Definition: wincrypt.h:4051
#define szOID_RSA_RSA
Definition: wincrypt.h:3168
#define CMSG_CTRL_VERIFY_SIGNATURE
Definition: wincrypt.h:4034
#define CRYPT_E_HASH_VALUE
Definition: winerror.h:4405
#define TRUST_E_NOSIGNATURE
Definition: winerror.h:4630
#define NTE_BAD_SIGNATURE
Definition: winerror.h:4253
#define CRYPT_E_SIGNER_NOT_FOUND
Definition: winerror.h:4412
#define CRYPT_E_CONTROL_TYPE
Definition: winerror.h:4410
#define CRYPT_E_ASN1_EOD
Definition: winerror.h:4501

Referenced by START_TEST().

◆ test_msg_get_and_verify_signer()

static void test_msg_get_and_verify_signer ( void  )
static

Definition at line 3400 of file msg.c.

3401{
3402 BOOL ret;
3403 HCRYPTMSG msg;
3404 PCCERT_CONTEXT signer;
3405 DWORD signerIndex;
3406 HCERTSTORE store;
3407
3408 /* Crash */
3409 if (0)
3410 {
3412 CryptMsgGetAndVerifySigner(NULL, 0, NULL, 0, NULL, &signerIndex);
3413 }
3414
3416 /* An empty message has no signer */
3417 SetLastError(0xdeadbeef);
3420 "expected CRYPT_E_NO_TRUSTED_SIGNER, got 0x%08lx\n", GetLastError());
3421 /* The signer is cleared on error */
3422 signer = (PCCERT_CONTEXT)0xdeadbeef;
3423 SetLastError(0xdeadbeef);
3424 ret = CryptMsgGetAndVerifySigner(msg, 0, NULL, 0, &signer, NULL);
3426 "expected CRYPT_E_NO_TRUSTED_SIGNER, got 0x%08lx\n", GetLastError());
3427 ok(!signer, "expected signer to be NULL\n");
3428 /* The signer index is also cleared on error */
3429 signerIndex = 0xdeadbeef;
3430 SetLastError(0xdeadbeef);
3431 ret = CryptMsgGetAndVerifySigner(msg, 0, NULL, 0, NULL, &signerIndex);
3433 "expected CRYPT_E_NO_TRUSTED_SIGNER, got 0x%08lx\n", GetLastError());
3434 ok(!signerIndex, "expected 0, got %ld\n", signerIndex);
3435 /* An unsigned message (msgData isn't a signed message at all)
3436 * likewise has no signer.
3437 */
3439 SetLastError(0xdeadbeef);
3442 "expected CRYPT_E_NO_TRUSTED_SIGNER, got 0x%08lx\n", GetLastError());
3444
3446 /* A "signed" message created with no signer cert likewise has no signer */
3448 if (ret)
3449 {
3452 "expected CRYPT_E_NO_TRUSTED_SIGNER, got 0x%08lx\n", GetLastError());
3453 }
3455
3457 /* A signed message succeeds, .. */
3461 ok(ret, "CryptMsgGetAndVerifySigner failed: 0x%08lx\n", GetLastError());
3462 /* the signer index can be retrieved, .. */
3463 signerIndex = 0xdeadbeef;
3464 ret = CryptMsgGetAndVerifySigner(msg, 0, NULL, 0, NULL, &signerIndex);
3465 ok(ret, "CryptMsgGetAndVerifySigner failed: 0x%08lx\n", GetLastError());
3466 if (ret)
3467 ok(signerIndex == 0, "expected 0, got %ld\n", signerIndex);
3468 /* as can the signer cert. */
3469 signer = (PCCERT_CONTEXT)0xdeadbeef;
3470 ret = CryptMsgGetAndVerifySigner(msg, 0, NULL, 0, &signer, NULL);
3471 ok(ret, "CryptMsgGetAndVerifySigner failed: 0x%08lx\n", GetLastError());
3472 if (ret)
3473 ok(signer != NULL && signer != (PCCERT_CONTEXT)0xdeadbeef,
3474 "expected a valid signer\n");
3475 if (signer && signer != (PCCERT_CONTEXT)0xdeadbeef)
3477 /* Specifying CMSG_USE_SIGNER_INDEX_FLAG and an invalid signer index fails
3478 */
3479 signerIndex = 0xdeadbeef;
3480 SetLastError(0xdeadbeef);
3482 NULL, &signerIndex);
3484 "expected CRYPT_E_INVALID_INDEX, got 0x%08lx\n", GetLastError());
3485 /* Specifying CMSG_TRUSTED_SIGNER_FLAG and no cert stores causes the
3486 * message signer not to be found.
3487 */
3488 SetLastError(0xdeadbeef);
3490 NULL, NULL);
3492 "expected CRYPT_E_NO_TRUSTED_SIGNER, got 0x%08lx\n", GetLastError());
3493 /* Specifying CMSG_TRUSTED_SIGNER_FLAG and an empty cert store also causes
3494 * the message signer not to be found.
3495 */
3498 SetLastError(0xdeadbeef);
3500 NULL, NULL);
3502 "expected CRYPT_E_NO_TRUSTED_SIGNER, got 0x%08lx\n", GetLastError());
3506 ok(ret, "CertAddEncodedCertificateToStore failed: 0x%08lx\n", GetLastError());
3507 /* Specifying CMSG_TRUSTED_SIGNER_FLAG with a cert store that contains
3508 * the signer succeeds.
3509 */
3510 SetLastError(0xdeadbeef);
3512 NULL, NULL);
3513 ok(ret, "CryptMsgGetAndVerifySigner failed: 0x%08lx\n", GetLastError());
3514 CertCloseStore(store, 0);
3516}
BOOL WINAPI CertAddEncodedCertificateToStore(HCERTSTORE hCertStore, DWORD dwCertEncodingType, const BYTE *pbCertEncoded, DWORD cbCertEncoded, DWORD dwAddDisposition, PCCERT_CONTEXT *ppCertContext)
Definition: cert.c:58
BOOL WINAPI CryptMsgGetAndVerifySigner(HCRYPTMSG hCryptMsg, DWORD cSignerStore, HCERTSTORE *rghSignerStore, DWORD dwFlags, PCCERT_CONTEXT *ppSigner, DWORD *pdwSignerIndex)
Definition: msg.c:3669
HCERTSTORE WINAPI CertOpenStore(LPCSTR lpszStoreProvider, DWORD dwMsgAndCertEncodingType, HCRYPTPROV_LEGACY hCryptProv, DWORD dwFlags, const void *pvPara)
Definition: store.c:815
BOOL WINAPI CertCloseStore(HCERTSTORE hCertStore, DWORD dwFlags)
Definition: store.c:1127
static const BYTE signedEmptyContent[]
Definition: msg.c:1278
#define CERT_STORE_CREATE_NEW_FLAG
Definition: wincrypt.h:2633
#define CERT_STORE_PROV_MEMORY
Definition: wincrypt.h:2455
const CERT_CONTEXT * PCCERT_CONTEXT
Definition: wincrypt.h:494
#define CMSG_USE_SIGNER_INDEX_FLAG
Definition: wincrypt.h:4310
#define CERT_STORE_ADD_ALWAYS
Definition: wincrypt.h:2654
#define CMSG_TRUSTED_SIGNER_FLAG
Definition: wincrypt.h:4308
#define CRYPT_E_NO_TRUSTED_SIGNER
Definition: winerror.h:4449

Referenced by START_TEST().

◆ test_msg_get_param()

static void test_msg_get_param ( void  )
static

Definition at line 142 of file msg.c.

143{
144 BOOL ret;
146 DWORD size, i, value;
147
148 /* Crash
149 ret = CryptMsgGetParam(NULL, 0, 0, NULL, NULL);
150 ret = CryptMsgGetParam(NULL, 0, 0, NULL, &size);
151 ret = CryptMsgGetParam(msg, 0, 0, NULL, NULL);
152 */
153
154 /* Decoded messages */
156 ok(msg != NULL, "CryptMsgOpenToDecode failed: %lx\n", GetLastError());
157 /* For decoded messages, the type is always available */
158 size = 0;
160 ok(ret, "CryptMsgGetParam failed: %lx\n", GetLastError());
161 size = sizeof(value);
163 ok(ret, "CryptMsgGetParam failed: %lx\n", GetLastError());
164 /* For this (empty) message, the type isn't set */
165 ok(value == 0, "Expected type 0, got %ld\n", value);
167
169 NULL);
170 ok(msg != NULL, "CryptMsgOpenToDecode failed: %lx\n", GetLastError());
171 /* For explicitly typed messages, the type is known. */
172 size = sizeof(value);
174 ok(ret, "CryptMsgGetParam failed: %lx\n", GetLastError());
175 ok(value == CMSG_DATA, "Expected CMSG_DATA, got %ld\n", value);
177 {
178 size = 0;
179 ret = CryptMsgGetParam(msg, i, 0, NULL, &size);
180 ok(!ret, "Parameter %ld: expected failure\n", i);
181 }
183
185 NULL);
186 ok(msg != NULL, "CryptMsgOpenToDecode failed: %lx\n", GetLastError());
187 size = sizeof(value);
189 ok(ret, "CryptMsgGetParam failed: %lx\n", GetLastError());
190 ok(value == CMSG_ENVELOPED, "Expected CMSG_ENVELOPED, got %ld\n", value);
192 {
193 size = 0;
194 ret = CryptMsgGetParam(msg, i, 0, NULL, &size);
195 ok(!ret, "Parameter %ld: expected failure\n", i);
196 }
198
200 NULL);
201 ok(msg != NULL, "CryptMsgOpenToDecode failed: %lx\n", GetLastError());
202 size = sizeof(value);
204 ok(ret, "CryptMsgGetParam failed: %lx\n", GetLastError());
205 ok(value == CMSG_HASHED, "Expected CMSG_HASHED, got %ld\n", value);
207 {
208 size = 0;
209 ret = CryptMsgGetParam(msg, i, 0, NULL, &size);
210 ok(!ret, "Parameter %ld: expected failure\n", i);
211 }
213
215 NULL);
216 ok(msg != NULL, "CryptMsgOpenToDecode failed: %lx\n", GetLastError());
217 size = sizeof(value);
219 ok(ret, "CryptMsgGetParam failed: %lx\n", GetLastError());
220 ok(value == CMSG_SIGNED, "Expected CMSG_SIGNED, got %ld\n", value);
222 {
223 size = 0;
224 ret = CryptMsgGetParam(msg, i, 0, NULL, &size);
225 ok(!ret, "Parameter %ld: expected failure\n", i);
226 }
228
229 /* Explicitly typed messages get their types set, even if they're invalid */
231 NULL);
232 ok(msg != NULL, "CryptMsgOpenToDecode failed: %lx\n", GetLastError());
233 size = sizeof(value);
235 ok(ret, "CryptMsgGetParam failed: %lx\n", GetLastError());
236 ok(value == CMSG_ENCRYPTED, "Expected CMSG_ENCRYPTED, got %ld\n", value);
238
240 ok(msg != NULL, "CryptMsgOpenToDecode failed: %lx\n", GetLastError());
241 size = sizeof(value);
243 ok(ret, "CryptMsgGetParam failed: %lx\n", GetLastError());
244 ok(value == 1000, "Expected 1000, got %ld\n", value);
246}
#define CMSG_ENCRYPTED
Definition: wincrypt.h:3849

Referenced by START_TEST().

◆ test_msg_open_to_decode()

static void test_msg_open_to_decode ( void  )
static

Definition at line 79 of file msg.c.

80{
82 CMSG_STREAM_INFO streamInfo = { 0 };
83
84 SetLastError(0xdeadbeef);
85 msg = CryptMsgOpenToDecode(0, 0, 0, 0, NULL, NULL);
87 "Expected E_INVALIDARG, got %lx\n", GetLastError());
88
89 /* Bad encodings */
90 SetLastError(0xdeadbeef);
93 "Expected E_INVALIDARG, got %lx\n", GetLastError());
94 SetLastError(0xdeadbeef);
97 "Expected E_INVALIDARG, got %lx\n", GetLastError());
98
99 /* The message type can be explicit... */
101 NULL);
102 ok(msg != NULL, "CryptMsgOpenToDecode failed: %lx\n", GetLastError());
105 NULL);
106 ok(msg != NULL, "CryptMsgOpenToDecode failed: %lx\n", GetLastError());
109 NULL);
110 ok(msg != NULL, "CryptMsgOpenToDecode failed: %lx\n", GetLastError());
113 NULL);
114 ok(msg != NULL, "CryptMsgOpenToDecode failed: %lx\n", GetLastError());
118 ok(msg != NULL, "CryptMsgOpenToDecode failed: %lx\n", GetLastError());
120 /* or implicit.. */
122 ok(msg != NULL, "CryptMsgOpenToDecode failed: %lx\n", GetLastError());
124 /* or even invalid. */
126 NULL);
127 ok(msg != NULL, "CryptMsgOpenToDecode failed: %lx\n", GetLastError());
130 ok(msg != NULL, "CryptMsgOpenToDecode failed: %lx\n", GetLastError());
132
133 /* And even though the stream info parameter "must be set to NULL" for
134 * CMSG_HASHED, it's still accepted.
135 */
137 &streamInfo);
138 ok(msg != NULL, "CryptMsgOpenToDecode failed: %lx\n", GetLastError());
140}
#define CMSG_SIGNED_AND_ENVELOPED
Definition: wincrypt.h:3847

Referenced by START_TEST().

◆ test_msg_open_to_encode()

static void test_msg_open_to_encode ( void  )
static

Definition at line 34 of file msg.c.

35{
37
38 /* Crash
39 msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED, NULL,
40 NULL, NULL);
41 msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_HASHED, NULL, NULL,
42 NULL);
43 msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_SIGNED, NULL, NULL,
44 NULL);
45 */
46
47 /* Bad encodings */
48 SetLastError(0xdeadbeef);
51 "Expected E_INVALIDARG, got %lx\n", GetLastError());
52 SetLastError(0xdeadbeef);
55 "Expected E_INVALIDARG, got %lx\n", GetLastError());
56
57 /* Bad message types */
58 SetLastError(0xdeadbeef);
61 "Expected CRYPT_E_INVALID_MSG_TYPE, got %lx\n", GetLastError());
62 SetLastError(0xdeadbeef);
64 NULL, NULL, NULL);
66 "Expected CRYPT_E_INVALID_MSG_TYPE, got %lx\n", GetLastError());
67 SetLastError(0xdeadbeef);
71 "Expected CRYPT_E_INVALID_MSG_TYPE, got %lx\n", GetLastError());
72 SetLastError(0xdeadbeef);
74 NULL, NULL);
76 "Expected CRYPT_E_INVALID_MSG_TYPE, got %lx\n", GetLastError());
77}

Referenced by START_TEST().

◆ test_signed_msg()

static void test_signed_msg ( void  )
static

Definition at line 1987 of file msg.c.

1988{
1993}
static void test_signed_msg_encoding(void)
Definition: msg.c:1589
static void test_signed_msg_update(void)
Definition: msg.c:1154
static void test_signed_msg_get_param(void)
Definition: msg.c:1808
static void test_signed_msg_open(void)
Definition: msg.c:1015

Referenced by START_TEST().

◆ test_signed_msg_encoding()

static void test_signed_msg_encoding ( void  )
static

Definition at line 1589 of file msg.c.

1590{
1591 HCRYPTMSG msg;
1592 CMSG_SIGNED_ENCODE_INFO signInfo = { sizeof(signInfo), 0 };
1593 CMSG_SIGNER_ENCODE_INFO signer = { sizeof(signer), 0 };
1594 CERT_INFO certInfo = { 0 };
1595 CERT_BLOB encodedCert = { sizeof(cert), cert };
1596 CRL_BLOB encodedCrl = { sizeof(crl), crl };
1597 char oid_common_name[] = szOID_COMMON_NAME;
1600 CRYPT_ATTRIBUTE attr = { oid_common_name, 1, &commonName };
1601 BOOL ret;
1602 HCRYPTKEY key;
1603 DWORD size;
1604
1606 CMSG_DETACHED_FLAG, CMSG_SIGNED, &signInfo, NULL, NULL);
1607 ok(msg != NULL, "CryptMsgOpenToEncode failed: %lx\n", GetLastError());
1608
1609 check_param("detached unsigned empty bare content", msg,
1611 sizeof(unsignedEmptyBareContent));
1612 check_param("detached unsigned empty content", msg, CMSG_CONTENT_PARAM,
1614 ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
1615 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
1616 check_param("detached unsigned bare content", msg, CMSG_BARE_CONTENT_PARAM,
1618 check_param("detached unsigned content", msg, CMSG_CONTENT_PARAM,
1620 SetLastError(0xdeadbeef);
1623 "Expected CRYPT_E_INVALID_INDEX, got %lx\n", GetLastError());
1624 SetLastError(0xdeadbeef);
1627 "Expected CRYPT_E_INVALID_INDEX, got %lx\n", GetLastError());
1628
1630
1631 certInfo.SerialNumber.cbData = sizeof(serialNum);
1632 certInfo.SerialNumber.pbData = serialNum;
1633 certInfo.Issuer.cbData = sizeof(encodedCommonName);
1634 certInfo.Issuer.pbData = encodedCommonName;
1635 signer.pCertInfo = &certInfo;
1637 signInfo.cSigners = 1;
1638 signInfo.rgSigners = &signer;
1639
1642 if (!ret && GetLastError() == NTE_EXISTS) {
1644 PROV_RSA_FULL, 0);
1645 }
1646 ok(ret, "CryptAcquireContext failed: 0x%lx\n", GetLastError());
1647
1648 ret = CryptImportKey(signer.hCryptProv, privKey, sizeof(privKey),
1649 0, 0, &key);
1650 ok(ret, "CryptImportKey failed: %08lx\n", GetLastError());
1651
1653 CMSG_DETACHED_FLAG, CMSG_SIGNED, &signInfo, NULL, NULL);
1654 ok(msg != NULL, "CryptMsgOpenToEncode failed: %lx\n", GetLastError());
1655
1656 check_param("detached signed empty bare content", msg,
1658 sizeof(signedEmptyBareContent));
1659 check_param("detached signed empty content", msg, CMSG_CONTENT_PARAM,
1661 ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
1662 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
1663 check_param("detached signed hash", msg, CMSG_COMPUTED_HASH_PARAM,
1664 signedHash, sizeof(signedHash));
1665 check_param("detached signed bare content", msg, CMSG_BARE_CONTENT_PARAM,
1667 check_param("detached signed content", msg, CMSG_CONTENT_PARAM,
1669 SetLastError(0xdeadbeef);
1672 "Expected CRYPT_E_INVALID_INDEX, got %lx\n", GetLastError());
1673 check_param("detached signed encoded signer", msg, CMSG_ENCODED_SIGNER,
1675
1677
1678 certInfo.SerialNumber.cbData = 0;
1679 certInfo.Issuer.cbData = 0;
1680 signer.SignerId.dwIdChoice = CERT_ID_KEY_IDENTIFIER;
1681 signer.SignerId.KeyId.cbData = sizeof(serialNum);
1682 signer.SignerId.KeyId.pbData = serialNum;
1684 NULL, NULL);
1685 ok(msg != NULL, "CryptMsgOpenToEncode failed: %lx\n", GetLastError());
1686 check_param("signed key id empty content", msg, CMSG_CONTENT_PARAM,
1689
1690 certInfo.SerialNumber.cbData = sizeof(serialNum);
1691 certInfo.SerialNumber.pbData = serialNum;
1692 certInfo.Issuer.cbData = sizeof(encodedCommonName);
1693 certInfo.Issuer.pbData = encodedCommonName;
1694 signer.SignerId.dwIdChoice = 0;
1696 NULL, NULL);
1697 ok(msg != NULL, "CryptMsgOpenToEncode failed: %lx\n", GetLastError());
1698
1699 check_param("signed empty bare content", msg, CMSG_BARE_CONTENT_PARAM,
1701 check_param("signed empty content", msg, CMSG_CONTENT_PARAM,
1703 ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
1704 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
1705 check_param("signed bare content", msg, CMSG_BARE_CONTENT_PARAM,
1707 check_param("signed content", msg, CMSG_CONTENT_PARAM,
1708 signedContent, sizeof(signedContent));
1709
1711
1712 signer.cAuthAttr = 1;
1713 signer.rgAuthAttr = &attr;
1715 NULL, NULL);
1716 ok(msg != NULL, "CryptMsgOpenToEncode failed: %lx\n", GetLastError());
1717
1719 check_param("signed with auth attrs bare content", msg,
1722
1724
1725 signer.cAuthAttr = 0;
1726 signInfo.rgCertEncoded = &encodedCert;
1727 signInfo.cCertEncoded = 1;
1729 NULL, NULL);
1730 ok(msg != NULL, "CryptMsgOpenToEncode failed: %lx\n", GetLastError());
1731
1732 check_param("signed with cert empty bare content", msg,
1735 ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
1736 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
1737 check_param("signed with cert bare content", msg, CMSG_BARE_CONTENT_PARAM,
1739
1741
1742 signInfo.cCertEncoded = 0;
1743 signInfo.rgCrlEncoded = &encodedCrl;
1744 signInfo.cCrlEncoded = 1;
1746 NULL, NULL);
1747 ok(msg != NULL, "CryptMsgOpenToEncode failed: %lx\n", GetLastError());
1748
1749 check_param("signed with crl empty bare content", msg,
1752 ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
1753 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
1754 check_param("signed with crl bare content", msg, CMSG_BARE_CONTENT_PARAM,
1756
1758
1759 signInfo.cCertEncoded = 1;
1761 NULL, NULL);
1762 ok(msg != NULL, "CryptMsgOpenToEncode failed: %lx\n", GetLastError());
1763
1764 check_param("signed with cert and crl empty bare content", msg,
1767 ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
1768 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
1769 check_param("signed with cert and crl bare content", msg,
1772
1774
1775 /* Test with a cert with a (bogus) public key */
1776 signInfo.cCrlEncoded = 0;
1777 encodedCert.cbData = sizeof(v1CertWithPubKey);
1778 encodedCert.pbData = v1CertWithPubKey;
1780 NULL, NULL);
1781 ok(msg != NULL, "CryptMsgOpenToEncode failed: %lx\n", GetLastError());
1782 check_param("signedWithCertWithPubKeyBareContent", msg,
1786
1787 encodedCert.cbData = sizeof(v1CertWithValidPubKey);
1788 encodedCert.pbData = v1CertWithValidPubKey;
1790 NULL, NULL);
1791 ok(msg != NULL, "CryptMsgOpenToEncode failed: %lx\n", GetLastError());
1792 check_param("signedWithCertWithValidPubKeyEmptyContent", msg,
1795 ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
1796 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
1797 check_param("signedWithCertWithValidPubKeyContent", msg,
1801
1806}
static const char commonName[]
Definition: encode.c:655
static BYTE v1CertWithPubKey[]
Definition: msg.c:1384
static const BYTE detachedSignedBareContent[]
Definition: msg.c:1286
static const BYTE detachedUnsignedContent[]
Definition: msg.c:1267
static const BYTE signedEncodedSigner[]
Definition: msg.c:1346
static const BYTE detachedUnsignedBareContent[]
Definition: msg.c:1264
static const BYTE signedWithCrlBareContent[]
Definition: msg.c:1446
static const BYTE privKey[]
Definition: msg.c:1122
static const BYTE unsignedEmptyBareContent[]
Definition: msg.c:1259
static const BYTE unsignedEmptyContent[]
Definition: msg.c:1261
static const BYTE signedWithCrlEmptyBareContent[]
Definition: msg.c:1436
static const BYTE signedHash[]
Definition: msg.c:1337
static const BYTE signedWithCertAndCrlEmptyBareContent[]
Definition: msg.c:1462
static const BYTE signedEmptyBareContent[]
Definition: msg.c:1271
static const CHAR cspNameA[]
Definition: msg.c:1009
static const BYTE signedBareContent[]
Definition: msg.c:1311
static const BYTE signedWithCertEmptyBareContent[]
Definition: msg.c:1396
static const BYTE signedWithAuthAttrsBareContent[]
Definition: msg.c:1355
PCMSG_SIGNER_ENCODE_INFO rgSigners
Definition: wincrypt.h:3896
PCERT_BLOB rgCertEncoded
Definition: wincrypt.h:3898
CRYPT_ALGORITHM_IDENTIFIER HashAlgorithm
Definition: wincrypt.h:3879
PCRYPT_ATTRIBUTE rgAuthAttr
Definition: wincrypt.h:3882
Definition: cookie.c:202
#define CRYPT_NEWKEYSET
Definition: wincrypt.h:2274
#define CRYPT_DELETEKEYSET
Definition: wincrypt.h:2275
#define szOID_COMMON_NAME
Definition: wincrypt.h:3290
#define NTE_EXISTS
Definition: winerror.h:4262

Referenced by test_signed_msg().

◆ test_signed_msg_get_param()

static void test_signed_msg_get_param ( void  )
static

Definition at line 1808 of file msg.c.

1809{
1810 BOOL ret;
1811 HCRYPTMSG msg;
1812 DWORD size, value = 0;
1813 CMSG_SIGNED_ENCODE_INFO signInfo = { sizeof(signInfo), 0 };
1814 CMSG_SIGNER_ENCODE_INFO signer = { sizeof(signer), 0 };
1815 CERT_INFO certInfo = { 0 };
1816
1818 NULL, NULL);
1819 ok(msg != NULL, "CryptMsgOpenToEncode failed: %lx\n", GetLastError());
1820
1821 /* Content and bare content are always gettable */
1822 size = 0;
1824 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
1825
1826 size = 0;
1828 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
1829 /* For "signed" messages, so is the version. */
1830 size = 0;
1832 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
1833 size = sizeof(value);
1835 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
1836 ok(value == CMSG_SIGNED_DATA_V1, "Expected version 1, got %ld\n", value);
1837 /* But for this message, with no signers, the hash and signer aren't
1838 * available.
1839 */
1840 size = 0;
1841 SetLastError(0xdeadbeef);
1844 "Expected CRYPT_E_INVALID_INDEX, got %lx\n", GetLastError());
1845 SetLastError(0xdeadbeef);
1848 "Expected CRYPT_E_INVALID_INDEX, got %lx\n", GetLastError());
1849 /* As usual, the type isn't available. */
1852 "Expected CRYPT_E_INVALID_MSG_TYPE, got %lx\n", GetLastError());
1853
1855
1856 certInfo.SerialNumber.cbData = sizeof(serialNum);
1857 certInfo.SerialNumber.pbData = serialNum;
1858 certInfo.Issuer.cbData = sizeof(encodedCommonName);
1859 certInfo.Issuer.pbData = encodedCommonName;
1860 signer.pCertInfo = &certInfo;
1862 signInfo.cSigners = 1;
1863 signInfo.rgSigners = &signer;
1864
1867 if (!ret && GetLastError() == NTE_EXISTS) {
1869 PROV_RSA_FULL, 0);
1870 }
1871 ok(ret, "CryptAcquireContext failed: 0x%lx\n", GetLastError());
1872
1874 NULL, NULL);
1875 ok(msg != NULL, "CryptMsgOpenToEncode failed: %lx\n", GetLastError());
1876
1877 /* This message, with one signer, has the hash and signer for index 0
1878 * available, but not for other indexes.
1879 */
1880 size = 0;
1882 ok(ret, "CryptMsgGetParam failed: %lx\n", GetLastError());
1884 ok(ret, "CryptMsgGetParam failed: %lx\n", GetLastError());
1885 size = 0;
1886 SetLastError(0xdeadbeef);
1889 "Expected CRYPT_E_INVALID_INDEX, got %lx\n", GetLastError());
1890 SetLastError(0xdeadbeef);
1893 "Expected CRYPT_E_INVALID_INDEX, got %lx\n", GetLastError());
1894 /* As usual, the type isn't available. */
1897 "Expected CRYPT_E_INVALID_MSG_TYPE, got %lx\n", GetLastError());
1898
1900
1901 /* Opening the message using the CMS fields.. */
1902 certInfo.SerialNumber.cbData = 0;
1903 certInfo.Issuer.cbData = 0;
1904 signer.SignerId.dwIdChoice = CERT_ID_ISSUER_SERIAL_NUMBER;
1905 signer.SignerId.IssuerSerialNumber.Issuer.cbData = sizeof(encodedCommonName);
1906 signer.SignerId.IssuerSerialNumber.Issuer.pbData = encodedCommonName;
1907 signer.SignerId.IssuerSerialNumber.SerialNumber.cbData = sizeof(serialNum);
1908 signer.SignerId.IssuerSerialNumber.SerialNumber.pbData = serialNum;
1911 if (!ret && GetLastError() == NTE_EXISTS)
1913 PROV_RSA_FULL, 0);
1914 ok(ret, "CryptAcquireContextA failed: %lx\n", GetLastError());
1917 ok(msg != NULL, "CryptMsgOpenToEncode failed: %lx\n", GetLastError());
1918 /* still results in the version being 1 when the issuer and serial number
1919 * are used and no additional CMS fields are used.
1920 */
1921 size = sizeof(value);
1923 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
1924 if (ret)
1925 ok(value == CMSG_SIGNED_DATA_V1, "expected version 1, got %ld\n", value);
1926 /* Apparently the encoded signer can be retrieved.. */
1928 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
1929 /* but the signer info, CMS signer info, and cert ID can't be. */
1930 SetLastError(0xdeadbeef);
1933 "expected CRYPT_E_INVALID_MSG_TYPE, got %08lx\n", GetLastError());
1934 SetLastError(0xdeadbeef);
1937 "expected CRYPT_E_INVALID_MSG_TYPE, got %08lx\n", GetLastError());
1938 SetLastError(0xdeadbeef);
1941 "expected CRYPT_E_INVALID_MSG_TYPE, got %08lx\n", GetLastError());
1943
1944 /* Using the KeyId field of the SignerId results in the version becoming
1945 * the CMS version.
1946 */
1947 signer.SignerId.dwIdChoice = CERT_ID_KEY_IDENTIFIER;
1948 signer.SignerId.KeyId.cbData = sizeof(serialNum);
1949 signer.SignerId.KeyId.pbData = serialNum;
1952 if (!ret && GetLastError() == NTE_EXISTS)
1954 PROV_RSA_FULL, 0);
1955 ok(ret, "CryptAcquireContextA failed: %lx\n", GetLastError());
1958 ok(msg != NULL, "CryptMsgOpenToEncode failed: %lx\n", GetLastError());
1959 size = sizeof(value);
1961 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
1962 if (ret)
1963 ok(value == CMSG_SIGNED_DATA_V3, "expected version 3, got %ld\n", value);
1964 /* Even for a CMS message, the signer can be retrieved.. */
1966 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
1967 /* but the signer info, CMS signer info, and cert ID can't be. */
1968 SetLastError(0xdeadbeef);
1971 "expected CRYPT_E_INVALID_MSG_TYPE, got %08lx\n", GetLastError());
1972 SetLastError(0xdeadbeef);
1975 "expected CRYPT_E_INVALID_MSG_TYPE, got %08lx\n", GetLastError());
1976 SetLastError(0xdeadbeef);
1979 "expected CRYPT_E_INVALID_MSG_TYPE, got %08lx\n", GetLastError());
1981
1985}
#define MS_DEF_PROV_A
Definition: wincrypt.h:2115
#define CMSG_CRYPT_RELEASE_CONTEXT_FLAG
Definition: wincrypt.h:4032
#define CMSG_SIGNER_CERT_ID_PARAM
Definition: wincrypt.h:4123
#define CMSG_SIGNED_DATA_V1
Definition: wincrypt.h:4138

Referenced by test_signed_msg().

◆ test_signed_msg_open()

static void test_signed_msg_open ( void  )
static

Definition at line 1015 of file msg.c.

1016{
1017 HCRYPTMSG msg;
1018 BOOL ret;
1019 CMSG_SIGNED_ENCODE_INFO signInfo = { 0 };
1020 CMSG_SIGNER_ENCODE_INFO signer = { sizeof(signer), 0 };
1021 CERT_INFO certInfo = { 0 };
1022
1023 SetLastError(0xdeadbeef);
1025 NULL, NULL);
1027 "Expected E_INVALIDARG, got %lx\n", GetLastError());
1028 signInfo.cbSize = sizeof(signInfo);
1030 NULL, NULL);
1031 ok(msg != NULL, "CryptMsgOpenToEncode failed: %lx\n", GetLastError());
1033
1034 signInfo.cSigners = 1;
1035 signInfo.rgSigners = &signer;
1036 /* With signer.pCertInfo unset, attempting to open this message this
1037 * crashes.
1038 */
1039 signer.pCertInfo = &certInfo;
1040 /* The cert info must contain a serial number and an issuer. */
1041 SetLastError(0xdeadbeef);
1043 NULL, NULL);
1044 /* NT: E_INVALIDARG, 9x: unchanged or CRYPT_E_UNKNOWN_ALGO */
1045 ok(!msg && (GetLastError() == E_INVALIDARG || GetLastError() == 0xdeadbeef
1047 "Expected E_INVALIDARG or 0xdeadbeef or CRYPT_E_UNKNOWN_ALGO, got 0x%lx\n",
1048 GetLastError());
1049
1050 certInfo.SerialNumber.cbData = sizeof(serialNum);
1051 certInfo.SerialNumber.pbData = serialNum;
1052 SetLastError(0xdeadbeef);
1054 NULL, NULL);
1056 "Expected E_INVALIDARG, got 0x%lx\n", GetLastError());
1057
1058 certInfo.Issuer.cbData = sizeof(encodedCommonName);
1059 certInfo.Issuer.pbData = encodedCommonName;
1060 SetLastError(0xdeadbeef);
1062 NULL, NULL);
1064 "Expected E_INVALIDARG or CRYPT_E_UNKNOWN_ALGO, got %lx\n", GetLastError());
1065
1066 /* The signer's hCryptProv must be set to something. Whether it's usable
1067 * or not will be checked after the hash algorithm is checked (see next
1068 * test.)
1069 */
1070 signer.hCryptProv = 1;
1071 SetLastError(0xdeadbeef);
1073 NULL, NULL);
1075 "Expected CRYPT_E_UNKNOWN_ALGO, got %lx\n", GetLastError());
1076 /* The signer's hash algorithm must also be set. */
1078 SetLastError(0xdeadbeef);
1079 /* Crashes in advapi32 in wine, don't do it */
1080 if (0) {
1082 &signInfo, NULL, NULL);
1084 "Expected ERROR_INVALID_PARAMETER, got %lx\n", GetLastError());
1085 }
1086 /* The signer's hCryptProv must also be valid. */
1089 if (!ret && GetLastError() == NTE_EXISTS) {
1091 PROV_RSA_FULL, 0);
1092 }
1093 ok(ret, "CryptAcquireContext failed: 0x%lx\n", GetLastError());
1094
1095 if (ret) {
1097 NULL, NULL);
1098 ok(msg != NULL, "CryptMsgOpenToEncode failed: %lx\n", GetLastError());
1100 }
1101
1102 /* pCertInfo must still be set, but can be empty if the SignerId's issuer
1103 * and serial number are set.
1104 */
1105 certInfo.Issuer.cbData = 0;
1106 certInfo.SerialNumber.cbData = 0;
1107 signer.SignerId.dwIdChoice = CERT_ID_ISSUER_SERIAL_NUMBER;
1108 signer.SignerId.IssuerSerialNumber.Issuer.cbData = sizeof(encodedCommonName);
1109 signer.SignerId.IssuerSerialNumber.Issuer.pbData = encodedCommonName;
1110 signer.SignerId.IssuerSerialNumber.SerialNumber.cbData = sizeof(serialNum);
1111 signer.SignerId.IssuerSerialNumber.SerialNumber.pbData = serialNum;
1113 NULL, NULL);
1114 ok(msg != NULL, "CryptMsgOpenToEncode failed: %lx\n", GetLastError());
1116
1120}

Referenced by test_signed_msg().

◆ test_signed_msg_update()

static void test_signed_msg_update ( void  )
static

Definition at line 1154 of file msg.c.

1155{
1156 HCRYPTMSG msg;
1157 BOOL ret;
1158 CMSG_SIGNED_ENCODE_INFO signInfo = { sizeof(signInfo), 0 };
1159 CMSG_SIGNER_ENCODE_INFO signer = { sizeof(signer), 0 };
1160 CERT_INFO certInfo = { 0 };
1161 HCRYPTKEY key;
1162
1163 certInfo.SerialNumber.cbData = sizeof(serialNum);
1164 certInfo.SerialNumber.pbData = serialNum;
1165 certInfo.Issuer.cbData = sizeof(encodedCommonName);
1166 certInfo.Issuer.pbData = encodedCommonName;
1167 signer.pCertInfo = &certInfo;
1169 signInfo.cSigners = 1;
1170 signInfo.rgSigners = &signer;
1171
1174 if (!ret && GetLastError() == NTE_EXISTS) {
1176 PROV_RSA_FULL, 0);
1177 }
1178 ok(ret, "CryptAcquireContext failed: 0x%lx\n", GetLastError());
1179
1181 CMSG_DETACHED_FLAG, CMSG_SIGNED, &signInfo, NULL, NULL);
1182 ok(msg != NULL, "CryptMsgOpenToEncode failed: %lx\n", GetLastError());
1183 /* Detached CMSG_SIGNED allows non-final updates. */
1184 ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), FALSE);
1185 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
1186 /* Detached CMSG_SIGNED also allows non-final updates with no data. */
1188 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
1189 /* The final update requires a private key in the hCryptProv, in order to
1190 * generate the signature.
1191 */
1192 SetLastError(0xdeadbeef);
1193 ret = CryptMsgUpdate(msg, NULL, 0, TRUE);
1195 "Expected NTE_BAD_KEYSET or NTE_NO_KEY, got %lx\n", GetLastError());
1196 ret = CryptImportKey(signer.hCryptProv, privKey, sizeof(privKey),
1197 0, 0, &key);
1198 ok(ret, "CryptImportKey failed: %08lx\n", GetLastError());
1199 /* The final update should be able to succeed now that a key exists, but
1200 * the previous (invalid) final update prevents it.
1201 */
1202 SetLastError(0xdeadbeef);
1203 ret = CryptMsgUpdate(msg, NULL, 0, TRUE);
1205 "Expected CRYPT_E_MSG_ERROR, got %lx\n", GetLastError());
1207
1209 CMSG_DETACHED_FLAG, CMSG_SIGNED, &signInfo, NULL, NULL);
1210 ok(msg != NULL, "CryptMsgOpenToEncode failed: %lx\n", GetLastError());
1211 /* Detached CMSG_SIGNED allows non-final updates. */
1212 ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), FALSE);
1213 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
1214 /* Detached CMSG_SIGNED also allows non-final updates with no data. */
1216 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
1217 /* Now that the private key exists, the final update can succeed (even
1218 * with no data.)
1219 */
1220 ret = CryptMsgUpdate(msg, NULL, 0, TRUE);
1221 ok(ret, "CryptMsgUpdate failed: %lx\n", GetLastError());
1222 /* But no updates are allowed after the final update. */
1223 SetLastError(0xdeadbeef);
1226 "Expected CRYPT_E_MSG_ERROR, got %lx\n", GetLastError());
1227 SetLastError(0xdeadbeef);
1228 ret = CryptMsgUpdate(msg, NULL, 0, TRUE);
1230 "Expected CRYPT_E_MSG_ERROR, got %lx\n", GetLastError());
1232
1234 NULL, NULL);
1235 ok(msg != NULL, "CryptMsgOpenToEncode failed: %lx\n", GetLastError());
1236 /* Non-detached messages don't allow non-final updates.. */
1237 SetLastError(0xdeadbeef);
1238 ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), FALSE);
1240 "Expected CRYPT_E_MSG_ERROR, got %lx\n", GetLastError());
1241 /* but they do allow final ones. */
1242 ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
1243 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
1246 NULL, NULL);
1247 ok(msg != NULL, "CryptMsgOpenToEncode failed: %lx\n", GetLastError());
1248 /* They also allow final updates with no data. */
1249 ret = CryptMsgUpdate(msg, NULL, 0, TRUE);
1250 ok(ret, "CryptMsgUpdate failed: %08lx\n", GetLastError());
1252
1257}
#define NTE_NO_KEY
Definition: winerror.h:4260
#define NTE_BAD_KEYSET
Definition: winerror.h:4269

Referenced by test_signed_msg().

◆ test_verify_ecc_signature()

static void test_verify_ecc_signature ( void  )
static

Definition at line 3585 of file msg.c.

3586{
3587 HCERTSTORE store;
3588 HCRYPTKEY key;
3589#ifndef __REACTOS__
3590 BCRYPT_KEY_HANDLE bkey;
3591#endif
3592 HCRYPTMSG msg;
3593 BOOL bret;
3594 CERT_INFO *cert_info;
3596 DWORD size;
3597 CMSG_CTRL_VERIFY_SIGNATURE_EX_PARA verify_para = { sizeof(verify_para) };
3599 void *import_func;
3600 HCRYPTOIDFUNCADDR hfunc = NULL;
3601 CMSG_CMS_SIGNER_INFO *signer_info;
3602
3604 ok(!!msg, "failed, error %#lx.\n", GetLastError());
3606 ok(bret, "failed, error %#lx.\n", GetLastError());
3608 ok(!!store, "failed, error %#lx.\n", GetLastError());
3609 size = 0;
3611 ok(bret, "failed, error %#lx.\n", GetLastError());
3612 cert_info = malloc(size);
3613 bret = CryptMsgGetParam(msg, CMSG_SIGNER_CERT_INFO_PARAM, 0, cert_info, &size);
3614 ok(bret, "failed, error %#lx.\n", GetLastError());
3616 ok(!!cert, "failed, error %#lx.\n", GetLastError());
3617
3618 ok(!strcmp(cert->pCertInfo->SubjectPublicKeyInfo.Algorithm.pszObjId, szOID_ECC_PUBLIC_KEY),
3619 "got OID %s.\n", cert->pCertInfo->SubjectPublicKeyInfo.Algorithm.pszObjId);
3620 size = 0;
3622 ok(bret, "failed, error %#lx.\n", GetLastError());
3623 signer_info = malloc(size);
3624 bret = CryptMsgGetParam(msg, CMSG_CMS_SIGNER_INFO_PARAM, 0, signer_info, &size);
3625 ok(bret, "failed, error %#lx.\n", GetLastError());
3626 ok(!strcmp(signer_info->HashAlgorithm.pszObjId, szOID_NIST_sha256), "got %s.\n",
3627 signer_info->HashAlgorithm.pszObjId);
3628 ok(!strcmp(signer_info->HashEncryptionAlgorithm.pszObjId, szOID_ECC_PUBLIC_KEY), "got %s.\n",
3629 signer_info->HashEncryptionAlgorithm.pszObjId);
3630
3632 ok(!!set, "failed, error %#lx.\n", GetLastError());
3633 bret = CryptGetOIDFunctionAddress(set, X509_ASN_ENCODING, cert->pCertInfo->SubjectPublicKeyInfo.Algorithm.pszObjId,
3634 0, (void **)&import_func, &hfunc);
3635 ok(!bret, "succeeded.\n");
3636
3637 bret = CryptImportPublicKeyInfo(0, X509_ASN_ENCODING, &cert->pCertInfo->SubjectPublicKeyInfo, &key);
3638 ok(!bret && GetLastError() == CRYPT_E_ASN1_BADTAG, "got ret %d, error %#lx.\n", bret, GetLastError());
3639
3640#ifndef __REACTOS__ // FIXME: ReactOS has no implementation for CryptImportPublicKeyInfoEx2
3641 bret = CryptImportPublicKeyInfoEx2(X509_ASN_ENCODING, &cert->pCertInfo->SubjectPublicKeyInfo, 0, NULL, &bkey);
3642 ok(bret, "failed, error %#lx.\n", GetLastError());
3643 BCryptDestroyKey(bkey);
3644#endif
3645
3646 bret = CryptMsgControl(msg, 0, CMSG_CTRL_VERIFY_SIGNATURE, cert->pCertInfo);
3647 ok(bret, "failed, error %#lx.\n", GetLastError());
3648
3650 verify_para.pvSigner = (void *)cert;
3651 bret = CryptMsgControl(msg, 0, CMSG_CTRL_VERIFY_SIGNATURE_EX, &verify_para);
3652 ok(bret, "failed, error %#lx.\n", GetLastError());
3653
3654 free(signer_info);
3655 free(cert_info);
3657 CertCloseStore(store, 0);
3659}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
NTSTATUS WINAPI BCryptDestroyKey(BCRYPT_KEY_HANDLE)
Definition: _set.h:50
PCCERT_CONTEXT WINAPI CertGetSubjectCertificateFromStore(HCERTSTORE hCertStore, DWORD dwCertEncodingType, PCERT_INFO pCertId)
Definition: cert.c:1831
BOOL WINAPI CryptImportPublicKeyInfo(HCRYPTPROV hCryptProv, DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pInfo, HCRYPTKEY *phKey)
Definition: encode.c:4970
HCRYPTOIDFUNCSET WINAPI CryptInitOIDFunctionSet(LPCSTR pszFuncName, DWORD dwFlags)
Definition: oid.c:114
BOOL WINAPI CryptGetOIDFunctionAddress(HCRYPTOIDFUNCSET hFuncSet, DWORD dwEncodingType, LPCSTR pszOID, DWORD dwFlags, void **ppvFuncAddr, HCRYPTOIDFUNCADDR *phFuncAddr)
Definition: oid.c:387
static const BYTE msg_signed_ecc_prime256v1[]
Definition: msg.c:3526
CRYPT_ALGORITHM_IDENTIFIER HashEncryptionAlgorithm
Definition: wincrypt.h:4130
#define szOID_NIST_sha256
Definition: wincrypt.h:3287
#define CMSG_SIGNER_CERT_INFO_PARAM
Definition: wincrypt.h:4096
WINCRYPT32API BOOL WINAPI CryptImportPublicKeyInfoEx2(DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pInfo, DWORD dwFlags, void *pvAuxInfo, BCRYPT_KEY_HANDLE *phKey)
#define CMSG_CTRL_VERIFY_SIGNATURE_EX
Definition: wincrypt.h:4050
#define CMSG_VERIFY_SIGNER_CERT
Definition: wincrypt.h:4086
#define szOID_ECC_PUBLIC_KEY
Definition: wincrypt.h:3216
#define CRYPT_OID_IMPORT_PUBLIC_KEY_INFO_FUNC
Definition: wincrypt.h:2672
#define CERT_STORE_PROV_MSG
Definition: wincrypt.h:2454

Referenced by START_TEST().

Variable Documentation

◆ a1

◆ a2

◆ a3

◆ a4

const struct update_accum a4 = { 1, &b4 }
static

◆ aKey

BYTE aKey[] = { 0,1,2,3,4,5,6,7,8,9,0xa,0xb,0xc,0xd,0xe,0xf }
static

Definition at line 3018 of file msg.c.

Referenced by test_msg_control().

◆ b1

◆ b2

◆ b3

CRYPT_DATA_BLOB b3[]
static
Initial value:
= {
{ sizeof(u4), u4 },
{ sizeof(u5), u5 },
{ sizeof(u2), u2 },
{ sizeof(u5), u5 },
{ sizeof(u2), u2 },
{ sizeof(u6), u6 },
}
static BYTE u5[]
Definition: msg.c:546
static BYTE u4[]
Definition: msg.c:544
static BYTE u6[]
Definition: msg.c:547

Definition at line 548 of file msg.c.

Referenced by _mm_set_epi8(), _mm_setr_epi8(), MemFunPtrTest::find(), foo8(), foobar5(), ipv4_addr(), MIDI_mciReadNextEvent(), test6(), test7(), test_text_position_style(), and TestBind().

◆ b4

CRYPT_DATA_BLOB b4 = { 0, NULL }
static

Definition at line 2187 of file msg.c.

Referenced by _mm_set_epi8(), _mm_setr_epi8(), foo8(), ipv4_addr(), test6(), test7(), and TestBind().

◆ bogusHashContent

const BYTE bogusHashContent[]
static
Initial value:
= {
0x30,0x47,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x05,0xa0,0x3a,
0x30,0x38,0x02,0x01,0x00,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,
0x02,0x05,0x05,0x00,0x30,0x13,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,
0x07,0x01,0xa0,0x06,0x04,0x04,0x01,0x02,0x03,0x04,0x04,0x10,0x00,0xd6,0xc0,
0x5a,0x21,0x51,0x2a,0x79,0xa1,0xdf,0xeb,0x9d,0x2a,0x8f,0x26,0x2f }

Definition at line 2193 of file msg.c.

Referenced by test_decode_msg_update().

◆ bogusOIDContent

const BYTE bogusOIDContent[]
static
Initial value:
= {
0x30,0x0f,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x07,0xa0,0x02,
0x04,0x00 }

Definition at line 2190 of file msg.c.

Referenced by test_decode_msg_update().

◆ cert

BYTE cert[]
static
Initial value:
= {
0x30,0x7a,0x02,0x01,0x01,0x30,0x02,0x06,0x00,0x30,0x15,0x31,0x13,0x30,0x11,
0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,
0x67,0x00,0x30,0x22,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,
0x30,0x30,0x30,0x30,0x30,0x5a,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,
0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x15,0x31,0x13,0x30,0x11,0x06,
0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,
0x00,0x30,0x07,0x30,0x02,0x06,0x00,0x03,0x01,0x00,0xa3,0x16,0x30,0x14,0x30,
0x12,0x06,0x03,0x55,0x1d,0x13,0x01,0x01,0xff,0x04,0x08,0x30,0x06,0x01,0x01,
0xff,0x02,0x01,0x01 }

Definition at line 1374 of file msg.c.

Referenced by _test_store_is_empty(), add_all_extensions(), add_cert_to_list(), add_cert_to_store(), add_cert_to_view(), add_critical_extensions(), add_properties(), add_store_certs(), add_v1_fields(), CContentEncryptInfo_Construct(), CDecodeSignedMsg_VerifySignatureEx(), Cert_clone(), cert_find_alt_name_entry(), Cert_free(), cert_mgr_do_export(), cert_mgr_do_remove(), cert_mgr_index_to_cert(), cert_mgr_show_cert_usages(), CertAddEncodedCertificateToStore(), CertContext_GetHashProp(), CertContext_GetProperty(), CertContext_SetProperty(), CertCreateCertificateContext(), CertEnumCertificateContextProperties(), CertGetCertificateContextProperty(), check_and_store_certs(), check_store_context_type(), choose_store_for_cert(), Collection_addCert(), Collection_deleteCert(), countCertsInStore(), CRecipientInfo_Construct(), CredMarshalCredentialW(), CredUnmarshalCredentialW(), CRYPT_AddCertToSimpleChain(), CRYPT_BuildCandidateChainFromCert(), CRYPT_BuildSimpleChain(), CRYPT_CheckBasicConstraintsForCA(), CRYPT_CheckNameConstraints(), CRYPT_CheckRestrictedRoot(), CRYPT_CriticalExtensionsSupported(), CRYPT_DecodeBasicConstraints(), CRYPT_FileWriteCert(), CRYPT_FindCertificateInCRL(), CRYPT_FindCertInStore(), CRYPT_FindIssuer(), CRYPT_GetNameConstraints(), CRYPT_GetPolicies(), CRYPT_GetSimpleChainForCert(), CRYPT_GetUrlFromCertificateCRLDistPoint(), CRYPT_GetUrlFromCertificateIssuer(), CRYPT_IsCertificateSelfSigned(), CRYPT_IsCertVersionValid(), CRYPT_KeyUsageValid(), CRYPT_RegWriteCert(), CRYPT_SavePKCSToMem(), CRYPTDLG_CopyChain(), CRYPTDLG_MakeEngine(), CryptUIDlgSelectCertificateA(), CryptUIDlgViewCertificateW(), CryptVerifyDetachedMessageSignature(), CryptVerifyMessageSignature(), display_app_usages(), display_cert_usages(), dump_cert_info(), dump_element(), export_get_private_key_info(), field_format_detailed_issuer(), field_format_detailed_public_key(), field_format_detailed_subject(), field_format_from_date(), field_format_issuer(), field_format_public_key(), field_format_serial_number(), field_format_subject(), field_format_to_date(), field_format_version(), find_and_delete_cert_in_store(), get_cert_common_name(), get_cert_display_name(), get_cert_property_as_string(), get_cert_usages(), get_subject_alt_name_ext(), IDirectSoundFullDuplex_IDirectSound8_VerifyCertification(), import_cert(), import_store(), is_ca_cert(), match_dns_to_subject_dn(), MemStore_addCert(), MsiGetFileSignatureInformationA(), MsiGetFileSignatureInformationW(), netcon_secure_connect_setup(), netconn_secure_connect(), netconn_verify_cert(), ParseX509EncodedCertificateForListBoxEntry(), ProvStore_addCert(), rdssl_cert_to_rkey(), read_trusted_roots_from_known_locations(), request_query_option(), request_set_option(), save_pfx(), sec_parse_x509_key(), select_cert_dlg_proc(), select_cert_get_selected(), select_cert_view(), set_cert_name_string(), set_cert_string_property(), set_cert_validity_period(), set_certificate_status(), set_general_cert_properties(), show_cert_usages(), show_selected_cert(), show_store_certs(), ShowX509EncodedCertificate(), test_add_certificate(), test_CERT_CHAIN_PARA_cbSize(), test_CertGetNameString(), test_CertNameToStrA(), test_CertNameToStrW(), test_communication(), test_CredMarshalCredentialA(), test_CredUnmarshalCredentialA(), test_crypt_ui_wiz_import(), test_decode_msg_get_param(), test_get_certificate(), test_getObjectUrl(), test_I_UpdateStore(), test_MsiGetFileSignatureInformation(), test_PFXImportCertStore(), test_retrieveObjectByUrl(), test_secure_connection(), test_security_flags(), test_signed_msg_encoding(), test_utils(), test_verify_ecc_signature(), test_verify_message_signature(), test_VerifySignature(), test_WTHelperGetProvCertFromChain(), testAcquireCertPrivateKey(), testCertRegisterSystemStore(), testCertSigs(), testCertTrust(), testCloseStore(), testCreateCert(), testEmptyStore(), testFileNameStore(), testFileStore(), testFindCertInCRL(), testFindCRL(), testGetCertChain(), testGetCRLFromStore(), testKeyProvInfo(), testMessageStore(), testSerializedStore(), testVerifyCertChainPolicy(), testVerifyCertSig(), testVerifyCertSigEx(), testVerifyCRLRevocation(), TrustIsCertificateSelfSigned(), verify_cert_revocation(), verify_cert_revocation_from_dist_points_ext(), verify_cert_revocation_with_crl_offline(), verify_cert_revocation_with_crl_online(), verify_ssl_policy(), WINTRUST_AddCert(), WINTRUST_GetSignedMsgFromPEFile(), WINTRUST_PutSignedMsgToPEFile(), WMReaderAdvanced6_SetProtextStreamSamples(), and WTHelperGetProvCertFromChain().

◆ crl

BYTE crl[]
static
Initial value:
= { 0x30,0x2c,0x30,0x02,0x06,0x00,0x30,0x15,0x31,0x13,0x30,
0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,
0x6e,0x67,0x00,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,
0x30,0x30,0x30,0x30,0x5a }

Definition at line 1432 of file msg.c.

Referenced by test_decode_msg_get_param(), and test_signed_msg_encoding().

◆ cspNameA

const CHAR cspNameA[]
static
Initial value:
= { 'W','i','n','e','C','r','y','p','t','T','e',
'm','p',0 }

Definition at line 1009 of file msg.c.

Referenced by test_signed_msg_encoding(), test_signed_msg_get_param(), test_signed_msg_open(), and test_signed_msg_update().

◆ dataBareContent

const BYTE dataBareContent[] = { 0x04,0x04,0x01,0x02,0x03,0x04 }
static

Definition at line 487 of file msg.c.

Referenced by test_data_msg_encoding().

◆ dataContent

const BYTE dataContent[]
static
Initial value:
= {
0x30,0x13,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x01,0xa0,0x06,
0x04,0x04,0x01,0x02,0x03,0x04 }

Definition at line 488 of file msg.c.

Referenced by test_data_msg_encoding(), and test_decode_msg_get_param().

◆ dataEmptyBareContent

const BYTE dataEmptyBareContent[] = { 0x04,0x00 }
static

Definition at line 338 of file msg.c.

Referenced by test_data_msg_encoding(), test_data_msg_update(), and test_decode_msg_update().

◆ dataEmptyContent

const BYTE dataEmptyContent[]
static
Initial value:
= {
0x30,0x0f,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x01,0xa0,0x02,
0x04,0x00 }

Definition at line 484 of file msg.c.

Referenced by test_data_msg_encoding(), and test_decode_msg_update().

◆ detachedHashBareContent

const BYTE detachedHashBareContent[]
static
Initial value:
= {
0x30,0x30,0x02,0x01,0x00,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,
0x02,0x05,0x05,0x00,0x30,0x0b,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,
0x07,0x01,0x04,0x10,0x08,0xd6,0xc0,0x5a,0x21,0x51,0x2a,0x79,0xa1,0xdf,0xeb,
0x9d,0x2a,0x8f,0x26,0x2f }

Definition at line 895 of file msg.c.

Referenced by test_hash_msg_encoding().

◆ detachedHashContent

const BYTE detachedHashContent[]
static
Initial value:
= {
0x30,0x3f,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x05,0xa0,0x32,
0x30,0x30,0x02,0x01,0x00,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,
0x02,0x05,0x05,0x00,0x30,0x0b,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,
0x07,0x01,0x04,0x10,0x08,0xd6,0xc0,0x5a,0x21,0x51,0x2a,0x79,0xa1,0xdf,0xeb,
0x9d,0x2a,0x8f,0x26,0x2f }

Definition at line 900 of file msg.c.

Referenced by test_hash_msg_encoding(), and test_msg_control().

◆ detachedHashNonFinalBareContent

const BYTE detachedHashNonFinalBareContent[]
static
Initial value:
= {
0x30,0x20,0x02,0x01,0x00,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,
0x02,0x05,0x05,0x00,0x30,0x0b,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,
0x07,0x01,0x04,0x00 }

Definition at line 886 of file msg.c.

Referenced by test_hash_msg_encoding().

◆ detachedHashNonFinalContent

const BYTE detachedHashNonFinalContent[]
static
Initial value:
= {
0x30,0x2f,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x05,0xa0,0x22,
0x30,0x20,0x02,0x01,0x00,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,
0x02,0x05,0x05,0x00,0x30,0x0b,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,
0x07,0x01,0x04,0x00 }

Definition at line 890 of file msg.c.

Referenced by test_hash_msg_encoding().

◆ detachedSignedBareContent

const BYTE detachedSignedBareContent[]
static
Initial value:
= {
0x30,0x81,0x99,0x02,0x01,0x01,0x31,0x0e,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,
0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,0x0b,0x06,0x09,0x2a,0x86,0x48,0x86,
0xf7,0x0d,0x01,0x07,0x01,0x31,0x77,0x30,0x75,0x02,0x01,0x01,0x30,0x1a,0x30,
0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,
0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,0x02,0x01,0x01,0x30,0x0c,0x06,0x08,0x2a,
0x86,0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,0x04,0x06,0x00,0x05,0x00,
0x04,0x40,0x81,0xa6,0x70,0xb3,0xef,0x59,0xd1,0x66,0xd1,0x9b,0xc0,0x9a,0xb6,
0x9a,0x5e,0x6d,0x6f,0x6d,0x0d,0x59,0xa9,0xaa,0x6e,0xe9,0x2c,0xa0,0x1e,0xee,
0xc2,0x60,0xbc,0x59,0xbe,0x3f,0x63,0x06,0x8d,0xc9,0x11,0x1d,0x23,0x64,0x92,
0xef,0x2e,0xfc,0x57,0x29,0xa4,0xaf,0xe0,0xee,0x93,0x19,0x39,0x51,0xe4,0x44,
0xb8,0x0b,0x28,0xf4,0xa8,0x0d }

Definition at line 1286 of file msg.c.

Referenced by test_signed_msg_encoding().

◆ detachedSignedContent

const BYTE detachedSignedContent[]
static
Initial value:
= {
0x30,0x81,0xaa,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x02,0xa0,
0x81,0x9c,0x30,0x81,0x99,0x02,0x01,0x01,0x31,0x0e,0x30,0x0c,0x06,0x08,0x2a,
0x86,0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,0x0b,0x06,0x09,0x2a,0x86,
0x48,0x86,0xf7,0x0d,0x01,0x07,0x01,0x31,0x77,0x30,0x75,0x02,0x01,0x01,0x30,
0x1a,0x30,0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,
0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,0x02,0x01,0x01,0x30,0x0c,0x06,
0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,0x04,0x06,0x00,
0x05,0x00,0x04,0x40,0x81,0xa6,0x70,0xb3,0xef,0x59,0xd1,0x66,0xd1,0x9b,0xc0,
0x9a,0xb6,0x9a,0x5e,0x6d,0x6f,0x6d,0x0d,0x59,0xa9,0xaa,0x6e,0xe9,0x2c,0xa0,
0x1e,0xee,0xc2,0x60,0xbc,0x59,0xbe,0x3f,0x63,0x06,0x8d,0xc9,0x11,0x1d,0x23,
0x64,0x92,0xef,0x2e,0xfc,0x57,0x29,0xa4,0xaf,0xe0,0xee,0x93,0x19,0x39,0x51,
0xe4,0x44,0xb8,0x0b,0x28,0xf4,0xa8,0x0d }

Definition at line 1298 of file msg.c.

Referenced by test_decode_msg_update(), test_msg_control(), and test_signed_msg_encoding().

◆ detachedUnsignedBareContent

const BYTE detachedUnsignedBareContent[]
static
Initial value:
= {
0x30,0x14,0x02,0x01,0x01,0x31,0x00,0x30,0x0b,0x06,0x09,0x2a,0x86,0x48,0x86,
0xf7,0x0d,0x01,0x07,0x01,0x31,0x00 }

Definition at line 1264 of file msg.c.

Referenced by test_signed_msg_encoding().

◆ detachedUnsignedContent

const BYTE detachedUnsignedContent[]
static
Initial value:
= {
0x30,0x23,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x02,0xa0,0x16,
0x30,0x14,0x02,0x01,0x01,0x31,0x00,0x30,0x0b,0x06,0x09,0x2a,0x86,0x48,0x86,
0xf7,0x0d,0x01,0x07,0x01,0x31,0x00 }

Definition at line 1267 of file msg.c.

Referenced by test_signed_msg_encoding().

◆ emptyHashParam

const BYTE emptyHashParam[]
static
Initial value:
= {
0xd4,0x1d,0x8c,0xd9,0x8f,0x00,0xb2,0x04,0xe9,0x80,0x09,0x98,0xec,0xf8,0x42,
0x7e }

Definition at line 772 of file msg.c.

Referenced by test_decode_msg_get_param(), and test_hash_msg_get_param().

◆ encodedCommonName

BYTE encodedCommonName[]
static
Initial value:
= { 0x30,0x15,0x31,0x13,0x30,0x11,0x06,0x03,
0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00 }

Definition at line 1012 of file msg.c.

Referenced by test_decode_msg_get_param(), test_msg_control(), test_signed_msg_encoding(), test_signed_msg_get_param(), test_signed_msg_open(), and test_signed_msg_update().

◆ encodedPubKey

BYTE encodedPubKey[]
static
Initial value:
= {
0x30,0x1f,0x30,0x0a,0x06,0x06,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x05,0x00,0x03,
0x11,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,
0x0d,0x0e,0x0f }

Definition at line 3020 of file msg.c.

Referenced by test_msg_control().

◆ envelopedBareContentWithoutData

const BYTE envelopedBareContentWithoutData[]
static
Initial value:
= {
0x30,0x81,0xdb,0x02,0x01,0x00,0x31,0x81,0xba,0x30,0x81,0xb7,0x02,0x01,0x00,
0x30,0x20,0x30,0x0c,0x31,0x0a,0x30,0x08,0x06,0x03,0x55,0x04,0x03,0x13,0x01,
0x4e,0x02,0x10,0x63,0x75,0x75,0x7a,0x53,0x36,0xa9,0xba,0x41,0xa5,0xcc,0x01,
0x7f,0x76,0x4c,0xd9,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,
0x01,0x01,0x05,0x00,0x04,0x81,0x80,0x87,0x46,0x26,0x56,0xe3,0xf3,0xa5,0x5b,
0xd4,0x2c,0x03,0xcc,0x52,0x7e,0xf7,0x55,0xf1,0x34,0x9f,0x63,0xf6,0x04,0x9f,
0xc5,0x13,0xf1,0xc9,0x57,0x0a,0xbc,0xa9,0x33,0xd2,0xf2,0x93,0xb6,0x5c,0x94,
0xc3,0x49,0xd6,0xd6,0x6d,0xc4,0x91,0x38,0x80,0xdd,0x0d,0x82,0xef,0xe5,0x72,
0x55,0x40,0x0a,0xdd,0x35,0xfe,0xdc,0x87,0x47,0x92,0xb1,0xbd,0x05,0xc9,0x18,
0x0e,0xde,0x4b,0x00,0x70,0x40,0x31,0x1f,0x5d,0x6c,0x8f,0x3a,0xfb,0x9a,0xc3,
0xb3,0x06,0xe7,0x68,0x3f,0x20,0x14,0x1c,0xf9,0x28,0x4b,0x0f,0x01,0x01,0xb6,
0xfe,0x07,0xe5,0xd8,0xf0,0x7c,0x17,0xbc,0xec,0xfb,0xd7,0x73,0x8a,0x71,0x49,
0x79,0x62,0xe4,0xbf,0xb5,0xe3,0x56,0xa6,0xb4,0x49,0x1e,0xdc,0xaf,0xd7,0x0e,
0x30,0x19,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x01,0x30,0x0c,
0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x03,0x04,0x05,0x00 }

Definition at line 2199 of file msg.c.

Referenced by test_decode_msg_update().

◆ envelopedBareMessage

const BYTE envelopedBareMessage[]
static
Initial value:
= {
0x30,0x81,0xe1,0x02,0x01,0x00,0x31,0x81,0xba,0x30,0x81,0xb7,0x02,0x01,0x00,
0x30,0x20,0x30,0x0c,0x31,0x0a,0x30,0x08,0x06,0x03,0x55,0x04,0x03,0x13,0x01,
0x4e,0x02,0x10,0x63,0x75,0x75,0x7a,0x53,0x36,0xa9,0xba,0x41,0xa5,0xcc,0x01,
0x7f,0x76,0x4c,0xd9,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,
0x01,0x01,0x05,0x00,0x04,0x81,0x80,0x69,0x79,0x12,0x6b,0xa1,0x2f,0xe9,0x0d,
0x34,0x79,0x77,0xe9,0x15,0xf2,0xff,0x0c,0x9a,0xf2,0x87,0xbd,0x12,0xc4,0x2d,
0x9e,0x81,0xc7,0x3c,0x74,0x05,0xdc,0x13,0xaf,0xe9,0xa2,0xba,0x72,0xe9,0xa5,
0x2b,0x81,0x39,0xd3,0x62,0xaa,0x78,0xc3,0x90,0x4f,0x06,0xf0,0xdb,0x18,0x5e,
0xe1,0x2e,0x19,0xa3,0xc2,0xac,0x1e,0xf1,0xbf,0xe6,0x03,0x00,0x96,0xfa,0xd2,
0x66,0x73,0xd0,0x45,0x55,0x57,0x71,0xff,0x3a,0x0c,0xad,0xce,0xde,0x68,0xd4,
0x45,0x20,0xc8,0x44,0x4d,0x5d,0xa2,0x98,0x79,0xb1,0x81,0x0f,0x8a,0xfc,0x70,
0xa5,0x18,0xd2,0x30,0x65,0x22,0x84,0x02,0x24,0x48,0xf7,0xa4,0xe0,0xa5,0x6c,
0xa8,0xa4,0xd0,0x86,0x4b,0x6e,0x9b,0x18,0xab,0x78,0xfa,0x76,0x12,0xce,0x55,
0x30,0x1f,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x01,0x30,0x0c,
0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x03,0x04,0x05,0x00,0x80,0x04,0x2c,
0x2d,0xa3,0x6e }

Definition at line 2654 of file msg.c.

Referenced by test_decode_msg_get_param(), and test_msg_control().

◆ envelopedEmptyBareContent

const BYTE envelopedEmptyBareContent[]
static
Initial value:
= {
0x30,0x22,0x02,0x01,0x00,0x31,0x00,0x30,0x1b,0x06,0x09,0x2a,0x86,0x48,0x86,
0xf7,0x0d,0x01,0x07,0x01,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,
0x03,0x04,0x05,0x00,0x80,0x00 }

Definition at line 2152 of file msg.c.

Referenced by test_decode_msg_get_param(), test_decode_msg_update(), test_enveloped_msg_encoding(), and test_msg_control().

◆ envelopedEmptyContent

const BYTE envelopedEmptyContent[]
static
Initial value:
= {
0x30,0x31,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x03,0xa0,0x24,
0x30,0x22,0x02,0x01,0x00,0x31,0x00,0x30,0x1b,0x06,0x09,0x2a,0x86,0x48,0x86,
0xf7,0x0d,0x01,0x07,0x01,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,
0x03,0x04,0x05,0x00,0x80,0x00 }

Definition at line 2156 of file msg.c.

Referenced by test_decode_msg_get_param(), test_decode_msg_update(), and test_enveloped_msg_encoding().

◆ envelopedMessage

const BYTE envelopedMessage[]
static
Initial value:
= {
0x30,0x81,0xf2,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x03,0xa0,
0x81,0xe4,0x30,0x81,0xe1,0x02,0x01,0x00,0x31,0x81,0xba,0x30,0x81,0xb7,0x02,
0x01,0x00,0x30,0x20,0x30,0x0c,0x31,0x0a,0x30,0x08,0x06,0x03,0x55,0x04,0x03,
0x13,0x01,0x4e,0x02,0x10,0x63,0x75,0x75,0x7a,0x53,0x36,0xa9,0xba,0x41,0xa5,
0xcc,0x01,0x7f,0x76,0x4c,0xd9,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,
0x0d,0x01,0x01,0x01,0x05,0x00,0x04,0x81,0x80,0xc2,0x0d,0x59,0x87,0xb3,0x65,
0xd2,0x64,0xcd,0xba,0xe3,0xaf,0x1e,0xa1,0xd3,0xdd,0xb3,0x53,0xfc,0x2f,0xae,
0xdc,0x6d,0x2a,0x81,0x84,0x38,0x6f,0xdf,0x81,0xb1,0x65,0xba,0xac,0x59,0xb1,
0x19,0x12,0x3f,0xde,0x12,0xce,0x77,0x42,0x71,0x67,0xa9,0x78,0x38,0x95,0x51,
0xbb,0x66,0x78,0xbf,0xaf,0x0a,0x98,0x4b,0xba,0xa5,0xf0,0x8b,0x9f,0xef,0xcf,
0x40,0x05,0xa1,0xd6,0x10,0xae,0xbf,0xb9,0xbd,0x4d,0x22,0x39,0x33,0x63,0x2b,
0x0b,0xd3,0x0c,0xb5,0x4b,0xe8,0xfe,0x15,0xa8,0xa5,0x2c,0x86,0x33,0x80,0x6e,
0x4c,0x7a,0x99,0x3c,0x6b,0x4b,0x60,0xfd,0x8e,0xb2,0xf3,0x82,0x2f,0x3e,0x1e,
0xba,0xb9,0x78,0x24,0x32,0xab,0xa4,0x10,0x1a,0x38,0x94,0x10,0x8d,0xf8,0x70,
0x3e,0x4e,0x30,0x1f,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x01,
0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x03,0x04,0x05,0x00,0x80,
0x04,0x5f,0x80,0xf2,0x17 }

Definition at line 2636 of file msg.c.

Referenced by test_decode_msg_get_param().

◆ envelopedMessageWith3Recps

const BYTE envelopedMessageWith3Recps[]
static

Definition at line 2671 of file msg.c.

Referenced by test_decode_msg_get_param().

◆ hashBareContent

const BYTE hashBareContent[]
static
Initial value:
= {
0x30,0x38,0x02,0x01,0x00,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,
0x02,0x05,0x05,0x00,0x30,0x13,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,
0x07,0x01,0xa0,0x06,0x04,0x04,0x01,0x02,0x03,0x04,0x04,0x10,0x08,0xd6,0xc0,
0x5a,0x21,0x51,0x2a,0x79,0xa1,0xdf,0xeb,0x9d,0x2a,0x8f,0x26,0x2f }

Definition at line 874 of file msg.c.

Referenced by test_decode_msg_update(), test_hash_msg_encoding(), and test_msg_control().

◆ hashContent

const BYTE hashContent[]
static
Initial value:
= {
0x30,0x47,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x05,0xa0,0x3a,
0x30,0x38,0x02,0x01,0x00,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,
0x02,0x05,0x05,0x00,0x30,0x13,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,
0x07,0x01,0xa0,0x06,0x04,0x04,0x01,0x02,0x03,0x04,0x04,0x10,0x08,0xd6,0xc0,
0x5a,0x21,0x51,0x2a,0x79,0xa1,0xdf,0xeb,0x9d,0x2a,0x8f,0x26,0x2f }

Definition at line 879 of file msg.c.

Referenced by test_decode_msg_get_param(), test_decode_msg_update(), and test_hash_msg_encoding().

◆ hashEmptyBareContent

const BYTE hashEmptyBareContent[]
static
Initial value:
= {
0x30,0x17,0x02,0x01,0x00,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,
0x02,0x05,0x05,0x00,0x30,0x02,0x06,0x00,0x04,0x00 }

Definition at line 867 of file msg.c.

Referenced by test_decode_msg_update(), test_hash_msg_encoding(), and test_msg_control().

◆ hashEmptyContent

const BYTE hashEmptyContent[]
static
Initial value:
= {
0x30,0x26,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x05,0xa0,0x19,
0x30,0x17,0x02,0x01,0x00,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,
0x02,0x05,0x05,0x00,0x30,0x02,0x06,0x00,0x04,0x00 }

Definition at line 870 of file msg.c.

Referenced by test_decode_msg_get_param(), test_decode_msg_update(), and test_hash_msg_encoding().

◆ hashParam

const BYTE hashParam[]
static
Initial value:
= { 0x08,0xd6,0xc0,0x5a,0x21,0x51,0x2a,0x79,0xa1,
0xdf,0xeb,0x9d,0x2a,0x8f,0x26,0x2f }

Definition at line 2524 of file msg.c.

Referenced by test_decode_msg_get_param().

◆ issuer

const BYTE issuer[]
static
Initial value:
= {
0x30,0x0c,0x31,0x0a,0x30,0x08,0x06,0x03,0x55,0x04,0x03,0x13,0x01,0x58 }

Definition at line 2717 of file msg.c.

◆ keyIdIssuer

BYTE keyIdIssuer[]
static
Initial value:
= {
0x30,0x13,0x31,0x11,0x30,0x0f,0x06,0x0a,0x2b,0x06,0x01,0x04,0x01,0x82,0x37,
0x0a,0x07,0x01,0x04,0x01,0x01 }

Definition at line 2592 of file msg.c.

Referenced by test_decode_msg_get_param().

◆ mod_encoded

BYTE mod_encoded[]
static
Initial value:
= {
0x30,0x10,0x02,0x09,0x00,0x80,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x02,0x03,
0x01,0x00,0x01 }

Definition at line 3025 of file msg.c.

Referenced by test_msg_control().

◆ msg_signed_ecc_prime256v1

const BYTE msg_signed_ecc_prime256v1[]
static

Definition at line 3526 of file msg.c.

Referenced by test_verify_ecc_signature().

◆ msgData

◆ oid_rsa_md5

◆ oid_rsa_rc4

◆ privKey

const BYTE privKey[]
static
Initial value:
= {
0x07, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x52, 0x53, 0x41, 0x32, 0x00,
0x02, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x79, 0x10, 0x1c, 0xd0, 0x6b, 0x10,
0x18, 0x30, 0x94, 0x61, 0xdc, 0x0e, 0xcb, 0x96, 0x4e, 0x21, 0x3f, 0x79, 0xcd,
0xa9, 0x17, 0x62, 0xbc, 0xbb, 0x61, 0x4c, 0xe0, 0x75, 0x38, 0x6c, 0xf3, 0xde,
0x60, 0x86, 0x03, 0x97, 0x65, 0xeb, 0x1e, 0x6b, 0xdb, 0x53, 0x85, 0xad, 0x68,
0x21, 0xf1, 0x5d, 0xe7, 0x1f, 0xe6, 0x53, 0xb4, 0xbb, 0x59, 0x3e, 0x14, 0x27,
0xb1, 0x83, 0xa7, 0x3a, 0x54, 0xe2, 0x8f, 0x65, 0x8e, 0x6a, 0x4a, 0xcf, 0x3b,
0x1f, 0x65, 0xff, 0xfe, 0xf1, 0x31, 0x3a, 0x37, 0x7a, 0x8b, 0xcb, 0xc6, 0xd4,
0x98, 0x50, 0x36, 0x67, 0xe4, 0xa1, 0xe8, 0x7e, 0x8a, 0xc5, 0x23, 0xf2, 0x77,
0xf5, 0x37, 0x61, 0x49, 0x72, 0x59, 0xe8, 0x3d, 0xf7, 0x60, 0xb2, 0x77, 0xca,
0x78, 0x54, 0x6d, 0x65, 0x9e, 0x03, 0x97, 0x1b, 0x61, 0xbd, 0x0c, 0xd8, 0x06,
0x63, 0xe2, 0xc5, 0x48, 0xef, 0xb3, 0xe2, 0x6e, 0x98, 0x7d, 0xbd, 0x4e, 0x72,
0x91, 0xdb, 0x31, 0x57, 0xe3, 0x65, 0x3a, 0x49, 0xca, 0xec, 0xd2, 0x02, 0x4e,
0x22, 0x7e, 0x72, 0x8e, 0xf9, 0x79, 0x84, 0x82, 0xdf, 0x7b, 0x92, 0x2d, 0xaf,
0xc9, 0xe4, 0x33, 0xef, 0x89, 0x5c, 0x66, 0x99, 0xd8, 0x80, 0x81, 0x47, 0x2b,
0xb1, 0x66, 0x02, 0x84, 0x59, 0x7b, 0xc3, 0xbe, 0x98, 0x45, 0x4a, 0x3d, 0xdd,
0xea, 0x2b, 0xdf, 0x4e, 0xb4, 0x24, 0x6b, 0xec, 0xe7, 0xd9, 0x0c, 0x45, 0xb8,
0xbe, 0xca, 0x69, 0x37, 0x92, 0x4c, 0x38, 0x6b, 0x96, 0x6d, 0xcd, 0x86, 0x67,
0x5c, 0xea, 0x54, 0x94, 0xa4, 0xca, 0xa4, 0x02, 0xa5, 0x21, 0x4d, 0xae, 0x40,
0x8f, 0x9d, 0x51, 0x83, 0xf2, 0x3f, 0x33, 0xc1, 0x72, 0xb4, 0x1d, 0x94, 0x6e,
0x7d, 0xe4, 0x27, 0x3f, 0xea, 0xff, 0xe5, 0x9b, 0xa7, 0x5e, 0x55, 0x8e, 0x0d,
0x69, 0x1c, 0x7a, 0xff, 0x81, 0x9d, 0x53, 0x52, 0x97, 0x9a, 0x76, 0x79, 0xda,
0x93, 0x32, 0x16, 0xec, 0x69, 0x51, 0x1a, 0x4e, 0xc3, 0xf1, 0x72, 0x80, 0x78,
0x5e, 0x66, 0x4a, 0x8d, 0x85, 0x2f, 0x3f, 0xb2, 0xa7 }

Definition at line 1122 of file msg.c.

Referenced by test_signed_msg_encoding(), and test_signed_msg_update().

◆ pubKey

BYTE pubKey[]
static
Initial value:
= {
0x30,0x48,0x02,0x41,0x00,0xe2,0x54,0x3a,0xa7,0x83,0xb1,0x27,0x14,0x3e,0x59,
0xbb,0xb4,0x53,0xe6,0x1f,0xe7,0x5d,0xf1,0x21,0x68,0xad,0x85,0x53,0xdb,0x6b,
0x1e,0xeb,0x65,0x97,0x03,0x86,0x60,0xde,0xf3,0x6c,0x38,0x75,0xe0,0x4c,0x61,
0xbb,0xbc,0x62,0x17,0xa9,0xcd,0x79,0x3f,0x21,0x4e,0x96,0xcb,0x0e,0xdc,0x61,
0x94,0x30,0x18,0x10,0x6b,0xd0,0x1c,0x10,0x79,0x02,0x03,0x01,0x00,0x01 }

Definition at line 1147 of file msg.c.

Referenced by CertCreateSelfSignCertificate(), CRYPT_ExportPublicKeyInfoEx(), CRYPT_ImportPublicKeyInfoEx(), CRYPT_MakeCertInfo(), and test_msg_control().

◆ publicPrivateKeyPair

const BYTE publicPrivateKeyPair[]
static

Definition at line 2595 of file msg.c.

Referenced by test_decode_msg_get_param().

◆ serialNum

◆ serialNumber

const BYTE serialNumber[]
static
Initial value:
= {
0x2e,0xcd,0x85,0x84,0x6c,0xe1,0xd7,0x4a,0xbf,0x36,0xdc,0x6b,0xec,0x1f,0xf2,
0x1c }

Definition at line 2714 of file msg.c.

Referenced by CRYPT_CopyKeyIdAsIssuerAndSerial(), test_decode_msg_get_param(), and wmain().

◆ signedBareContent

const BYTE signedBareContent[]
static
Initial value:
= {
0x30,0x81,0xa1,0x02,0x01,0x01,0x31,0x0e,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,
0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,0x13,0x06,0x09,0x2a,0x86,0x48,0x86,
0xf7,0x0d,0x01,0x07,0x01,0xa0,0x06,0x04,0x04,0x01,0x02,0x03,0x04,0x31,0x77,
0x30,0x75,0x02,0x01,0x01,0x30,0x1a,0x30,0x15,0x31,0x13,0x30,0x11,0x06,0x03,
0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,
0x02,0x01,0x01,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x05,
0x05,0x00,0x30,0x04,0x06,0x00,0x05,0x00,0x04,0x40,0x81,0xa6,0x70,0xb3,0xef,
0x59,0xd1,0x66,0xd1,0x9b,0xc0,0x9a,0xb6,0x9a,0x5e,0x6d,0x6f,0x6d,0x0d,0x59,
0xa9,0xaa,0x6e,0xe9,0x2c,0xa0,0x1e,0xee,0xc2,0x60,0xbc,0x59,0xbe,0x3f,0x63,
0x06,0x8d,0xc9,0x11,0x1d,0x23,0x64,0x92,0xef,0x2e,0xfc,0x57,0x29,0xa4,0xaf,
0xe0,0xee,0x93,0x19,0x39,0x51,0xe4,0x44,0xb8,0x0b,0x28,0xf4,0xa8,0x0d }

Definition at line 1311 of file msg.c.

Referenced by test_signed_msg_encoding().

◆ signedContent

const BYTE signedContent[]
static
Initial value:
= {
0x30,0x81,0xb2,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x02,0xa0,
0x81,0xa4,0x30,0x81,0xa1,0x02,0x01,0x01,0x31,0x0e,0x30,0x0c,0x06,0x08,0x2a,
0x86,0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,0x13,0x06,0x09,0x2a,0x86,
0x48,0x86,0xf7,0x0d,0x01,0x07,0x01,0xa0,0x06,0x04,0x04,0x01,0x02,0x03,0x04,
0x31,0x77,0x30,0x75,0x02,0x01,0x01,0x30,0x1a,0x30,0x15,0x31,0x13,0x30,0x11,
0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,
0x67,0x00,0x02,0x01,0x01,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,
0x02,0x05,0x05,0x00,0x30,0x04,0x06,0x00,0x05,0x00,0x04,0x40,0x81,0xa6,0x70,
0xb3,0xef,0x59,0xd1,0x66,0xd1,0x9b,0xc0,0x9a,0xb6,0x9a,0x5e,0x6d,0x6f,0x6d,
0x0d,0x59,0xa9,0xaa,0x6e,0xe9,0x2c,0xa0,0x1e,0xee,0xc2,0x60,0xbc,0x59,0xbe,
0x3f,0x63,0x06,0x8d,0xc9,0x11,0x1d,0x23,0x64,0x92,0xef,0x2e,0xfc,0x57,0x29,
0xa4,0xaf,0xe0,0xee,0x93,0x19,0x39,0x51,0xe4,0x44,0xb8,0x0b,0x28,0xf4,0xa8,
0x0d }

Definition at line 1323 of file msg.c.

Referenced by test_decode_msg_get_param(), test_decode_msg_update(), and test_signed_msg_encoding().

◆ signedEmptyBareContent

const BYTE signedEmptyBareContent[]
static
Initial value:
= {
0x30,0x50,0x02,0x01,0x01,0x31,0x0e,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,
0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,0x02,0x06,0x00,0x31,0x37,0x30,0x35,0x02,
0x01,0x01,0x30,0x1a,0x30,0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,
0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,0x02,0x01,0x01,
0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,
0x04,0x06,0x00,0x05,0x00,0x04,0x00 }

Definition at line 1271 of file msg.c.

Referenced by test_signed_msg_encoding().

◆ signedEmptyContent

const BYTE signedEmptyContent[]
static
Initial value:
= {
0x30,0x5f,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x02,0xa0,0x52,
0x30,0x50,0x02,0x01,0x01,0x31,0x0e,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,
0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,0x02,0x06,0x00,0x31,0x37,0x30,0x35,0x02,
0x01,0x01,0x30,0x1a,0x30,0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,
0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,0x02,0x01,0x01,
0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,
0x04,0x06,0x00,0x05,0x00,0x04,0x00 }

Definition at line 1278 of file msg.c.

Referenced by test_msg_get_and_verify_signer(), and test_signed_msg_encoding().

◆ signedEncodedSigner

const BYTE signedEncodedSigner[]
static
Initial value:
= {
0x30,0x75,0x02,0x01,0x01,0x30,0x1a,0x30,0x15,0x31,0x13,0x30,0x11,0x06,0x03,
0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,
0x02,0x01,0x01,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x05,
0x05,0x00,0x30,0x04,0x06,0x00,0x05,0x00,0x04,0x40,0x81,0xa6,0x70,0xb3,0xef,
0x59,0xd1,0x66,0xd1,0x9b,0xc0,0x9a,0xb6,0x9a,0x5e,0x6d,0x6f,0x6d,0x0d,0x59,
0xa9,0xaa,0x6e,0xe9,0x2c,0xa0,0x1e,0xee,0xc2,0x60,0xbc,0x59,0xbe,0x3f,0x63,
0x06,0x8d,0xc9,0x11,0x1d,0x23,0x64,0x92,0xef,0x2e,0xfc,0x57,0x29,0xa4,0xaf,
0xe0,0xee,0x93,0x19,0x39,0x51,0xe4,0x44,0xb8,0x0b,0x28,0xf4,0xa8,0x0d }

Definition at line 1346 of file msg.c.

Referenced by test_signed_msg_encoding().

◆ signedHash

const BYTE signedHash[]
static
Initial value:
= {
0x08,0xd6,0xc0,0x5a,0x21,0x51,0x2a,0x79,0xa1,0xdf,0xeb,0x9d,0x2a,0x8f,0x26,
0x2f }

Definition at line 1337 of file msg.c.

Referenced by test_signed_msg_encoding().

◆ signedKeyIdEmptyContent

const BYTE signedKeyIdEmptyContent[]
static
Initial value:
= {
0x30,0x46,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x02,0xa0,0x39,
0x30,0x37,0x02,0x01,0x03,0x31,0x0e,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,
0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,0x02,0x06,0x00,0x31,0x1e,0x30,0x1c,0x02,
0x01,0x03,0x80,0x01,0x01,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,
0x02,0x05,0x05,0x00,0x30,0x04,0x06,0x00,0x05,0x00,0x04,0x00 }

Definition at line 1340 of file msg.c.

Referenced by test_decode_msg_get_param(), and test_signed_msg_encoding().

◆ signedWithAuthAttrsBareContent

const BYTE signedWithAuthAttrsBareContent[]
static
Initial value:
= {
0x30,0x82,0x01,0x00,0x02,0x01,0x01,0x31,0x0e,0x30,0x0c,0x06,0x08,0x2a,0x86,
0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,0x13,0x06,0x09,0x2a,0x86,0x48,
0x86,0xf7,0x0d,0x01,0x07,0x01,0xa0,0x06,0x04,0x04,0x01,0x02,0x03,0x04,0x31,
0x81,0xd5,0x30,0x81,0xd2,0x02,0x01,0x01,0x30,0x1a,0x30,0x15,0x31,0x13,0x30,
0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,
0x6e,0x67,0x00,0x02,0x01,0x01,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,
0x0d,0x02,0x05,0x05,0x00,0xa0,0x5b,0x30,0x18,0x06,0x09,0x2a,0x86,0x48,0x86,
0xf7,0x0d,0x01,0x09,0x03,0x31,0x0b,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,
0x01,0x07,0x01,0x30,0x1e,0x06,0x03,0x55,0x04,0x03,0x31,0x17,0x30,0x15,0x31,
0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,
0x4c,0x61,0x6e,0x67,0x00,0x30,0x1f,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,
0x01,0x09,0x04,0x31,0x12,0x04,0x10,0x08,0xd6,0xc0,0x5a,0x21,0x51,0x2a,0x79,
0xa1,0xdf,0xeb,0x9d,0x2a,0x8f,0x26,0x2f,0x30,0x04,0x06,0x00,0x05,0x00,0x04,
0x40,0xbf,0x65,0xde,0x7a,0x3e,0xa2,0x19,0x59,0xc3,0xc7,0x02,0x53,0xc9,0x72,
0xcd,0x74,0x96,0x70,0x0b,0x3b,0xcf,0x8b,0xd9,0x17,0x5c,0xc5,0xd1,0x83,0x41,
0x32,0x93,0xa6,0xf3,0x52,0x83,0x94,0xa9,0x6b,0x0a,0x92,0xcf,0xaf,0x12,0xfa,
0x40,0x53,0x12,0x84,0x03,0xab,0x10,0xa2,0x3d,0xe6,0x9f,0x5a,0xbf,0xc5,0xb8,
0xff,0xc6,0x33,0x63,0x34 }

Definition at line 1355 of file msg.c.

Referenced by test_signed_msg_encoding().

◆ signedWithCertAndCrlBareContent

const BYTE signedWithCertAndCrlBareContent[]
static
Initial value:
= {
0x30,0x82,0x01,0x4f,0x02,0x01,0x01,0x31,0x0e,0x30,0x0c,0x06,0x08,0x2a,0x86,
0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,0x13,0x06,0x09,0x2a,0x86,0x48,
0x86,0xf7,0x0d,0x01,0x07,0x01,0xa0,0x06,0x04,0x04,0x01,0x02,0x03,0x04,0xa0,
0x7c,0x30,0x7a,0x02,0x01,0x01,0x30,0x02,0x06,0x00,0x30,0x15,0x31,0x13,0x30,
0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,
0x6e,0x67,0x00,0x30,0x22,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,
0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,
0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x15,0x31,0x13,0x30,0x11,
0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,
0x67,0x00,0x30,0x07,0x30,0x02,0x06,0x00,0x03,0x01,0x00,0xa3,0x16,0x30,0x14,
0x30,0x12,0x06,0x03,0x55,0x1d,0x13,0x01,0x01,0xff,0x04,0x08,0x30,0x06,0x01,
0x01,0xff,0x02,0x01,0x01,0xa1,0x2e,0x30,0x2c,0x30,0x02,0x06,0x00,0x30,0x15,
0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,
0x20,0x4c,0x61,0x6e,0x67,0x00,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,
0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x31,0x77,0x30,0x75,0x02,0x01,0x01,
0x30,0x1a,0x30,0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,
0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,0x02,0x01,0x01,0x30,0x0c,
0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,0x04,0x06,
0x00,0x05,0x00,0x04,0x40,0x81,0xa6,0x70,0xb3,0xef,0x59,0xd1,0x66,0xd1,0x9b,
0xc0,0x9a,0xb6,0x9a,0x5e,0x6d,0x6f,0x6d,0x0d,0x59,0xa9,0xaa,0x6e,0xe9,0x2c,
0xa0,0x1e,0xee,0xc2,0x60,0xbc,0x59,0xbe,0x3f,0x63,0x06,0x8d,0xc9,0x11,0x1d,
0x23,0x64,0x92,0xef,0x2e,0xfc,0x57,0x29,0xa4,0xaf,0xe0,0xee,0x93,0x19,0x39,
0x51,0xe4,0x44,0xb8,0x0b,0x28,0xf4,0xa8,0x0d }

Definition at line 1481 of file msg.c.

Referenced by test_decode_msg_get_param(), test_decode_msg_update(), and test_signed_msg_encoding().

◆ signedWithCertAndCrlComputedHash

const BYTE signedWithCertAndCrlComputedHash[]
static
Initial value:
= {
0x08,0xd6,0xc0,0x5a,0x21,0x51,0x2a,0x79,0xa1,0xdf,0xeb,0x9d,0x2a,0x8f,0x26,
0x2f }

Definition at line 2589 of file msg.c.

Referenced by test_decode_msg_get_param().

◆ signedWithCertAndCrlEmptyBareContent

const BYTE signedWithCertAndCrlEmptyBareContent[]
static
Initial value:
= {
0x30,0x81,0xfe,0x02,0x01,0x01,0x31,0x0e,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,
0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,0x02,0x06,0x00,0xa0,0x7c,0x30,0x7a,
0x02,0x01,0x01,0x30,0x02,0x06,0x00,0x30,0x15,0x31,0x13,0x30,0x11,0x06,0x03,
0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,
0x30,0x22,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,0x30,
0x30,0x30,0x30,0x5a,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,
0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,
0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,0x30,
0x07,0x30,0x02,0x06,0x00,0x03,0x01,0x00,0xa3,0x16,0x30,0x14,0x30,0x12,0x06,
0x03,0x55,0x1d,0x13,0x01,0x01,0xff,0x04,0x08,0x30,0x06,0x01,0x01,0xff,0x02,
0x01,0x01,0xa1,0x2e,0x30,0x2c,0x30,0x02,0x06,0x00,0x30,0x15,0x31,0x13,0x30,
0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,
0x6e,0x67,0x00,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,
0x30,0x30,0x30,0x30,0x5a,0x31,0x37,0x30,0x35,0x02,0x01,0x01,0x30,0x1a,0x30,
0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,
0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,0x02,0x01,0x01,0x30,0x0c,0x06,0x08,0x2a,
0x86,0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,0x04,0x06,0x00,0x05,0x00,
0x04,0x00 }

Definition at line 1462 of file msg.c.

Referenced by test_signed_msg_encoding().

◆ signedWithCertBareContent

const BYTE signedWithCertBareContent[]
static
Initial value:
= {
0x30,0x82,0x01,0x1f,0x02,0x01,0x01,0x31,0x0e,0x30,0x0c,0x06,0x08,0x2a,0x86,
0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,0x13,0x06,0x09,0x2a,0x86,0x48,
0x86,0xf7,0x0d,0x01,0x07,0x01,0xa0,0x06,0x04,0x04,0x01,0x02,0x03,0x04,0xa0,
0x7c,0x30,0x7a,0x02,0x01,0x01,0x30,0x02,0x06,0x00,0x30,0x15,0x31,0x13,0x30,
0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,
0x6e,0x67,0x00,0x30,0x22,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,
0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,
0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x15,0x31,0x13,0x30,0x11,
0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,
0x67,0x00,0x30,0x07,0x30,0x02,0x06,0x00,0x03,0x01,0x00,0xa3,0x16,0x30,0x14,
0x30,0x12,0x06,0x03,0x55,0x1d,0x13,0x01,0x01,0xff,0x04,0x08,0x30,0x06,0x01,
0x01,0xff,0x02,0x01,0x01,0x31,0x77,0x30,0x75,0x02,0x01,0x01,0x30,0x1a,0x30,
0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,
0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,0x02,0x01,0x01,0x30,0x0c,0x06,0x08,0x2a,
0x86,0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,0x04,0x06,0x00,0x05,0x00,
0x04,0x40,0x81,0xa6,0x70,0xb3,0xef,0x59,0xd1,0x66,0xd1,0x9b,0xc0,0x9a,0xb6,
0x9a,0x5e,0x6d,0x6f,0x6d,0x0d,0x59,0xa9,0xaa,0x6e,0xe9,0x2c,0xa0,0x1e,0xee,
0xc2,0x60,0xbc,0x59,0xbe,0x3f,0x63,0x06,0x8d,0xc9,0x11,0x1d,0x23,0x64,0x92,
0xef,0x2e,0xfc,0x57,0x29,0xa4,0xaf,0xe0,0xee,0x93,0x19,0x39,0x51,0xe4,0x44,
0xb8,0x0b,0x28,0xf4,0xa8,0x0d }

Definition at line 1411 of file msg.c.

Referenced by test_msg_control(), and test_signed_msg_encoding().

◆ signedWithCertEmptyBareContent

const BYTE signedWithCertEmptyBareContent[]
static
Initial value:
= {
0x30,0x81,0xce,0x02,0x01,0x01,0x31,0x0e,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,
0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,0x02,0x06,0x00,0xa0,0x7c,0x30,0x7a,
0x02,0x01,0x01,0x30,0x02,0x06,0x00,0x30,0x15,0x31,0x13,0x30,0x11,0x06,0x03,
0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,
0x30,0x22,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,0x30,
0x30,0x30,0x30,0x5a,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,
0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,
0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,0x30,
0x07,0x30,0x02,0x06,0x00,0x03,0x01,0x00,0xa3,0x16,0x30,0x14,0x30,0x12,0x06,
0x03,0x55,0x1d,0x13,0x01,0x01,0xff,0x04,0x08,0x30,0x06,0x01,0x01,0xff,0x02,
0x01,0x01,0x31,0x37,0x30,0x35,0x02,0x01,0x01,0x30,0x1a,0x30,0x15,0x31,0x13,
0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,
0x61,0x6e,0x67,0x00,0x02,0x01,0x01,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,
0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,0x04,0x06,0x00,0x05,0x00,0x04,0x00 }

Definition at line 1396 of file msg.c.

Referenced by test_signed_msg_encoding().

◆ signedWithCertWithPubKeyBareContent

const BYTE signedWithCertWithPubKeyBareContent[]
static
Initial value:
= {
0x30,0x81,0xeb,0x02,0x01,0x01,0x31,0x0e,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,
0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,0x02,0x06,0x00,0xa0,0x81,0x98,0x30,
0x81,0x95,0x02,0x01,0x01,0x30,0x02,0x06,0x00,0x30,0x15,0x31,0x13,0x30,0x11,
0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,
0x67,0x00,0x30,0x22,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,
0x30,0x30,0x30,0x30,0x30,0x5a,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,
0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x15,0x31,0x13,0x30,0x11,0x06,
0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,
0x00,0x30,0x22,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,
0x01,0x05,0x00,0x03,0x11,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,
0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0xa3,0x16,0x30,0x14,0x30,0x12,0x06,0x03,
0x55,0x1d,0x13,0x01,0x01,0xff,0x04,0x08,0x30,0x06,0x01,0x01,0xff,0x02,0x01,
0x01,0x31,0x37,0x30,0x35,0x02,0x01,0x01,0x30,0x1a,0x30,0x15,0x31,0x13,0x30,
0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,
0x6e,0x67,0x00,0x02,0x01,0x01,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,
0x0d,0x02,0x05,0x05,0x00,0x30,0x04,0x06,0x00,0x05,0x00,0x04,0x00 }

Definition at line 1505 of file msg.c.

Referenced by test_msg_control(), and test_signed_msg_encoding().

◆ signedWithCertWithValidPubKeyContent

const BYTE signedWithCertWithValidPubKeyContent[]
static
Initial value:
= {
0x30,0x82,0x01,0x89,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x02,
0xa0,0x82,0x01,0x7a,0x30,0x82,0x01,0x76,0x02,0x01,0x01,0x31,0x0e,0x30,0x0c,
0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,0x13,0x06,
0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x01,0xa0,0x06,0x04,0x04,0x01,
0x02,0x03,0x04,0xa0,0x81,0xd2,0x30,0x81,0xcf,0x02,0x01,0x01,0x30,0x02,0x06,
0x00,0x30,0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,
0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,0x30,0x22,0x18,0x0f,0x31,0x36,
0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x18,0x0f,
0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,
0x30,0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,
0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,0x30,0x5c,0x30,0x0d,0x06,0x09,0x2a,
0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x01,0x05,0x00,0x03,0x4b,0x00,0x30,0x48,
0x02,0x41,0x00,0xe2,0x54,0x3a,0xa7,0x83,0xb1,0x27,0x14,0x3e,0x59,0xbb,0xb4,
0x53,0xe6,0x1f,0xe7,0x5d,0xf1,0x21,0x68,0xad,0x85,0x53,0xdb,0x6b,0x1e,0xeb,
0x65,0x97,0x03,0x86,0x60,0xde,0xf3,0x6c,0x38,0x75,0xe0,0x4c,0x61,0xbb,0xbc,
0x62,0x17,0xa9,0xcd,0x79,0x3f,0x21,0x4e,0x96,0xcb,0x0e,0xdc,0x61,0x94,0x30,
0x18,0x10,0x6b,0xd0,0x1c,0x10,0x79,0x02,0x03,0x01,0x00,0x01,0xa3,0x16,0x30,
0x14,0x30,0x12,0x06,0x03,0x55,0x1d,0x13,0x01,0x01,0xff,0x04,0x08,0x30,0x06,
0x01,0x01,0xff,0x02,0x01,0x01,0x31,0x77,0x30,0x75,0x02,0x01,0x01,0x30,0x1a,
0x30,0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,
0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,0x02,0x01,0x01,0x30,0x0c,0x06,0x08,
0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,0x04,0x06,0x00,0x05,
0x00,0x04,0x40,0x81,0xa6,0x70,0xb3,0xef,0x59,0xd1,0x66,0xd1,0x9b,0xc0,0x9a,
0xb6,0x9a,0x5e,0x6d,0x6f,0x6d,0x0d,0x59,0xa9,0xaa,0x6e,0xe9,0x2c,0xa0,0x1e,
0xee,0xc2,0x60,0xbc,0x59,0xbe,0x3f,0x63,0x06,0x8d,0xc9,0x11,0x1d,0x23,0x64,
0x92,0xef,0x2e,0xfc,0x57,0x29,0xa4,0xaf,0xe0,0xee,0x93,0x19,0x39,0x51,0xe4,
0x44,0xb8,0x0b,0x28,0xf4,0xa8,0x0d }

Definition at line 1560 of file msg.c.

Referenced by test_msg_control(), test_msg_get_and_verify_signer(), and test_signed_msg_encoding().

◆ signedWithCertWithValidPubKeyEmptyContent

const BYTE signedWithCertWithValidPubKeyEmptyContent[]
static
Initial value:
= {
0x30,0x82,0x01,0x38,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x02,
0xa0,0x82,0x01,0x29,0x30,0x82,0x01,0x25,0x02,0x01,0x01,0x31,0x0e,0x30,0x0c,
0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,0x02,0x06,
0x00,0xa0,0x81,0xd2,0x30,0x81,0xcf,0x02,0x01,0x01,0x30,0x02,0x06,0x00,0x30,
0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,
0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,0x30,0x22,0x18,0x0f,0x31,0x36,0x30,0x31,
0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x18,0x0f,0x31,0x36,
0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x15,
0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,
0x20,0x4c,0x61,0x6e,0x67,0x00,0x30,0x5c,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,
0x86,0xf7,0x0d,0x01,0x01,0x01,0x05,0x00,0x03,0x4b,0x00,0x30,0x48,0x02,0x41,
0x00,0xe2,0x54,0x3a,0xa7,0x83,0xb1,0x27,0x14,0x3e,0x59,0xbb,0xb4,0x53,0xe6,
0x1f,0xe7,0x5d,0xf1,0x21,0x68,0xad,0x85,0x53,0xdb,0x6b,0x1e,0xeb,0x65,0x97,
0x03,0x86,0x60,0xde,0xf3,0x6c,0x38,0x75,0xe0,0x4c,0x61,0xbb,0xbc,0x62,0x17,
0xa9,0xcd,0x79,0x3f,0x21,0x4e,0x96,0xcb,0x0e,0xdc,0x61,0x94,0x30,0x18,0x10,
0x6b,0xd0,0x1c,0x10,0x79,0x02,0x03,0x01,0x00,0x01,0xa3,0x16,0x30,0x14,0x30,
0x12,0x06,0x03,0x55,0x1d,0x13,0x01,0x01,0xff,0x04,0x08,0x30,0x06,0x01,0x01,
0xff,0x02,0x01,0x01,0x31,0x37,0x30,0x35,0x02,0x01,0x01,0x30,0x1a,0x30,0x15,
0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,
0x20,0x4c,0x61,0x6e,0x67,0x00,0x02,0x01,0x01,0x30,0x0c,0x06,0x08,0x2a,0x86,
0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,0x04,0x06,0x00,0x05,0x00,0x04,
0x00 }

Definition at line 1537 of file msg.c.

Referenced by test_msg_control(), and test_signed_msg_encoding().

◆ signedWithCrlBareContent

const BYTE signedWithCrlBareContent[]
static
Initial value:
= {
0x30,0x81,0xd1,0x02,0x01,0x01,0x31,0x0e,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,
0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,0x13,0x06,0x09,0x2a,0x86,0x48,0x86,
0xf7,0x0d,0x01,0x07,0x01,0xa0,0x06,0x04,0x04,0x01,0x02,0x03,0x04,0xa1,0x2e,
0x30,0x2c,0x30,0x02,0x06,0x00,0x30,0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,
0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,0x18,
0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,
0x5a,0x31,0x77,0x30,0x75,0x02,0x01,0x01,0x30,0x1a,0x30,0x15,0x31,0x13,0x30,
0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,
0x6e,0x67,0x00,0x02,0x01,0x01,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,
0x0d,0x02,0x05,0x05,0x00,0x30,0x04,0x06,0x00,0x05,0x00,0x04,0x40,0x81,0xa6,
0x70,0xb3,0xef,0x59,0xd1,0x66,0xd1,0x9b,0xc0,0x9a,0xb6,0x9a,0x5e,0x6d,0x6f,
0x6d,0x0d,0x59,0xa9,0xaa,0x6e,0xe9,0x2c,0xa0,0x1e,0xee,0xc2,0x60,0xbc,0x59,
0xbe,0x3f,0x63,0x06,0x8d,0xc9,0x11,0x1d,0x23,0x64,0x92,0xef,0x2e,0xfc,0x57,
0x29,0xa4,0xaf,0xe0,0xee,0x93,0x19,0x39,0x51,0xe4,0x44,0xb8,0x0b,0x28,0xf4,
0xa8,0x0d }

Definition at line 1446 of file msg.c.

Referenced by test_signed_msg_encoding().

◆ signedWithCrlEmptyBareContent

const BYTE signedWithCrlEmptyBareContent[]
static
Initial value:
= {
0x30,0x81,0x80,0x02,0x01,0x01,0x31,0x0e,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,
0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,0x02,0x06,0x00,0xa1,0x2e,0x30,0x2c,
0x30,0x02,0x06,0x00,0x30,0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,
0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,0x18,0x0f,0x31,
0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x31,
0x37,0x30,0x35,0x02,0x01,0x01,0x30,0x1a,0x30,0x15,0x31,0x13,0x30,0x11,0x06,
0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,
0x00,0x02,0x01,0x01,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,
0x05,0x05,0x00,0x30,0x04,0x06,0x00,0x05,0x00,0x04,0x00 }

Definition at line 1436 of file msg.c.

Referenced by test_signed_msg_encoding().

◆ u1

BYTE u1[]
static
Initial value:
= { 0x30,0x0f,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,
0x07,0x01,0xa0,0x02,0x04,0x00 }

Definition at line 526 of file msg.c.

◆ u2

BYTE u2[] = { 0x01,0x02,0x03,0x04 }
static

Definition at line 528 of file msg.c.

◆ u3

BYTE u3[]
static
Initial value:
= { 0x30,0x13,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,
0x07,0x01,0xa0,0x06,0x04,0x04 }

Definition at line 536 of file msg.c.

Referenced by __ieee754_y0(), DDRAW_dump_surface_desc(), ddraw_match_surface_desc(), MACRO_PositionWindow(), MiCheckSecuredVad(), MiFindContiguousPages(), MiFreeContiguousMemory(), and spDivide().

◆ u4

BYTE u4[]
static
Initial value:
= { 0x30,0x80,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,
0x07,0x01,0xa0,0x80,0x24,0x80 }

Definition at line 544 of file msg.c.

Referenced by DDRAW_dump_surface_desc().

◆ u5

BYTE u5[] = { 0x04,0x04 }
static

Definition at line 546 of file msg.c.

Referenced by DDRAW_dump_surface_desc(), and ddraw_match_surface_desc().

◆ u6

BYTE u6[] = { 0x00,0x00,0x00,0x00,0x00,0x00 }
static

Definition at line 547 of file msg.c.

◆ unsignedEmptyBareContent

const BYTE unsignedEmptyBareContent[]
static
Initial value:
= {
0x30,0x0b,0x02,0x01,0x01,0x31,0x00,0x30,0x02,0x06,0x00,0x31,0x00 }

Definition at line 1259 of file msg.c.

Referenced by test_signed_msg_encoding().

◆ unsignedEmptyContent

const BYTE unsignedEmptyContent[]
static
Initial value:
= {
0x30,0x1a,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x02,0xa0,0x0d,
0x30,0x0b,0x02,0x01,0x01,0x31,0x00,0x30,0x02,0x06,0x00,0x31,0x00 }

Definition at line 1261 of file msg.c.

Referenced by test_signed_msg_encoding().

◆ v1CertWithPubKey

BYTE v1CertWithPubKey[]
static
Initial value:
= {
0x30,0x81,0x95,0x02,0x01,0x01,0x30,0x02,0x06,0x00,0x30,0x15,0x31,0x13,0x30,
0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,
0x6e,0x67,0x00,0x30,0x22,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,
0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,
0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x15,0x31,0x13,0x30,0x11,
0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,
0x67,0x00,0x30,0x22,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,
0x01,0x01,0x05,0x00,0x03,0x11,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0xa3,0x16,0x30,0x14,0x30,0x12,0x06,
0x03,0x55,0x1d,0x13,0x01,0x01,0xff,0x04,0x08,0x30,0x06,0x01,0x01,0xff,0x02,
0x01,0x01 }

Definition at line 1384 of file msg.c.

Referenced by test_signed_msg_encoding().

◆ v1CertWithValidPubKey

BYTE v1CertWithValidPubKey[]
static
Initial value:
= {
0x30,0x81,0xcf,0x02,0x01,0x01,0x30,0x02,0x06,0x00,0x30,0x15,0x31,0x13,0x30,
0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,
0x6e,0x67,0x00,0x30,0x22,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,
0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,
0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x15,0x31,0x13,0x30,0x11,
0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,
0x67,0x00,0x30,0x5c,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,
0x01,0x01,0x05,0x00,0x03,0x4b,0x00,0x30,0x48,0x02,0x41,0x00,0xe2,0x54,0x3a,
0xa7,0x83,0xb1,0x27,0x14,0x3e,0x59,0xbb,0xb4,0x53,0xe6,0x1f,0xe7,0x5d,0xf1,
0x21,0x68,0xad,0x85,0x53,0xdb,0x6b,0x1e,0xeb,0x65,0x97,0x03,0x86,0x60,0xde,
0xf3,0x6c,0x38,0x75,0xe0,0x4c,0x61,0xbb,0xbc,0x62,0x17,0xa9,0xcd,0x79,0x3f,
0x21,0x4e,0x96,0xcb,0x0e,0xdc,0x61,0x94,0x30,0x18,0x10,0x6b,0xd0,0x1c,0x10,
0x79,0x02,0x03,0x01,0x00,0x01,0xa3,0x16,0x30,0x14,0x30,0x12,0x06,0x03,0x55,
0x1d,0x13,0x01,0x01,0xff,0x04,0x08,0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01 }

Definition at line 1522 of file msg.c.

Referenced by test_enveloped_msg_open(), test_msg_get_and_verify_signer(), and test_signed_msg_encoding().