4 * Copyright 2006 Juan Lang
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #define SECURITY_WIN32
28 #include "wine/test.h"
30 static HMODULE secdll;
31 static SECURITY_STATUS (SEC_ENTRY * pAcquireCredentialsHandleA)(SEC_CHAR*, SEC_CHAR*,
32 ULONG, PLUID, PVOID, SEC_GET_KEY_FN, PVOID, PCredHandle, PTimeStamp);
33 static SECURITY_STATUS (SEC_ENTRY * pFreeCredentialsHandle)(PCredHandle);
35 static const BYTE bigCert[] = { 0x30, 0x7a, 0x02, 0x01, 0x01, 0x30, 0x02, 0x06,
36 0x00, 0x30, 0x15, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13,
37 0x0a, 0x4a, 0x75, 0x61, 0x6e, 0x20, 0x4c, 0x61, 0x6e, 0x67, 0x00, 0x30, 0x22,
38 0x18, 0x0f, 0x31, 0x36, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30,
39 0x30, 0x30, 0x30, 0x5a, 0x18, 0x0f, 0x31, 0x36, 0x30, 0x31, 0x30, 0x31, 0x30,
40 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x30, 0x15, 0x31, 0x13, 0x30,
41 0x11, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x0a, 0x4a, 0x75, 0x61, 0x6e, 0x20,
42 0x4c, 0x61, 0x6e, 0x67, 0x00, 0x30, 0x07, 0x30, 0x02, 0x06, 0x00, 0x03, 0x01,
43 0x00, 0xa3, 0x16, 0x30, 0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01,
44 0x01, 0xff, 0x04, 0x08, 0x30, 0x06, 0x01, 0x01, 0xff, 0x02, 0x01, 0x01 };
45 static const WCHAR cspNameW[] = { 'W','i','n','e','C','r','y','p','t','T','e',
47 static const BYTE privKey[] = {
48 0x07, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x52, 0x53, 0x41, 0x32, 0x00,
49 0x02, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x79, 0x10, 0x1c, 0xd0, 0x6b, 0x10,
50 0x18, 0x30, 0x94, 0x61, 0xdc, 0x0e, 0xcb, 0x96, 0x4e, 0x21, 0x3f, 0x79, 0xcd,
51 0xa9, 0x17, 0x62, 0xbc, 0xbb, 0x61, 0x4c, 0xe0, 0x75, 0x38, 0x6c, 0xf3, 0xde,
52 0x60, 0x86, 0x03, 0x97, 0x65, 0xeb, 0x1e, 0x6b, 0xdb, 0x53, 0x85, 0xad, 0x68,
53 0x21, 0xf1, 0x5d, 0xe7, 0x1f, 0xe6, 0x53, 0xb4, 0xbb, 0x59, 0x3e, 0x14, 0x27,
54 0xb1, 0x83, 0xa7, 0x3a, 0x54, 0xe2, 0x8f, 0x65, 0x8e, 0x6a, 0x4a, 0xcf, 0x3b,
55 0x1f, 0x65, 0xff, 0xfe, 0xf1, 0x31, 0x3a, 0x37, 0x7a, 0x8b, 0xcb, 0xc6, 0xd4,
56 0x98, 0x50, 0x36, 0x67, 0xe4, 0xa1, 0xe8, 0x7e, 0x8a, 0xc5, 0x23, 0xf2, 0x77,
57 0xf5, 0x37, 0x61, 0x49, 0x72, 0x59, 0xe8, 0x3d, 0xf7, 0x60, 0xb2, 0x77, 0xca,
58 0x78, 0x54, 0x6d, 0x65, 0x9e, 0x03, 0x97, 0x1b, 0x61, 0xbd, 0x0c, 0xd8, 0x06,
59 0x63, 0xe2, 0xc5, 0x48, 0xef, 0xb3, 0xe2, 0x6e, 0x98, 0x7d, 0xbd, 0x4e, 0x72,
60 0x91, 0xdb, 0x31, 0x57, 0xe3, 0x65, 0x3a, 0x49, 0xca, 0xec, 0xd2, 0x02, 0x4e,
61 0x22, 0x7e, 0x72, 0x8e, 0xf9, 0x79, 0x84, 0x82, 0xdf, 0x7b, 0x92, 0x2d, 0xaf,
62 0xc9, 0xe4, 0x33, 0xef, 0x89, 0x5c, 0x66, 0x99, 0xd8, 0x80, 0x81, 0x47, 0x2b,
63 0xb1, 0x66, 0x02, 0x84, 0x59, 0x7b, 0xc3, 0xbe, 0x98, 0x45, 0x4a, 0x3d, 0xdd,
64 0xea, 0x2b, 0xdf, 0x4e, 0xb4, 0x24, 0x6b, 0xec, 0xe7, 0xd9, 0x0c, 0x45, 0xb8,
65 0xbe, 0xca, 0x69, 0x37, 0x92, 0x4c, 0x38, 0x6b, 0x96, 0x6d, 0xcd, 0x86, 0x67,
66 0x5c, 0xea, 0x54, 0x94, 0xa4, 0xca, 0xa4, 0x02, 0xa5, 0x21, 0x4d, 0xae, 0x40,
67 0x8f, 0x9d, 0x51, 0x83, 0xf2, 0x3f, 0x33, 0xc1, 0x72, 0xb4, 0x1d, 0x94, 0x6e,
68 0x7d, 0xe4, 0x27, 0x3f, 0xea, 0xff, 0xe5, 0x9b, 0xa7, 0x5e, 0x55, 0x8e, 0x0d,
69 0x69, 0x1c, 0x7a, 0xff, 0x81, 0x9d, 0x53, 0x52, 0x97, 0x9a, 0x76, 0x79, 0xda,
70 0x93, 0x32, 0x16, 0xec, 0x69, 0x51, 0x1a, 0x4e, 0xc3, 0xf1, 0x72, 0x80, 0x78,
71 0x5e, 0x66, 0x4a, 0x8d, 0x85, 0x2f, 0x3f, 0xb2, 0xa7 };
73 static const BYTE selfSignedCert[] = {
74 0x30, 0x82, 0x01, 0x1f, 0x30, 0x81, 0xce, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02,
75 0x10, 0xeb, 0x0d, 0x57, 0x2a, 0x9c, 0x09, 0xba, 0xa4, 0x4a, 0xb7, 0x25, 0x49,
76 0xd9, 0x3e, 0xb5, 0x73, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1d,
77 0x05, 0x00, 0x30, 0x15, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x03,
78 0x13, 0x0a, 0x4a, 0x75, 0x61, 0x6e, 0x20, 0x4c, 0x61, 0x6e, 0x67, 0x00, 0x30,
79 0x1e, 0x17, 0x0d, 0x30, 0x36, 0x30, 0x36, 0x32, 0x39, 0x30, 0x35, 0x30, 0x30,
80 0x34, 0x36, 0x5a, 0x17, 0x0d, 0x30, 0x37, 0x30, 0x36, 0x32, 0x39, 0x31, 0x31,
81 0x30, 0x30, 0x34, 0x36, 0x5a, 0x30, 0x15, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03,
82 0x55, 0x04, 0x03, 0x13, 0x0a, 0x4a, 0x75, 0x61, 0x6e, 0x20, 0x4c, 0x61, 0x6e,
83 0x67, 0x00, 0x30, 0x5c, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
84 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x4b, 0x00, 0x30, 0x48, 0x02, 0x41,
85 0x00, 0xe2, 0x54, 0x3a, 0xa7, 0x83, 0xb1, 0x27, 0x14, 0x3e, 0x59, 0xbb, 0xb4,
86 0x53, 0xe6, 0x1f, 0xe7, 0x5d, 0xf1, 0x21, 0x68, 0xad, 0x85, 0x53, 0xdb, 0x6b,
87 0x1e, 0xeb, 0x65, 0x97, 0x03, 0x86, 0x60, 0xde, 0xf3, 0x6c, 0x38, 0x75, 0xe0,
88 0x4c, 0x61, 0xbb, 0xbc, 0x62, 0x17, 0xa9, 0xcd, 0x79, 0x3f, 0x21, 0x4e, 0x96,
89 0xcb, 0x0e, 0xdc, 0x61, 0x94, 0x30, 0x18, 0x10, 0x6b, 0xd0, 0x1c, 0x10, 0x79,
90 0x02, 0x03, 0x01, 0x00, 0x01, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02,
91 0x1d, 0x05, 0x00, 0x03, 0x41, 0x00, 0x25, 0x90, 0x53, 0x34, 0xd9, 0x56, 0x41,
92 0x5e, 0xdb, 0x7e, 0x01, 0x36, 0xec, 0x27, 0x61, 0x5e, 0xb7, 0x4d, 0x90, 0x66,
93 0xa2, 0xe1, 0x9d, 0x58, 0x76, 0xd4, 0x9c, 0xba, 0x2c, 0x84, 0xc6, 0x83, 0x7a,
94 0x22, 0x0d, 0x03, 0x69, 0x32, 0x1a, 0x6d, 0xcb, 0x0c, 0x15, 0xb3, 0x6b, 0xc7,
95 0x0a, 0x8c, 0xb4, 0x5c, 0x34, 0x78, 0xe0, 0x3c, 0x9c, 0xe9, 0xf3, 0x30, 0x9f,
96 0xa8, 0x76, 0x57, 0x92, 0x36 };
98 static void InitFunctionPtrs(void)
100 secdll = LoadLibraryA("secur32.dll");
102 secdll = LoadLibraryA("security.dll");
105 pAcquireCredentialsHandleA = (PVOID)GetProcAddress(secdll, "AcquireCredentialsHandleA");
106 pFreeCredentialsHandle = (PVOID)GetProcAddress(secdll, "FreeCredentialsHandle");
110 static void testAcquireSecurityContext(void)
115 SCHANNEL_CRED schanCred;
116 PCCERT_CONTEXT certs[2];
118 static CHAR unisp_name_a[] = UNISP_NAME_A;
121 CRYPT_KEY_PROV_INFO keyProvInfo;
123 keyProvInfo.pwszContainerName = (LPWSTR)cspNameW;
124 keyProvInfo.pwszProvName = (LPWSTR)MS_DEF_PROV_W;
125 keyProvInfo.dwProvType = PROV_RSA_FULL;
126 keyProvInfo.dwFlags = 0;
127 keyProvInfo.cProvParam = 0;
128 keyProvInfo.rgProvParam = NULL;
129 keyProvInfo.dwKeySpec = AT_SIGNATURE;
131 certs[0] = CertCreateCertificateContext(X509_ASN_ENCODING, bigCert,
133 certs[1] = CertCreateCertificateContext(X509_ASN_ENCODING, selfSignedCert,
134 sizeof(selfSignedCert));
136 CryptAcquireContextW(&csp, cspNameW, MS_DEF_PROV_W, PROV_RSA_FULL,
139 st = pAcquireCredentialsHandleA(NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL,
141 ok(st == SEC_E_SECPKG_NOT_FOUND,
142 "Expected SEC_E_SECPKG_NOT_FOUND, got %08x\n", st);
145 /* Crashes on Win2K */
146 st = pAcquireCredentialsHandleA(NULL, unisp_name_a, 0, NULL, NULL, NULL,
148 ok(st == SEC_E_NO_CREDENTIALS, "Expected SEC_E_NO_CREDENTIALS, got %08x\n",
151 st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_BOTH, NULL,
152 NULL, NULL, NULL, NULL, NULL);
153 ok(st == SEC_E_NO_CREDENTIALS, "Expected SEC_E_NO_CREDENTIALS, got %08x\n",
155 st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND,
156 NULL, NULL, NULL, NULL, NULL, NULL);
157 ok(st == SEC_E_NO_CREDENTIALS, "Expected SEC_E_NO_CREDENTIALS, got %08x\n",
162 st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND,
163 NULL, NULL, NULL, NULL, NULL, NULL);
165 st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND,
166 NULL, NULL, NULL, NULL, &cred, NULL);
167 ok(st == SEC_E_OK, "AcquireCredentialsHandleA failed: %08x\n", st);
168 pFreeCredentialsHandle(&cred);
169 memset(&cred, 0, sizeof(cred));
170 st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND,
171 NULL, NULL, NULL, NULL, &cred, &exp);
172 ok(st == SEC_E_OK, "AcquireCredentialsHandleA failed: %08x\n", st);
173 ok(exp.HighPart == 0 && exp.LowPart == 0,
174 "Expected 0 expiry, got %08lx%08lx\n", exp.HighPart, exp.LowPart);
175 pFreeCredentialsHandle(&cred);
177 /* Bad version in SCHANNEL_CRED */
178 memset(&schanCred, 0, sizeof(schanCred));
179 st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND,
180 NULL, &schanCred, NULL, NULL, NULL, NULL);
181 ok(st == SEC_E_INTERNAL_ERROR, "Expected SEC_E_INTERNAL_ERROR, got %08x\n",
183 st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND,
184 NULL, &schanCred, NULL, NULL, NULL, NULL);
185 ok(st == SEC_E_INTERNAL_ERROR, "Expected SEC_E_INTERNAL_ERROR, got %08x\n",
188 /* No cert in SCHANNEL_CRED succeeds for outbound.. */
189 schanCred.dwVersion = SCHANNEL_CRED_VERSION;
190 st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND,
191 NULL, &schanCred, NULL, NULL, &cred, NULL);
192 ok(st == SEC_E_OK, "AcquireCredentialsHandleA failed: %08x\n", st);
193 pFreeCredentialsHandle(&cred);
194 /* but fails for inbound. */
195 st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND,
196 NULL, &schanCred, NULL, NULL, NULL, NULL);
197 ok(st == SEC_E_NO_CREDENTIALS, "Expected SEC_E_NO_CREDENTIALS, got %08x\n",
202 /* Crashes with bad paCred pointer */
203 schanCred.cCreds = 1;
204 st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND,
205 NULL, &schanCred, NULL, NULL, NULL, NULL);
208 /* Bogus cert in SCHANNEL_CRED. Windows fails with
209 * SEC_E_UNKNOWN_CREDENTIALS, but I'll accept SEC_E_NO_CREDENTIALS too.
211 schanCred.cCreds = 1;
212 schanCred.paCred = &certs[0];
213 st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND,
214 NULL, &schanCred, NULL, NULL, NULL, NULL);
215 ok(st == SEC_E_UNKNOWN_CREDENTIALS || SEC_E_NO_CREDENTIALS,
216 "Expected SEC_E_UNKNOWN_CREDENTIALS or SEC_E_NO_CREDENTIALS, got %08x\n",
218 st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND,
219 NULL, &schanCred, NULL, NULL, NULL, NULL);
220 ok(st == SEC_E_UNKNOWN_CREDENTIALS || SEC_E_NO_CREDENTIALS,
221 "Expected SEC_E_UNKNOWN_CREDENTIALS or SEC_E_NO_CREDENTIALS, got %08x\n",
224 /* Good cert, but missing private key. Windows fails with
225 * SEC_E_NO_CREDENTIALS, but I'll accept SEC_E_UNKNOWN_CREDENTIALS too.
227 schanCred.cCreds = 1;
228 schanCred.paCred = &certs[1];
229 st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND,
230 NULL, &schanCred, NULL, NULL, &cred, NULL);
231 ok(st == SEC_E_UNKNOWN_CREDENTIALS || SEC_E_NO_CREDENTIALS,
232 "Expected SEC_E_UNKNOWN_CREDENTIALS or SEC_E_NO_CREDENTIALS, got %08x\n",
234 st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND,
235 NULL, &schanCred, NULL, NULL, NULL, NULL);
236 ok(st == SEC_E_UNKNOWN_CREDENTIALS || SEC_E_NO_CREDENTIALS,
237 "Expected SEC_E_UNKNOWN_CREDENTIALS or SEC_E_NO_CREDENTIALS, got %08x\n",
240 /* Good cert, with CRYPT_KEY_PROV_INFO set before it's had a key loaded. */
241 ret = CertSetCertificateContextProperty(certs[1],
242 CERT_KEY_PROV_INFO_PROP_ID, 0, &keyProvInfo);
243 schanCred.dwVersion = SCH_CRED_V3;
244 st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND,
245 NULL, &schanCred, NULL, NULL, &cred, NULL);
246 ok(st == SEC_E_UNKNOWN_CREDENTIALS,
247 "Expected SEC_E_UNKNOWN_CREDENTIALS, got %08x\n", st);
248 st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND,
249 NULL, &schanCred, NULL, NULL, &cred, NULL);
250 ok(st == SEC_E_UNKNOWN_CREDENTIALS,
251 "Expected SEC_E_UNKNOWN_CREDENTIALS, got %08x\n", st);
253 ret = CryptAcquireContextW(&csp, cspNameW, MS_DEF_PROV_W, PROV_RSA_FULL,
255 ok(ret, "CryptAcquireContextW failed: %08x\n", GetLastError());
256 ret = CryptImportKey(csp, (LPBYTE)privKey, sizeof(privKey), 0, 0, &key);
257 ok(ret, "CryptImportKey failed: %08x\n", GetLastError());
265 st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND,
266 NULL, &schanCred, NULL, NULL, NULL, NULL);
268 /* Good cert with private key, bogus version */
269 schanCred.dwVersion = SCH_CRED_V1;
270 st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND,
271 NULL, &schanCred, NULL, NULL, &cred, NULL);
272 ok(st == SEC_E_INTERNAL_ERROR,
273 "Expected SEC_E_INTERNAL_ERROR, got %08x\n", st);
274 st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND,
275 NULL, &schanCred, NULL, NULL, &cred, NULL);
276 ok(st == SEC_E_INTERNAL_ERROR,
277 "Expected SEC_E_INTERNAL_ERROR, got %08x\n", st);
278 schanCred.dwVersion = SCH_CRED_V2;
279 st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND,
280 NULL, &schanCred, NULL, NULL, &cred, NULL);
281 ok(st == SEC_E_INTERNAL_ERROR,
282 "Expected SEC_E_INTERNAL_ERROR, got %08x\n", st);
283 st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND,
284 NULL, &schanCred, NULL, NULL, &cred, NULL);
285 ok(st == SEC_E_INTERNAL_ERROR,
286 "Expected SEC_E_INTERNAL_ERROR, got %08x\n", st);
288 /* Succeeds on V3 or higher */
289 schanCred.dwVersion = SCH_CRED_V3;
290 st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND,
291 NULL, &schanCred, NULL, NULL, &cred, NULL);
292 ok(st == SEC_E_OK, "AcquireCredentialsHandleA failed: %08x\n", st);
293 pFreeCredentialsHandle(&cred);
294 st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND,
295 NULL, &schanCred, NULL, NULL, &cred, NULL);
296 ok(st == SEC_E_OK, "AcquireCredentialsHandleA failed: %08x\n", st);
297 pFreeCredentialsHandle(&cred);
298 schanCred.dwVersion = SCHANNEL_CRED_VERSION;
299 st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND,
300 NULL, &schanCred, NULL, NULL, &cred, NULL);
301 ok(st == SEC_E_OK, "AcquireCredentialsHandleA failed: %08x\n", st);
302 pFreeCredentialsHandle(&cred);
303 st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND,
304 NULL, &schanCred, NULL, NULL, &cred, NULL);
305 ok(st == SEC_E_OK, "AcquireCredentialsHandleA failed: %08x\n", st);
306 pFreeCredentialsHandle(&cred);
308 /* How about more than one cert? */
309 schanCred.cCreds = 2;
310 schanCred.paCred = certs;
311 st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND,
312 NULL, &schanCred, NULL, NULL, &cred, NULL);
313 ok(st == SEC_E_UNKNOWN_CREDENTIALS,
314 "Expected SEC_E_UNKNOWN_CREDENTIALS, got %08x\n", st);
315 st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND,
316 NULL, &schanCred, NULL, NULL, &cred, NULL);
317 ok(st == SEC_E_UNKNOWN_CREDENTIALS,
318 "Expected SEC_E_UNKNOWN_CREDENTIALS, got %08x\n", st);
322 st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND,
323 NULL, &schanCred, NULL, NULL, &cred, NULL);
324 ok(st == SEC_E_UNKNOWN_CREDENTIALS,
325 "Expected SEC_E_UNKNOWN_CREDENTIALS, got %08x\n", st);
326 st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND,
327 NULL, &schanCred, NULL, NULL, &cred, NULL);
328 ok(st == SEC_E_UNKNOWN_CREDENTIALS,
329 "Expected SEC_E_UNKNOWN_CREDENTIALS, got %08x\n", st);
330 /* FIXME: what about two valid certs? */
332 CryptDestroyKey(key);
335 CryptReleaseContext(csp, 0);
336 CryptAcquireContextW(&csp, cspNameW, MS_DEF_PROV_W, PROV_RSA_FULL,
339 CertFreeCertificateContext(certs[0]);
340 CertFreeCertificateContext(certs[1]);
347 if (pAcquireCredentialsHandleA && pFreeCredentialsHandle)
348 testAcquireSecurityContext();