Play Windows games on Apple Silicon Macs. Free, open-source app that installs the official Battle.net, Steam, Epic and GOG launchers and lists your games in one library.
HTML apple-siliconbattle-netcrossover-alternatived3dmetaldiablo-ii-resurrecteddxmtea-appepic-gamesgame-porting-toolkitgogmac-gamingmacosmacos-gamingrockstar-gamessteamubisoft-connectwhisky-alternativewindows-gameswinewine-wrapper
Store CNG keys created with a name so they survive the process.
Wine's ncrypt keeps a key only for the lifetime of the process that made it:
NCryptCreatePersistedKey ignores the name it is given and NCryptOpenKey is a
stub returning NTE_NOT_SUPPORTED, so a program that asks the key store for the
same key twice gets a different key the second time.
The Epic Games Launcher creates a persistent EC key and signs a DPoP proof with
it (RFC 9449), which is how the account service recognises the machine a token
was issued to. With the key gone on every start the launcher logs
LogDPoP: Error: Failed to create persistent DPoP key (Status: 0x80090029)
LogDPoP: Warning: Cannot build DPoP proof: no public JWK available
and falls back to sending the request unsigned, so the service treats each start
as a new device and issues a new session instead of refreshing the stored one.
After a handful of launches the account hits the issuance limit and every login
fails with
errors.com.epicgames.account.oauth.too_many_sessions (18048)
"Sorry too many sessions have been issued for your account."
which no amount of logging out or resetting the password clears, because the
limit counts sessions issued rather than sessions held.
Named keys are now written to %APPDATA%\Microsoft\Crypto\Keys, where Windows
keeps them, once the key is finalized, and read back by NCryptOpenKey; opening a
name that was never stored returns NTE_BAD_KEYSET so callers create one instead
of giving up. ECDSA P-256 and P-384 are handled alongside RSA, since a key
store that cannot hold the curve DPoP uses would not help here.
A named key that already exists is left alone unless the caller passes
NCRYPT_OVERWRITE_KEY_FLAG, a storage failure is reported by NCryptFinalizeKey
rather than passed off as a finalized key, and the length of a reopened key is
taken from its blob so a 2048 bit RSA key does not come back claiming 1024.
--- a/dlls/ncrypt/ncrypt_internal.h
+++ b/dlls/ncrypt/ncrypt_internal.h
@@ -26,12 +26,16 @@
RSA,
DSA,
ECDSA,
+ ECDSA_P256,
+ ECDSA_P384,
};
struct key
{
enum algid algid;
BCRYPT_KEY_HANDLE bcrypt_key;
+ WCHAR *name;
+ BOOL overwrite; /* NCRYPT_OVERWRITE_KEY_FLAG was given at creation */
};
struct storage_provider
--- a/dlls/ncrypt/main.c
+++ b/dlls/ncrypt/main.c
@@ -19,6 +19,7 @@
*/
#include <stdarg.h>
+#include <stdio.h>
#include <stdlib.h>
#include "ntstatus.h"
@@ -124,8 +125,272 @@
memcpy(property->value, value, value_size);
return ERROR_SUCCESS;
+}
+
+/* Persistent key storage.
+ *
+ * Windows keeps a user's CNG keys under %APPDATA%\Microsoft\Crypto\Keys, so a
+ * named key created by one run of a program is still there for the next one.
+ * Callers that bind a token to a device key (DPoP, for instance) treat the key
+ * as the identity of the machine and issue a fresh login whenever it changes,
+ * so the key has to outlive the process. */
+
+#define KEY_STORE_MAGIC 0x314b4a53
+
+static LONG key_store_seq;
+
+#ifndef NCRYPT_OVERWRITE_KEY_FLAG
+#define NCRYPT_OVERWRITE_KEY_FLAG 0x00000080
+#endif
+
+struct key_store_header
+{
+ DWORD magic;
+ DWORD algid;
+ DWORD blob_len;
+};
+
+static const WCHAR *blob_type_for_algid(enum algid algid)
+{
+ switch (algid)
+ {
+ case RSA: return BCRYPT_RSAFULLPRIVATE_BLOB;
+ case ECDSA_P256:
+ case ECDSA_P384: return BCRYPT_ECCPRIVATE_BLOB;
+ default: return NULL;
+ }
+}
+
+static BCRYPT_ALG_HANDLE alg_handle_for_algid(enum algid algid)
+{
+ switch (algid)
+ {
+ case RSA: return BCRYPT_RSA_ALG_HANDLE;
+ case ECDSA_P256: return BCRYPT_ECDSA_P256_ALG_HANDLE;
+ case ECDSA_P384: return BCRYPT_ECDSA_P384_ALG_HANDLE;
+ default: return NULL;
+ }
+}
+
+/* Build %APPDATA%\Microsoft\Crypto\Keys\<name>.key, creating the directories.
+ * Characters that cannot appear in a file name are folded to '_'; a caller
+ * that picks two names differing only in those is left sharing one file. */
+static WCHAR *key_store_path(const WCHAR *name)
+{
+ static const WCHAR keysW[] = L"\\Microsoft\\Crypto\\Keys";
+ static const WCHAR extW[] = L".key";
+ WCHAR appdata[MAX_PATH], *path, *p;
+ DWORD len;
+ size_t i;
+
+ if (!name || !*name) return NULL;
+ if (!(len = GetEnvironmentVariableW(L"APPDATA", appdata, MAX_PATH)) || len >= MAX_PATH) return NULL;
+
+ len = lstrlenW(appdata) + ARRAY_SIZE(keysW) + lstrlenW(name) + ARRAY_SIZE(extW) + 1;
+ if (!(path = malloc(len * sizeof(WCHAR)))) return NULL;
+
+ lstrcpyW(path, appdata);
+ lstrcatW(path, keysW);
+
+ /* create the directories one component at a time */
+ for (p = path + lstrlenW(appdata) + 1; *p; p++)
+ {
+ if (*p != '\\') continue;
+ *p = 0;
+ CreateDirectoryW(path, NULL);
+ *p = '\\';
+ }
+ CreateDirectoryW(path, NULL);
+
+ lstrcatW(path, L"\\");
+ i = lstrlenW(path);
+ for (; *name; name++, i++)
+ {
+ WCHAR c = *name;
+ if (c < ' ' || c == '\\' || c == '/' || c == ':' || c == '*' ||
+ c == '?' || c == '"' || c == '<' || c == '>' || c == '|') c = '_';
+ path[i] = c;
+ }
+ path[i] = 0;
+ lstrcatW(path, extW);
+ return path;
+}
+
+static SECURITY_STATUS install_key_file(const WCHAR *tmp, const WCHAR *path, BOOL overwrite);
+
+static SECURITY_STATUS write_key_store(const WCHAR *name, enum algid algid, BCRYPT_KEY_HANDLE bcrypt_key,
+ BOOL overwrite)
+{
+ struct key_store_header header;
+ const WCHAR *blob_type;
+ SECURITY_STATUS ret = NTE_INTERNAL_ERROR;
+ BYTE *blob = NULL;
+ WCHAR *path, *tmp = NULL;
+ DWORD blob_len = 0, written;
+ NTSTATUS status;
+ HANDLE file;
+
+ if (!(blob_type = blob_type_for_algid(algid))) return NTE_NOT_SUPPORTED;
+ if (!(path = key_store_path(name))) return NTE_INTERNAL_ERROR;
+ /* Write next to the final name under a name unique to this finalization
+ * and rename into place, so a crash or a full disk mid-write cannot leave
+ * a truncated key behind (it would fail to open yet count as existing),
+ * and two finalizations of one name never share a temp file. */
+ if (!(tmp = malloc((lstrlenW(path) + 40) * sizeof(WCHAR)))) { ret = NTE_NO_MEMORY; goto done; }
+ swprintf(tmp, lstrlenW(path) + 40, L"%s.%u-%u.tmp", path, (unsigned int)GetCurrentProcessId(),
+ (unsigned int)InterlockedIncrement(&key_store_seq)); /* unique per finalization, threads included */
+
+ status = BCryptExportKey(bcrypt_key, NULL, blob_type, NULL, 0, &blob_len, 0);
+ if (status != STATUS_SUCCESS) goto done;
+ if (!(blob = malloc(blob_len))) { ret = NTE_NO_MEMORY; goto done; }
+ status = BCryptExportKey(bcrypt_key, NULL, blob_type, blob, blob_len, &blob_len, 0);
+ if (status != STATUS_SUCCESS) goto done;
+
+ file = CreateFileW(tmp, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ if (file == INVALID_HANDLE_VALUE) goto done;
+
+ header.magic = KEY_STORE_MAGIC;
+ header.algid = algid;
+ header.blob_len = blob_len;
+ if (WriteFile(file, &header, sizeof(header), &written, NULL) && written == sizeof(header) &&
+ WriteFile(file, blob, blob_len, &written, NULL) && written == blob_len &&
+ FlushFileBuffers(file))
+ ret = ERROR_SUCCESS;
+ CloseHandle(file);
+ if (ret == ERROR_SUCCESS) ret = install_key_file(tmp, path, overwrite);
+ if (ret != ERROR_SUCCESS) DeleteFileW(tmp);
+
+done:
+ free(blob);
+ free(tmp);
+ free(path);
+ return ret;
+}
+
+static SECURITY_STATUS read_key_file(const WCHAR *path, enum algid *algid, BCRYPT_KEY_HANDLE *bcrypt_key,
+ DWORD *bitlen)
+{
+ struct key_store_header header;
+ SECURITY_STATUS ret = NTE_BAD_KEYSET;
+ BYTE *blob = NULL;
+ DWORD read;
+ HANDLE file;
+
+ file = CreateFileW(path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ if (file == INVALID_HANDLE_VALUE) return NTE_BAD_KEYSET;
+
+ if (!ReadFile(file, &header, sizeof(header), &read, NULL) || read != sizeof(header) ||
+ header.magic != KEY_STORE_MAGIC || !header.blob_len || header.blob_len > 0x10000)
+ goto done;
+ if (!blob_type_for_algid(header.algid) || !alg_handle_for_algid(header.algid)) goto done;
+ if (!(blob = malloc(header.blob_len))) { ret = NTE_NO_MEMORY; goto done; }
+ if (!ReadFile(file, blob, header.blob_len, &read, NULL) || read != header.blob_len) goto done;
+
+ if (BCryptImportKeyPair(alg_handle_for_algid(header.algid), NULL, blob_type_for_algid(header.algid),
+ bcrypt_key, blob, header.blob_len, 0) != STATUS_SUCCESS)
+ goto done;
+
+ /* Take the length from the blob rather than assuming the default for its
+ * algorithm: a caller that asked for a 2048 bit RSA key would otherwise be
+ * told its reopened key is 1024 bits. */
+ *bitlen = 0;
+ if (header.algid == RSA)
+ {
+ if (header.blob_len >= sizeof(BCRYPT_RSAKEY_BLOB))
+ *bitlen = ((BCRYPT_RSAKEY_BLOB *)blob)->BitLength;
+ }
+ else if (header.blob_len >= sizeof(BCRYPT_ECCKEY_BLOB))
+ *bitlen = ((BCRYPT_ECCKEY_BLOB *)blob)->cbKey * 8;
+
+ *algid = header.algid;
+ ret = ERROR_SUCCESS;
+
+done:
+ free(blob);
+ CloseHandle(file);
+ return ret;
+}
+
+static SECURITY_STATUS read_key_store(const WCHAR *name, enum algid *algid, BCRYPT_KEY_HANDLE *bcrypt_key,
+ DWORD *bitlen)
+{
+ SECURITY_STATUS ret;
+ WCHAR *path;
+
+ if (!(path = key_store_path(name))) return NTE_BAD_KEYSET;
+ ret = read_key_file(path, algid, bcrypt_key, bitlen);
+ free(path);
+ return ret;
+}
+
+/* Does this file hold a key that imports? */
+static BOOL key_file_readable(const WCHAR *path)
+{
+ BCRYPT_KEY_HANDLE bcrypt_key;
+ enum algid algid;
+ DWORD bitlen;
+
+ if (read_key_file(path, &algid, &bcrypt_key, &bitlen) != ERROR_SUCCESS) return FALSE;
+ BCryptDestroyKey(bcrypt_key);
+ return TRUE;
}
+/* Move a finished temp file onto the key's final name.
+ *
+ * Without NCRYPT_OVERWRITE_KEY_FLAG the file must not replace a key another
+ * finalizer installed since the creation-time check: two launches racing to
+ * create the same key would otherwise both succeed and the second would
+ * silently discard the first's identity. Deciding that needs a look at what
+ * is at the destination, and the look and the rename have to be one step, so
+ * every finalizer of a name, overwriting ones included, serializes on
+ * <path>.lock, opened with no sharing and delete-on-close: whoever holds it
+ * can examine the destination, discard a damaged file, and install its own,
+ * with nobody else able to install in between. The lock file disappears when
+ * its handle closes, including on process death. */
+static SECURITY_STATUS install_key_file(const WCHAR *tmp, const WCHAR *path, BOOL overwrite)
+{
+ SECURITY_STATUS ret = ERROR_SUCCESS;
+ HANDLE lock = INVALID_HANDLE_VALUE;
+ WCHAR *lockname;
+ int attempt;
+
+ if (!(lockname = malloc((lstrlenW(path) + 6) * sizeof(WCHAR)))) return NTE_NO_MEMORY;
+ lstrcpyW(lockname, path);
+ lstrcatW(lockname, L".lock");
+ for (attempt = 0; attempt < 200; attempt++) /* up to ~2 s */
+ {
+ lock = CreateFileW(lockname, GENERIC_WRITE, 0, NULL, OPEN_ALWAYS,
+ FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSE, NULL);
+ if (lock != INVALID_HANDLE_VALUE) break;
+ if (GetLastError() != ERROR_SHARING_VIOLATION && GetLastError() != ERROR_ACCESS_DENIED) break;
+ Sleep(10);
+ }
+ free(lockname);
+ if (lock == INVALID_HANDLE_VALUE) return NTE_INTERNAL_ERROR;
+
+ if (!overwrite && key_file_readable(path)) ret = NTE_EXISTS; /* a real key won the race */
+ else if (!MoveFileExW(tmp, path, MOVEFILE_REPLACE_EXISTING)) ret = NTE_INTERNAL_ERROR; /* absent, damaged, or ours to replace */
+
+ CloseHandle(lock);
+ return ret;
+}
+
+/* A stored key counts as existing only if it can be read back and imported.
+ * A damaged file, whatever the damage, must look absent: otherwise the
+ * caller's open fails with NTE_BAD_KEYSET, its create then fails with
+ * NTE_EXISTS, and nothing short of deleting the file by hand gets it out of
+ * that loop. */
+static BOOL key_store_exists(const WCHAR *name)
+{
+ WCHAR *path;
+ BOOL ok;
+
+ if (!(path = key_store_path(name))) return FALSE;
+ ok = key_file_readable(path);
+ free(path);
+ return ok;
+}
+
static struct object *create_key_object(enum algid algid, NCRYPT_PROV_HANDLE provider)
{
NCRYPT_SUPPORTED_LENGTHS supported_lengths = {512, 16384, 8, 1024};
@@ -150,6 +415,26 @@
set_object_property(object, BCRYPT_SIGNATURE_LENGTH, (BYTE *)&dw_value, sizeof(dw_value));
break;
+ case ECDSA_P256:
+ case ECDSA_P384:
+ {
+ const WCHAR *alg = (algid == ECDSA_P256) ? BCRYPT_ECDSA_P256_ALGORITHM : BCRYPT_ECDSA_P384_ALGORITHM;
+ DWORD bitlen = (algid == ECDSA_P256) ? 256 : 384;
+ NCRYPT_SUPPORTED_LENGTHS ec_lengths = {bitlen, bitlen, 0, bitlen};
+
+ if (!(object = allocate_object(KEY))) return NULL;
+
+ object->key.algid = algid;
+ set_object_property(object, NCRYPT_ALGORITHM_PROPERTY, (BYTE *)alg, (lstrlenW(alg) + 1) * sizeof(WCHAR));
+ set_object_property(object, NCRYPT_ALGORITHM_GROUP_PROPERTY, (BYTE *)L"ECDSA", sizeof(L"ECDSA"));
+ set_object_property(object, NCRYPT_LENGTHS_PROPERTY, (BYTE *)&ec_lengths, sizeof(ec_lengths));
+ dw_value = bitlen / 8;
+ set_object_property(object, NCRYPT_BLOCK_LENGTH_PROPERTY, (BYTE *)&dw_value, sizeof(dw_value));
+ dw_value = bitlen / 4;
+ set_object_property(object, BCRYPT_SIGNATURE_LENGTH, (BYTE *)&dw_value, sizeof(dw_value));
+ break;
+ }
+
default:
ERR("Invalid algid %#x\n", algid);
return NULL;
@@ -175,7 +460,7 @@
if (!provider) return NTE_INVALID_HANDLE;
if (!algid) return HRESULT_FROM_WIN32(RPC_X_NULL_REF_POINTER);
- if (name) FIXME("Persistent keys are not supported\n");
+ if (name && !(flags & NCRYPT_OVERWRITE_KEY_FLAG) && key_store_exists(name)) return NTE_EXISTS;
if (!lstrcmpiW(algid, BCRYPT_RSA_ALGORITHM))
{
@@ -198,6 +483,25 @@
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 if (!lstrcmpiW(algid, BCRYPT_ECDSA_P256_ALGORITHM) || !lstrcmpiW(algid, BCRYPT_ECDSA_P384_ALGORITHM))
+ {
+ enum algid id = !lstrcmpiW(algid, BCRYPT_ECDSA_P256_ALGORITHM) ? ECDSA_P256 : ECDSA_P384;
+ DWORD bitlen = (id == ECDSA_P256) ? 256 : 384;
+ NTSTATUS status;
+
+ if (!(object = create_key_object(id, provider))) return NTE_NO_MEMORY;
+
+ status = BCryptGenerateKeyPair(alg_handle_for_algid(id), &object->key.bcrypt_key, bitlen, 0);
+ if (status != STATUS_SUCCESS)
+ {
+ ERR("Error generating key pair %#lx\n", status);
+ free(object);
+ return map_ntstatus(status);
+ }
+
+ set_object_property(object, NCRYPT_LENGTH_PROPERTY, (BYTE *)&bitlen, sizeof(bitlen));
+ set_object_property(object, BCRYPT_PUBLIC_KEY_LENGTH, (BYTE *)&bitlen, sizeof(bitlen));
}
else
{
@@ -205,6 +509,15 @@
return NTE_NOT_SUPPORTED;
}
+ /* A named key is written out once it is finalized, not here: the key
+ * material is not generated yet. */
+ object->key.overwrite = !!(flags & NCRYPT_OVERWRITE_KEY_FLAG);
+ if (name && !(object->key.name = wcsdup(name)))
+ {
+ NCryptFreeObject((NCRYPT_HANDLE)object);
+ return NTE_NO_MEMORY;
+ }
+
*key = (NCRYPT_KEY_HANDLE)object;
return ERROR_SUCCESS;
}
@@ -219,8 +532,25 @@
SECURITY_STATUS WINAPI NCryptDeleteKey(NCRYPT_KEY_HANDLE key, DWORD flags)
{
- FIXME("(%#Ix, %#lx): stub\n", key, flags);
- return NTE_NOT_SUPPORTED;
+ struct object *object = (struct object *)key;
+ SECURITY_STATUS ret = ERROR_SUCCESS;
+ WCHAR *path;
+
+ TRACE("(%#Ix, %#lx)\n", key, flags);
+
+ if (!object || object->type != KEY) return NTE_INVALID_HANDLE;
+
+ if (object->key.name && (path = key_store_path(object->key.name)))
+ {
+ /* A file that will not go (permissions, a sharing violation) must be
+ * reported: the caller would otherwise reopen the "deleted" key next
+ * time. A file that is already gone is not an error. */
+ if (!DeleteFileW(path) && GetLastError() != ERROR_FILE_NOT_FOUND && GetLastError() != ERROR_PATH_NOT_FOUND)
+ ret = NTE_INTERNAL_ERROR;
+ free(path);
+ }
+ NCryptFreeObject((NCRYPT_HANDLE)key);
+ return ret;
}
SECURITY_STATUS WINAPI NCryptEncrypt(NCRYPT_KEY_HANDLE key, BYTE *input, DWORD insize, void *padding,
@@ -277,11 +607,16 @@
if (!(prop = get_object_property(object, NCRYPT_LENGTH_PROPERTY))) return NTE_INVALID_HANDLE;
key_length = *(DWORD *)prop->value;
- status = BCryptSetProperty(object->key.bcrypt_key, BCRYPT_KEY_LENGTH, (UCHAR *)&key_length, sizeof(key_length), 0);
- if (status != STATUS_SUCCESS)
+
+ /* the length of an EC key is fixed by its curve, and setting it fails */
+ if (object->key.algid != ECDSA_P256 && object->key.algid != ECDSA_P384)
{
- ERR("Error setting key length property\n");
- return map_ntstatus(status);
+ status = BCryptSetProperty(object->key.bcrypt_key, BCRYPT_KEY_LENGTH, (UCHAR *)&key_length, sizeof(key_length), 0);
+ if (status != STATUS_SUCCESS)
+ {
+ ERR("Error setting key length property\n");
+ return map_ntstatus(status);
+ }
}
status = BCryptFinalizeKeyPair(object->key.bcrypt_key, 0);
@@ -289,6 +624,20 @@
{
ERR("Error finalizing key pair\n");
return map_ntstatus(status);
+ }
+
+ if (object->key.name)
+ {
+ /* Report a storage failure rather than hiding it: a caller told its
+ * named key was finalized will not look for the key again, and would
+ * silently get a new identity on the next run. */
+ SECURITY_STATUS ret = write_key_store(object->key.name, object->key.algid, object->key.bcrypt_key,
+ object->key.overwrite);
+ if (ret != ERROR_SUCCESS)
+ {
+ WARN("could not store key %s\n", wine_dbgstr_w(object->key.name));
+ return ret;
+ }
}
return ERROR_SUCCESS;
@@ -302,6 +651,8 @@
static SECURITY_STATUS free_key_object(struct key *key)
{
+ free(key->name);
+ key->name = NULL;
return map_ntstatus( BCryptDestroyKey(key->bcrypt_key) );
}
@@ -512,8 +863,43 @@
SECURITY_STATUS WINAPI NCryptOpenKey(NCRYPT_PROV_HANDLE provider, NCRYPT_KEY_HANDLE *key,
const WCHAR *name, DWORD keyspec, DWORD flags)
{
- FIXME("(%#Ix, %p, %s, %#lx, %#lx): stub\n", provider, key, wine_dbgstr_w(name), keyspec, flags);
- return NTE_NOT_SUPPORTED;
+ BCRYPT_KEY_HANDLE bcrypt_key = NULL;
+ struct object *object;
+ SECURITY_STATUS ret;
+ enum algid algid;
+ DWORD bitlen;
+
+ TRACE("(%#Ix, %p, %s, %#lx, %#lx)\n", provider, key, wine_dbgstr_w(name), keyspec, flags);
+
+ if (!provider) return NTE_INVALID_HANDLE;
+ if (!key || !name) return NTE_INVALID_PARAMETER;
+
+ if ((ret = read_key_store(name, &algid, &bcrypt_key, &bitlen))) return ret;
+
+ if (!(object = create_key_object(algid, provider)))
+ {
+ BCryptDestroyKey(bcrypt_key);
+ return NTE_NO_MEMORY;
+ }
+ object->key.bcrypt_key = bcrypt_key;
+ if (!(object->key.name = wcsdup(name)))
+ {
+ NCryptFreeObject((NCRYPT_HANDLE)object);
+ return NTE_NO_MEMORY;
+ }
+ object->key.overwrite = TRUE; /* it is this key's own file */
+
+ if (!bitlen) switch (algid)
+ {
+ case ECDSA_P256: bitlen = 256; break;
+ case ECDSA_P384: bitlen = 384; break;
+ default: bitlen = 1024; break;
+ }
+ set_object_property(object, NCRYPT_LENGTH_PROPERTY, (BYTE *)&bitlen, sizeof(bitlen));
+ set_object_property(object, BCRYPT_PUBLIC_KEY_LENGTH, (BYTE *)&bitlen, sizeof(bitlen));
+
+ *key = (NCRYPT_KEY_HANDLE)object;
+ return ERROR_SUCCESS;
}
SECURITY_STATUS WINAPI NCryptOpenStorageProvider(NCRYPT_PROV_HANDLE *provider, const WCHAR *name, DWORD flags)