Commit 663bce9d authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

ncrypt: Add some missing RSA key properties.

parent 1144efbc
...@@ -128,7 +128,9 @@ static SECURITY_STATUS set_object_property(struct object *object, const WCHAR *n ...@@ -128,7 +128,9 @@ static SECURITY_STATUS set_object_property(struct object *object, const WCHAR *n
static struct object *create_key_object(enum algid algid, NCRYPT_PROV_HANDLE provider) static struct object *create_key_object(enum algid algid, NCRYPT_PROV_HANDLE provider)
{ {
NCRYPT_SUPPORTED_LENGTHS supported_lengths = {512, 16384, 8, 1024};
struct object *object; struct object *object;
DWORD dw_value;
switch (algid) switch (algid)
{ {
...@@ -136,8 +138,16 @@ static struct object *create_key_object(enum algid algid, NCRYPT_PROV_HANDLE pro ...@@ -136,8 +138,16 @@ static struct object *create_key_object(enum algid algid, NCRYPT_PROV_HANDLE pro
if (!(object = allocate_object(KEY))) return NULL; if (!(object = allocate_object(KEY))) return NULL;
object->key.algid = RSA; object->key.algid = RSA;
set_object_property(object, NCRYPT_ALGORITHM_PROPERTY, (BYTE *)BCRYPT_RSA_ALGORITHM,
sizeof(BCRYPT_RSA_ALGORITHM));
set_object_property(object, NCRYPT_ALGORITHM_GROUP_PROPERTY, (BYTE *)BCRYPT_RSA_ALGORITHM, set_object_property(object, NCRYPT_ALGORITHM_GROUP_PROPERTY, (BYTE *)BCRYPT_RSA_ALGORITHM,
sizeof(BCRYPT_RSA_ALGORITHM)); sizeof(BCRYPT_RSA_ALGORITHM));
set_object_property(object, NCRYPT_LENGTHS_PROPERTY, (BYTE *)&supported_lengths,
sizeof(supported_lengths));
dw_value = 128;
set_object_property(object, NCRYPT_BLOCK_LENGTH_PROPERTY, (BYTE *)&dw_value, sizeof(dw_value));
dw_value = 128;
set_object_property(object, BCRYPT_SIGNATURE_LENGTH, (BYTE *)&dw_value, sizeof(dw_value));
break; break;
default: default:
...@@ -145,6 +155,12 @@ static struct object *create_key_object(enum algid algid, NCRYPT_PROV_HANDLE pro ...@@ -145,6 +155,12 @@ static struct object *create_key_object(enum algid algid, NCRYPT_PROV_HANDLE pro
return NULL; return NULL;
} }
dw_value = 0;
set_object_property(object, NCRYPT_EXPORT_POLICY_PROPERTY, (BYTE *)&dw_value, sizeof(dw_value));
dw_value = NCRYPT_ALLOW_ALL_USAGES;
set_object_property(object, NCRYPT_KEY_USAGE_PROPERTY, (BYTE *)&dw_value, sizeof(dw_value));
dw_value = 0;
set_object_property(object, NCRYPT_KEY_TYPE_PROPERTY, (BYTE *)&dw_value, sizeof(dw_value));
set_object_property(object, NCRYPT_PROVIDER_HANDLE_PROPERTY, (BYTE *)&provider, sizeof(provider)); set_object_property(object, NCRYPT_PROVIDER_HANDLE_PROPERTY, (BYTE *)&provider, sizeof(provider));
return object; return object;
} }
...@@ -181,6 +197,7 @@ SECURITY_STATUS WINAPI NCryptCreatePersistedKey(NCRYPT_PROV_HANDLE provider, NCR ...@@ -181,6 +197,7 @@ SECURITY_STATUS WINAPI NCryptCreatePersistedKey(NCRYPT_PROV_HANDLE provider, NCR
} }
set_object_property(object, NCRYPT_LENGTH_PROPERTY, (BYTE *)&default_bitlen, sizeof(default_bitlen)); set_object_property(object, NCRYPT_LENGTH_PROPERTY, (BYTE *)&default_bitlen, sizeof(default_bitlen));
set_object_property(object, BCRYPT_PUBLIC_KEY_LENGTH, (BYTE *)&default_bitlen, sizeof(default_bitlen));
} }
else else
{ {
...@@ -401,6 +418,7 @@ SECURITY_STATUS WINAPI NCryptImportKey(NCRYPT_PROV_HANDLE provider, NCRYPT_KEY_H ...@@ -401,6 +418,7 @@ SECURITY_STATUS WINAPI NCryptImportKey(NCRYPT_PROV_HANDLE provider, NCRYPT_KEY_H
} }
set_object_property(object, NCRYPT_LENGTH_PROPERTY, (BYTE *)&rsablob->BitLength, sizeof(rsablob->BitLength)); set_object_property(object, NCRYPT_LENGTH_PROPERTY, (BYTE *)&rsablob->BitLength, sizeof(rsablob->BitLength));
set_object_property(object, BCRYPT_PUBLIC_KEY_LENGTH, (BYTE *)&rsablob->BitLength, sizeof(rsablob->BitLength));
break; break;
} }
default: default:
......
...@@ -232,17 +232,17 @@ static void _check_properties(int line, NCRYPT_PROV_HANDLE prov, NCRYPT_KEY_HAND ...@@ -232,17 +232,17 @@ static void _check_properties(int line, NCRYPT_PROV_HANDLE prov, NCRYPT_KEY_HAND
/* NCrypt properties */ /* NCrypt properties */
{NCRYPT_NAME_PROPERTY, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, {NCRYPT_NAME_PROPERTY, {0}, 0, NTE_NOT_SUPPORTED, TRUE},
{NCRYPT_UNIQUE_NAME_PROPERTY, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, {NCRYPT_UNIQUE_NAME_PROPERTY, {0}, 0, NTE_NOT_SUPPORTED, TRUE},
{NCRYPT_ALGORITHM_PROPERTY, {'R', 0, 'S', 0, 'A', 0}, sizeof(L"RSA"), ERROR_SUCCESS, TRUE}, {NCRYPT_ALGORITHM_PROPERTY, {'R', 0, 'S', 0, 'A', 0}, sizeof(L"RSA"), ERROR_SUCCESS},
{NCRYPT_LENGTH_PROPERTY, {0, 0x4} /* 1024 */, sizeof(DWORD)}, {NCRYPT_LENGTH_PROPERTY, {0, 0x4} /* 1024 */, sizeof(DWORD)},
{NCRYPT_LENGTHS_PROPERTY, {0, 0x2, 0, 0, 0, 0x40, 0, 0, 0x8, 0, 0, 0, 0, 0x4, 0, 0}, sizeof(DWORD) * 4 /* NCRYPT_SUPPORTED_LENGTHS */, ERROR_SUCCESS, TRUE, ERROR_SUCCESS, {0, 0x2, 0, 0, 0, 0x40, 0, 0, 0x40, 0, 0, 0, 0, 0x4, 0, 0}}, {NCRYPT_LENGTHS_PROPERTY, {0, 0x2, 0, 0, 0, 0x40, 0, 0, 0x8, 0, 0, 0, 0, 0x4, 0, 0}, sizeof(DWORD) * 4 /* NCRYPT_SUPPORTED_LENGTHS */, ERROR_SUCCESS, FALSE, ERROR_SUCCESS, {0, 0x2, 0, 0, 0, 0x40, 0, 0, 0x40, 0, 0, 0, 0, 0x4, 0, 0}},
{NCRYPT_BLOCK_LENGTH_PROPERTY, {0x80, 0, 0, 0}, sizeof(DWORD), ERROR_SUCCESS, TRUE}, {NCRYPT_BLOCK_LENGTH_PROPERTY, {0x80, 0, 0, 0}, sizeof(DWORD), ERROR_SUCCESS},
{NCRYPT_UI_POLICY_PROPERTY, {0}, sizeof(NCRYPT_UI_POLICY), NTE_NOT_FOUND, TRUE}, {NCRYPT_UI_POLICY_PROPERTY, {0}, sizeof(NCRYPT_UI_POLICY), NTE_NOT_FOUND, TRUE},
{NCRYPT_EXPORT_POLICY_PROPERTY, {0}, sizeof(DWORD), ERROR_SUCCESS, TRUE}, {NCRYPT_EXPORT_POLICY_PROPERTY, {0}, sizeof(DWORD), ERROR_SUCCESS},
{NCRYPT_WINDOW_HANDLE_PROPERTY, {0}, 0, NTE_NOT_FOUND, TRUE}, {NCRYPT_WINDOW_HANDLE_PROPERTY, {0}, 0, NTE_NOT_FOUND, TRUE},
{NCRYPT_USE_CONTEXT_PROPERTY, {0}, 0, NTE_NOT_FOUND, TRUE}, {NCRYPT_USE_CONTEXT_PROPERTY, {0}, 0, NTE_NOT_FOUND, TRUE},
{NCRYPT_IMPL_TYPE_PROPERTY, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, {NCRYPT_IMPL_TYPE_PROPERTY, {0}, 0, NTE_NOT_SUPPORTED, TRUE},
{NCRYPT_KEY_USAGE_PROPERTY, {0xff, 0xff, 0xff, 0} /* NCRYPT_ALLOW_ALL_USAGES */, sizeof(DWORD), ERROR_SUCCESS, TRUE}, {NCRYPT_KEY_USAGE_PROPERTY, {0xff, 0xff, 0xff, 0} /* NCRYPT_ALLOW_ALL_USAGES */, sizeof(DWORD), ERROR_SUCCESS},
{NCRYPT_KEY_TYPE_PROPERTY, {0}, sizeof(DWORD), ERROR_SUCCESS, TRUE}, {NCRYPT_KEY_TYPE_PROPERTY, {0}, sizeof(DWORD), ERROR_SUCCESS},
{NCRYPT_VERSION_PROPERTY, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, {NCRYPT_VERSION_PROPERTY, {0}, 0, NTE_NOT_SUPPORTED, TRUE},
{NCRYPT_SECURITY_DESCR_SUPPORT_PROPERTY, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, {NCRYPT_SECURITY_DESCR_SUPPORT_PROPERTY, {0}, 0, NTE_NOT_SUPPORTED, TRUE},
{NCRYPT_SECURITY_DESCR_PROPERTY, {0}, 0, NTE_BAD_FLAGS, TRUE}, {NCRYPT_SECURITY_DESCR_PROPERTY, {0}, 0, NTE_BAD_FLAGS, TRUE},
...@@ -281,8 +281,8 @@ static void _check_properties(int line, NCRYPT_PROV_HANDLE prov, NCRYPT_KEY_HAND ...@@ -281,8 +281,8 @@ static void _check_properties(int line, NCRYPT_PROV_HANDLE prov, NCRYPT_KEY_HAND
{BCRYPT_OBJECT_LENGTH, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, {BCRYPT_OBJECT_LENGTH, {0}, 0, NTE_NOT_SUPPORTED, TRUE},
{BCRYPT_PADDING_SCHEMES, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, {BCRYPT_PADDING_SCHEMES, {0}, 0, NTE_NOT_SUPPORTED, TRUE},
{BCRYPT_PROVIDER_HANDLE, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, {BCRYPT_PROVIDER_HANDLE, {0}, 0, NTE_NOT_SUPPORTED, TRUE},
{BCRYPT_SIGNATURE_LENGTH, {0x80, 0, 0, 0} /* 128 */, sizeof(DWORD), ERROR_SUCCESS, TRUE, NTE_NOT_SUPPORTED /* <= Win 8 */}, {BCRYPT_SIGNATURE_LENGTH, {0x80, 0, 0, 0} /* 128 */, sizeof(DWORD), ERROR_SUCCESS, FALSE, NTE_NOT_SUPPORTED /* <= Win 8 */},
{BCRYPT_PUBLIC_KEY_LENGTH, {0, 0x4} /* 1024 */, sizeof(DWORD), ERROR_SUCCESS, TRUE, NTE_NOT_SUPPORTED /* <= Win 8 */}, {BCRYPT_PUBLIC_KEY_LENGTH, {0, 0x4} /* 1024 */, sizeof(DWORD), ERROR_SUCCESS, FALSE, NTE_NOT_SUPPORTED /* <= Win 8 */},
}; };
unsigned int i; unsigned int i;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment