20#include <winpr/cred.h>
25 BYTE source[CERT_HASH_LENGTH];
28static TestItem testValues[] = { {
"@@BQ9eNR0KWVU-CT8sPCp8z37POZHJ",
29 { 0x50, 0xef, 0x35, 0x11, 0xad, 0x58, 0x15, 0xf5, 0x0b, 0x13,
30 0xcf, 0x3e, 0x42, 0xca, 0xcf, 0xf7, 0xfe, 0x38, 0xd9, 0x91 } },
31 {
"@@BKay-HwJsFZzclXAWZ#nO6Eluc7P",
32 { 0x8a, 0x26, 0xff, 0x07, 0x9c, 0xb0, 0x45, 0x36, 0x73, 0xe5,
33 0x05, 0x58, 0x99, 0x7f, 0x3a, 0x3a, 0x51, 0xba, 0xdc, 0xfe }
37static int TestUnmarshal(
int argc,
char** argv)
40 for (
int i = 0; i < ARRAYSIZE(testValues); i++)
42 CRED_MARSHAL_TYPE t = BinaryBlobForSystem;
45 if (!CredUnmarshalCredentialA(testValues[i].marshalled, &t, &certInfo) || !certInfo ||
49 BOOL ok = memcmp(testValues[i].source, certInfo->rgbHashOfCert,
50 sizeof(certInfo->rgbHashOfCert)) == 0;
60static int TestMarshal(
int argc,
char** argv)
63 for (
int i = 0; i < ARRAYSIZE(testValues); i++)
65 CRED_MARSHAL_TYPE t = BinaryBlobForSystem;
67 memcpy(certInfo.rgbHashOfCert, testValues[i].source,
sizeof(certInfo.rgbHashOfCert));
70 if (!CredMarshalCredentialA(CertCredential, &certInfo, &out) || !out)
73 BOOL ok = (strcmp(testValues[i].marshalled, out) == 0);
83int TestMarshalUnmarshal(
int argc,
char** argv)
85 int ret = TestUnmarshal(argc, argv);
89 ret = TestMarshal(argc, argv);