]>
Commit | Line | Data |
---|---|---|
ff7c6d11 XL |
1 | // Copyright © 2016-2017 winapi-rs developers |
2 | // Licensed under the Apache License, Version 2.0 | |
3 | // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
4 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option. | |
5 | // All files in the project carrying such notice may not be copied, modified, or distributed | |
6 | // except according to those terms. | |
0bf4aa26 XL |
7 | use shared::basetsd::{SIZE_T, ULONG_PTR}; |
8 | use shared::bcrypt::{BCRYPT_NO_KEY_VALIDATION, BCryptBufferDesc}; | |
9 | use shared::minwindef::{DWORD, LPVOID, PBYTE}; | |
10 | use um::winnt::{LONG, LPCWSTR, VOID}; | |
11 | pub type SECURITY_STATUS = LONG; | |
12 | pub type HCRYPTPROV = ULONG_PTR; | |
13 | pub type HCRYPTKEY = ULONG_PTR; | |
14 | pub type HCRYPTHASH = ULONG_PTR; | |
15 | FN!{stdcall PFN_NCRYPT_ALLOC( | |
16 | cbSize: SIZE_T, | |
17 | ) -> LPVOID} | |
18 | FN!{stdcall PFN_NCRYPT_FREE( | |
19 | pv: LPVOID, | |
20 | ) -> VOID} | |
21 | STRUCT!{struct NCRYPT_ALLOC_PARA { | |
22 | cbSize: DWORD, | |
23 | pfnAlloc: PFN_NCRYPT_ALLOC, | |
24 | pfnFree: PFN_NCRYPT_FREE, | |
25 | }} | |
26 | pub type NCryptBufferDesc = BCryptBufferDesc; | |
ff7c6d11 XL |
27 | pub type NCRYPT_HANDLE = ULONG_PTR; |
28 | pub type NCRYPT_PROV_HANDLE = ULONG_PTR; | |
29 | pub type NCRYPT_KEY_HANDLE = ULONG_PTR; | |
30 | pub type NCRYPT_HASH_HANDLE = ULONG_PTR; | |
31 | pub type NCRYPT_SECRET_HANDLE = ULONG_PTR; | |
0bf4aa26 XL |
32 | pub const NCRYPT_NO_PADDING_FLAG: DWORD = 0x00000001; |
33 | pub const NCRYPT_PAD_PKCS1_FLAG: DWORD = 0x00000002; | |
34 | pub const NCRYPT_PAD_OAEP_FLAG: DWORD = 0x00000004; | |
35 | pub const NCRYPT_PAD_PSS_FLAG: DWORD = 0x00000008; | |
36 | pub const NCRYPT_PAD_CIPHER_FLAG: DWORD = 0x00000010; | |
37 | pub const NCRYPT_ATTESTATION_FLAG: DWORD = 0x00000020; | |
38 | pub const NCRYPT_SEALING_FLAG: DWORD = 0x00000100; | |
39 | pub const NCRYPT_REGISTER_NOTIFY_FLAG: DWORD = 0x00000001; | |
40 | pub const NCRYPT_UNREGISTER_NOTIFY_FLAG: DWORD = 0x00000002; | |
41 | pub const NCRYPT_NO_KEY_VALIDATION: DWORD = BCRYPT_NO_KEY_VALIDATION; | |
42 | pub const NCRYPT_MACHINE_KEY_FLAG: DWORD = 0x00000020; | |
43 | pub const NCRYPT_SILENT_FLAG: DWORD = 0x00000040; | |
44 | pub const NCRYPT_OVERWRITE_KEY_FLAG: DWORD = 0x00000080; | |
45 | pub const NCRYPT_WRITE_KEY_TO_LEGACY_STORE_FLAG: DWORD = 0x00000200; | |
46 | pub const NCRYPT_DO_NOT_FINALIZE_FLAG: DWORD = 0x00000400; | |
47 | pub const NCRYPT_EXPORT_LEGACY_FLAG: DWORD = 0x00000800; | |
48 | pub const NCRYPT_IGNORE_DEVICE_STATE_FLAG: DWORD = 0x00001000; | |
49 | pub const NCRYPT_TREAT_NIST_AS_GENERIC_ECC_FLAG: DWORD = 0x00002000; | |
50 | pub const NCRYPT_NO_CACHED_PASSWORD: DWORD = 0x00004000; | |
51 | pub const NCRYPT_PROTECT_TO_LOCAL_SYSTEM: DWORD = 0x00008000; | |
52 | pub const NCRYPT_PERSIST_ONLY_FLAG: DWORD = 0x40000000; | |
53 | pub const NCRYPT_PERSIST_FLAG: DWORD = 0x80000000; | |
54 | pub const NCRYPT_PREFER_VIRTUAL_ISOLATION_FLAG: DWORD = 0x00010000; | |
55 | pub const NCRYPT_USE_VIRTUAL_ISOLATION_FLAG: DWORD = 0x00020000; | |
56 | pub const NCRYPT_USE_PER_BOOT_KEY_FLAG: DWORD = 0x00040000; | |
ff7c6d11 | 57 | extern "system" { |
0bf4aa26 XL |
58 | pub fn NCryptOpenStorageProvider( |
59 | phProvider: *mut NCRYPT_PROV_HANDLE, | |
60 | pszProviderName: LPCWSTR, | |
61 | dwFlags: DWORD, | |
62 | ) -> SECURITY_STATUS; | |
63 | } | |
64 | pub const NCRYPT_ALLOW_EXPORT_FLAG: DWORD = 0x00000001; | |
65 | pub const NCRYPT_ALLOW_PLAINTEXT_EXPORT_FLAG: DWORD = 0x00000002; | |
66 | pub const NCRYPT_ALLOW_ARCHIVING_FLAG: DWORD = 0x00000004; | |
67 | pub const NCRYPT_ALLOW_PLAINTEXT_ARCHIVING_FLAG: DWORD = 0x00000008; | |
68 | extern "system" { | |
69 | pub fn NCryptSetProperty( | |
70 | hObject: NCRYPT_HANDLE, | |
71 | pszProperty: LPCWSTR, | |
72 | pbInput: PBYTE, | |
73 | cbInput: DWORD, | |
74 | dwFlags: DWORD, | |
75 | ) -> SECURITY_STATUS; | |
76 | pub fn NCryptImportKey( | |
77 | hProvider: NCRYPT_PROV_HANDLE, | |
78 | hImportKey: NCRYPT_KEY_HANDLE, | |
79 | pszBlobType: LPCWSTR, | |
80 | pParameterList: *const NCryptBufferDesc, | |
81 | phKey: *mut NCRYPT_KEY_HANDLE, | |
82 | pbData: PBYTE, | |
83 | cbData: DWORD, | |
84 | dwFlags: DWORD, | |
85 | ) -> SECURITY_STATUS; | |
ff7c6d11 XL |
86 | pub fn NCryptFreeObject( |
87 | hObject: NCRYPT_HANDLE, | |
88 | ) -> SECURITY_STATUS; | |
89 | } |