20#include <winpr/cred.h>
25 BYTE source[CERT_HASH_LENGTH];
28static const TestItem testValues[] = {
29 {
"@@BQ9eNR0KWVU-CT8sPCp8z37POZHJ",
30 { 0x50, 0xef, 0x35, 0x11, 0xad, 0x58, 0x15, 0xf5, 0x0b, 0x13,
31 0xcf, 0x3e, 0x42, 0xca, 0xcf, 0xf7, 0xfe, 0x38, 0xd9, 0x91 } },
32 {
"@@BKay-HwJsFZzclXAWZ#nO6Eluc7P",
33 { 0x8a, 0x26, 0xff, 0x07, 0x9c, 0xb0, 0x45, 0x36, 0x73, 0xe5,
34 0x05, 0x58, 0x99, 0x7f, 0x3a, 0x3a, 0x51, 0xba, 0xdc, 0xfe }
39static int TestUnmarshal(WINPR_ATTR_UNUSED
int argc, WINPR_ATTR_UNUSED
char** argv)
42 for (
size_t i = 0; i < ARRAYSIZE(testValues); i++)
44 CRED_MARSHAL_TYPE t = BinaryBlobForSystem;
46 const TestItem*
const val = &testValues[i];
48 if (!CredUnmarshalCredentialA(val->marshalled, &t, (
void**)&certInfo) || !certInfo ||
49 (t != CertCredential))
53 memcmp(val->source, certInfo->rgbHashOfCert,
sizeof(certInfo->rgbHashOfCert)) == 0;
63static int TestMarshal(WINPR_ATTR_UNUSED
int argc, WINPR_ATTR_UNUSED
char** argv)
66 for (
size_t i = 0; i < ARRAYSIZE(testValues); i++)
69 const TestItem*
const val = &testValues[i];
71 memcpy(certInfo.rgbHashOfCert, val->source,
sizeof(certInfo.rgbHashOfCert));
74 if (!CredMarshalCredentialA(CertCredential, &certInfo, &out) || !out)
77 BOOL ok = (strcmp(val->marshalled, out) == 0);
87int TestMarshalUnmarshal(
int argc,
char** argv)
89 int ret = TestUnmarshal(argc, argv);
93 ret = TestMarshal(argc, argv);