rsaenh: Add support for mandatory parameters to RSAENH_CPGetProvParam.
This commit is contained in:
parent
c4eeb9f6fa
commit
f772fb9898
|
@ -2907,6 +2907,7 @@ BOOL WINAPI RSAENH_CPGetProvParam(HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData,
|
|||
switch (dwParam)
|
||||
{
|
||||
case PP_CONTAINER:
|
||||
case PP_UNIQUE_CONTAINER:/* MSDN says we can return the same value as PP_CONTAINER */
|
||||
return copy_param(pbData, pdwDataLen, (CONST BYTE*)pKeyContainer->szName,
|
||||
strlen(pKeyContainer->szName)+1);
|
||||
|
||||
|
@ -2914,6 +2915,22 @@ BOOL WINAPI RSAENH_CPGetProvParam(HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData,
|
|||
return copy_param(pbData, pdwDataLen, (CONST BYTE*)pKeyContainer->szProvName,
|
||||
strlen(pKeyContainer->szProvName)+1);
|
||||
|
||||
case PP_PROVTYPE:
|
||||
dwTemp = PROV_RSA_FULL;
|
||||
return copy_param(pbData, pdwDataLen, (CONST BYTE*)&dwTemp, sizeof(dwTemp));
|
||||
|
||||
case PP_KEYSPEC:
|
||||
dwTemp = AT_SIGNATURE | AT_KEYEXCHANGE;
|
||||
return copy_param(pbData, pdwDataLen, (CONST BYTE*)&dwTemp, sizeof(dwTemp));
|
||||
|
||||
case PP_KEYSET_TYPE:
|
||||
dwTemp = pKeyContainer->dwFlags & CRYPT_MACHINE_KEYSET;
|
||||
return copy_param(pbData, pdwDataLen, (CONST BYTE*)&dwTemp, sizeof(dwTemp));
|
||||
|
||||
case PP_KEYSTORAGE:
|
||||
dwTemp = CRYPT_SEC_DESCR;
|
||||
return copy_param(pbData, pdwDataLen, (CONST BYTE*)&dwTemp, sizeof(dwTemp));
|
||||
|
||||
case PP_SIG_KEYSIZE_INC:
|
||||
case PP_KEYX_KEYSIZE_INC:
|
||||
dwTemp = 8;
|
||||
|
|
|
@ -1480,7 +1480,8 @@ static void test_null_provider(void)
|
|||
HCRYPTPROV prov;
|
||||
HCRYPTKEY key;
|
||||
BOOL result;
|
||||
DWORD keySpec, dataLen;
|
||||
DWORD keySpec, dataLen,dwParam;
|
||||
char szName[MAX_PATH];
|
||||
|
||||
result = CryptAcquireContext(NULL, szContainer, NULL, 0, 0);
|
||||
ok(!result && GetLastError() == NTE_BAD_PROV_TYPE,
|
||||
|
@ -1556,11 +1557,35 @@ static void test_null_provider(void)
|
|||
CRYPT_NEWKEYSET);
|
||||
ok(result, "CryptAcquireContext failed: %08x\n", GetLastError());
|
||||
if (!result) return;
|
||||
/* Test provider parameters getter */
|
||||
dataLen = sizeof(dwParam);
|
||||
result = CryptGetProvParam(prov, PP_PROVTYPE, (LPBYTE)&dwParam, &dataLen, 0);
|
||||
ok(result && dataLen == sizeof(dwParam) && dwParam == PROV_RSA_FULL,
|
||||
"Expected PROV_RSA_FULL, got 0x%08X\n",dwParam);
|
||||
dataLen = sizeof(dwParam);
|
||||
result = CryptGetProvParam(prov, PP_KEYSET_TYPE, (LPBYTE)&dwParam, &dataLen, 0);
|
||||
ok(result && dataLen == sizeof(dwParam) && dwParam == 0,
|
||||
"Expected 0, got 0x%08X\n",dwParam);
|
||||
dataLen = sizeof(dwParam);
|
||||
result = CryptGetProvParam(prov, PP_KEYSTORAGE, (LPBYTE)&dwParam, &dataLen, 0);
|
||||
ok(result && dataLen == sizeof(dwParam) && (dwParam & CRYPT_SEC_DESCR),
|
||||
"Expected CRYPT_SEC_DESCR to be set, got 0x%08X\n",dwParam);
|
||||
dataLen = sizeof(keySpec);
|
||||
result = CryptGetProvParam(prov, PP_KEYSPEC, (LPBYTE)&keySpec, &dataLen, 0);
|
||||
if (result)
|
||||
ok(keySpec == (AT_KEYEXCHANGE | AT_SIGNATURE),
|
||||
"Expected AT_KEYEXCHANGE | AT_SIGNATURE, got %08x\n", keySpec);
|
||||
ok(result && keySpec == (AT_KEYEXCHANGE | AT_SIGNATURE),
|
||||
"Expected AT_KEYEXCHANGE | AT_SIGNATURE, got %08x\n", keySpec);
|
||||
/* PP_CONTAINER parameter */
|
||||
dataLen = sizeof(szName);
|
||||
result = CryptGetProvParam(prov, PP_CONTAINER, (LPBYTE)szName, &dataLen, 0);
|
||||
ok(result && dataLen == strlen(szContainer)+1 && strcmp(szContainer,szName) == 0,
|
||||
"failed getting PP_CONTAINER. result = %s. Error 0x%08X. returned length = %d\n",
|
||||
(result)? "TRUE":"FALSE",GetLastError(),dataLen);
|
||||
/* PP_UNIQUE_CONTAINER parameter */
|
||||
dataLen = sizeof(szName);
|
||||
result = CryptGetProvParam(prov, PP_UNIQUE_CONTAINER, (LPBYTE)szName, &dataLen, 0);
|
||||
ok(result && dataLen == strlen(szContainer)+1 && strcmp(szContainer,szName) == 0,
|
||||
"failed getting PP_CONTAINER. result = %s. Error 0x%08X. returned length = %d\n",
|
||||
(result)? "TRUE":"FALSE",GetLastError(),dataLen);
|
||||
result = CryptGetUserKey(prov, AT_KEYEXCHANGE, &key);
|
||||
ok(!result && GetLastError() == NTE_NO_KEY,
|
||||
"Expected NTE_NO_KEY, got %08x\n", GetLastError());
|
||||
|
|
Loading…
Reference in New Issue