xref: /aosp_15_r20/external/cronet/crypto/unexportable_key_win.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2024 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef CRYPTO_UNEXPORTABLE_KEY_WIN_H_
6 #define CRYPTO_UNEXPORTABLE_KEY_WIN_H_
7 
8 #include <windows.h>
9 
10 #include <ncrypt.h>
11 
12 #include "base/containers/span.h"
13 #include "crypto/crypto_export.h"
14 #include "crypto/scoped_cng_types.h"
15 
16 namespace crypto {
17 
18 // Attempts to load a TPM-backed CNG key from the given `wrapped` value. Will
19 // assign the out `provider` and `key` values respectively. Returns true if all
20 // operations were successful.
21 CRYPTO_EXPORT bool LoadWrappedTPMKey(base::span<const uint8_t> wrapped,
22                                      ScopedNCryptProvider& provider,
23                                      ScopedNCryptKey& key);
24 
25 }  // namespace crypto
26 
27 #endif  // CRYPTO_UNEXPORTABLE_KEY_WIN_H_
28