1 // Copyright 2022 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.
5 #ifndef CRYPTO_SCOPED_CNG_TYPES_H_
6 #define CRYPTO_SCOPED_CNG_TYPES_H_
10 #include "base/scoped_generic.h"
11 #include "base/win/wincrypt_shim.h"
16 struct NCryptObjectTraits {
17 static T InvalidValue() { return 0; }
18 static void Free(T handle) { NCryptFreeObject(handle); }
21 using ScopedNCryptProvider =
22 base::ScopedGeneric<NCRYPT_PROV_HANDLE,
23 NCryptObjectTraits<NCRYPT_PROV_HANDLE>>;
24 using ScopedNCryptKey =
25 base::ScopedGeneric<NCRYPT_KEY_HANDLE,
26 NCryptObjectTraits<NCRYPT_KEY_HANDLE>>;
30 #endif // CRYPTO_SCOPED_CNG_TYPES_H_