[1166] | 1 | /**
|
---|
| 2 | * This file is part of the mingw-w64 runtime package.
|
---|
| 3 | * No warranty is given; refer to the file DISCLAIMER within this package.
|
---|
| 4 | */
|
---|
| 5 | #include <winapifamily.h>
|
---|
| 6 |
|
---|
| 7 | #ifndef __NCRYPT_H__
|
---|
| 8 | #define __NCRYPT_H__
|
---|
| 9 |
|
---|
| 10 | #ifdef __cplusplus
|
---|
| 11 | extern "C" {
|
---|
| 12 | #endif
|
---|
| 13 |
|
---|
| 14 | #ifndef WINAPI
|
---|
| 15 | #if defined(_ARM_)
|
---|
| 16 | #define WINAPI
|
---|
| 17 | #else
|
---|
| 18 | #define WINAPI __stdcall
|
---|
| 19 | #endif
|
---|
| 20 | #endif
|
---|
| 21 |
|
---|
| 22 | #ifndef __SECSTATUS_DEFINED__
|
---|
| 23 | typedef LONG SECURITY_STATUS;
|
---|
| 24 | #define __SECSTATUS_DEFINED__
|
---|
| 25 | #endif
|
---|
| 26 |
|
---|
| 27 | #include <bcrypt.h>
|
---|
| 28 |
|
---|
| 29 | #define NCRYPT_MAX_KEY_NAME_LENGTH 512
|
---|
| 30 | #define NCRYPT_MAX_ALG_ID_LENGTH 512
|
---|
| 31 |
|
---|
| 32 | #define MS_KEY_STORAGE_PROVIDER L"Microsoft Software Key Storage Provider"
|
---|
| 33 | #define MS_SMART_CARD_KEY_STORAGE_PROVIDER L"Microsoft Smart Card Key Storage Provider"
|
---|
| 34 | #define MS_PLATFORM_KEY_STORAGE_PROVIDER L"Microsoft Platform Crypto Provider"
|
---|
| 35 |
|
---|
| 36 | #define NCRYPT_RSA_ALGORITHM BCRYPT_RSA_ALGORITHM
|
---|
| 37 | #define NCRYPT_RSA_SIGN_ALGORITHM BCRYPT_RSA_SIGN_ALGORITHM
|
---|
| 38 | #define NCRYPT_DH_ALGORITHM BCRYPT_DH_ALGORITHM
|
---|
| 39 | #define NCRYPT_DSA_ALGORITHM BCRYPT_DSA_ALGORITHM
|
---|
| 40 | #define NCRYPT_MD2_ALGORITHM BCRYPT_MD2_ALGORITHM
|
---|
| 41 | #define NCRYPT_MD4_ALGORITHM BCRYPT_MD4_ALGORITHM
|
---|
| 42 | #define NCRYPT_MD5_ALGORITHM BCRYPT_MD5_ALGORITHM
|
---|
| 43 | #define NCRYPT_SHA1_ALGORITHM BCRYPT_SHA1_ALGORITHM
|
---|
| 44 | #define NCRYPT_SHA256_ALGORITHM BCRYPT_SHA256_ALGORITHM
|
---|
| 45 | #define NCRYPT_SHA384_ALGORITHM BCRYPT_SHA384_ALGORITHM
|
---|
| 46 | #define NCRYPT_SHA512_ALGORITHM BCRYPT_SHA512_ALGORITHM
|
---|
| 47 | #define NCRYPT_ECDSA_P256_ALGORITHM BCRYPT_ECDSA_P256_ALGORITHM
|
---|
| 48 | #define NCRYPT_ECDSA_P384_ALGORITHM BCRYPT_ECDSA_P384_ALGORITHM
|
---|
| 49 | #define NCRYPT_ECDSA_P521_ALGORITHM BCRYPT_ECDSA_P521_ALGORITHM
|
---|
| 50 | #define NCRYPT_ECDH_P256_ALGORITHM BCRYPT_ECDH_P256_ALGORITHM
|
---|
| 51 | #define NCRYPT_ECDH_P384_ALGORITHM BCRYPT_ECDH_P384_ALGORITHM
|
---|
| 52 | #define NCRYPT_ECDH_P521_ALGORITHM BCRYPT_ECDH_P521_ALGORITHM
|
---|
| 53 | #if NTDDI_VERSION >= 0x06020000
|
---|
| 54 | #define NCRYPT_AES_ALGORITHM BCRYPT_AES_ALGORITHM
|
---|
| 55 | #define NCRYPT_RC2_ALGORITHM BCRYPT_RC2_ALGORITHM
|
---|
| 56 | #define NCRYPT_3DES_ALGORITHM BCRYPT_3DES_ALGORITHM
|
---|
| 57 | #define NCRYPT_DES_ALGORITHM BCRYPT_DES_ALGORITHM
|
---|
| 58 | #define NCRYPT_DESX_ALGORITHM BCRYPT_DESX_ALGORITHM
|
---|
| 59 | #define NCRYPT_3DES_112_ALGORITHM BCRYPT_3DES_112_ALGORITHM
|
---|
| 60 | #define NCRYPT_SP800108_CTR_HMAC_ALGORITHM BCRYPT_SP800108_CTR_HMAC_ALGORITHM
|
---|
| 61 | #define NCRYPT_SP80056A_CONCAT_ALGORITHM BCRYPT_SP80056A_CONCAT_ALGORITHM
|
---|
| 62 | #define NCRYPT_PBKDF2_ALGORITHM BCRYPT_PBKDF2_ALGORITHM
|
---|
| 63 | #define NCRYPT_CAPI_KDF_ALGORITHM BCRYPT_CAPI_KDF_ALGORITHM
|
---|
| 64 | #endif
|
---|
| 65 |
|
---|
| 66 | #define NCRYPT_KEY_STORAGE_ALGORITHM L"KEY_STORAGE"
|
---|
| 67 |
|
---|
| 68 | #define NCRYPT_CIPHER_INTERFACE BCRYPT_CIPHER_INTERFACE
|
---|
| 69 | #define NCRYPT_HASH_INTERFACE BCRYPT_HASH_INTERFACE
|
---|
| 70 | #define NCRYPT_ASYMMETRIC_ENCRYPTION_INTERFACE BCRYPT_ASYMMETRIC_ENCRYPTION_INTERFACE
|
---|
| 71 | #define NCRYPT_SECRET_AGREEMENT_INTERFACE BCRYPT_SECRET_AGREEMENT_INTERFACE
|
---|
| 72 | #define NCRYPT_SIGNATURE_INTERFACE BCRYPT_SIGNATURE_INTERFACE
|
---|
| 73 | #if NTDDI_VERSION >= 0x06020000
|
---|
| 74 | #define NCRYPT_KEY_DERIVATION_INTERFACE BCRYPT_KEY_DERIVATION_INTERFACE
|
---|
| 75 | #endif
|
---|
| 76 |
|
---|
| 77 | #define NCRYPT_KEY_STORAGE_INTERFACE 0x00010001
|
---|
| 78 | #define NCRYPT_SCHANNEL_INTERFACE 0x00010002
|
---|
| 79 | #define NCRYPT_SCHANNEL_SIGNATURE_INTERFACE 0x00010003
|
---|
| 80 | #if NTDDI_VERSION >= 0x06020000
|
---|
| 81 | #define NCRYPT_KEY_PROTECTION_INTERFACE 0x00010004
|
---|
| 82 | #endif
|
---|
| 83 |
|
---|
| 84 | #define NCRYPT_RSA_ALGORITHM_GROUP NCRYPT_RSA_ALGORITHM
|
---|
| 85 | #define NCRYPT_DH_ALGORITHM_GROUP NCRYPT_DH_ALGORITHM
|
---|
| 86 | #define NCRYPT_DSA_ALGORITHM_GROUP NCRYPT_DSA_ALGORITHM
|
---|
| 87 | #define NCRYPT_ECDSA_ALGORITHM_GROUP L"ECDSA"
|
---|
| 88 | #define NCRYPT_ECDH_ALGORITHM_GROUP L"ECDH"
|
---|
| 89 |
|
---|
| 90 | #if NTDDI_VERSION >= 0x06020000
|
---|
| 91 | #define NCRYPT_AES_ALGORITHM_GROUP NCRYPT_AES_ALGORITHM
|
---|
| 92 | #define NCRYPT_RC2_ALGORITHM_GROUP NCRYPT_RC2_ALGORITHM
|
---|
| 93 | #define NCRYPT_DES_ALGORITHM_GROUP L"DES"
|
---|
| 94 | #define NCRYPT_KEY_DERIVATION_GROUP L"KEY_DERIVATION"
|
---|
| 95 | #endif
|
---|
| 96 |
|
---|
| 97 | #define NCRYPTBUFFER_VERSION 0
|
---|
| 98 |
|
---|
| 99 | #define NCRYPTBUFFER_EMPTY 0
|
---|
| 100 | #define NCRYPTBUFFER_DATA 1
|
---|
| 101 | #define NCRYPTBUFFER_PROTECTION_DESCRIPTOR_STRING 3
|
---|
| 102 | #define NCRYPTBUFFER_PROTECTION_FLAGS 4
|
---|
| 103 |
|
---|
| 104 | #define NCRYPTBUFFER_SSL_CLIENT_RANDOM 20
|
---|
| 105 | #define NCRYPTBUFFER_SSL_SERVER_RANDOM 21
|
---|
| 106 | #define NCRYPTBUFFER_SSL_HIGHEST_VERSION 22
|
---|
| 107 | #define NCRYPTBUFFER_SSL_CLEAR_KEY 23
|
---|
| 108 | #define NCRYPTBUFFER_SSL_KEY_ARG_DATA 24
|
---|
| 109 |
|
---|
| 110 | #define NCRYPTBUFFER_PKCS_OID 40
|
---|
| 111 | #define NCRYPTBUFFER_PKCS_ALG_OID 41
|
---|
| 112 | #define NCRYPTBUFFER_PKCS_ALG_PARAM 42
|
---|
| 113 | #define NCRYPTBUFFER_PKCS_ALG_ID 43
|
---|
| 114 | #define NCRYPTBUFFER_PKCS_ATTRS 44
|
---|
| 115 | #define NCRYPTBUFFER_PKCS_KEY_NAME 45
|
---|
| 116 | #define NCRYPTBUFFER_PKCS_SECRET 46
|
---|
| 117 | #define NCRYPTBUFFER_CERT_BLOB 47
|
---|
| 118 |
|
---|
| 119 | #define NCRYPT_NO_PADDING_FLAG 0x1
|
---|
| 120 | #define NCRYPT_PAD_PKCS1_FLAG 0x2
|
---|
| 121 | #define NCRYPT_PAD_OAEP_FLAG 0x4
|
---|
| 122 | #define NCRYPT_PAD_PSS_FLAG 0x8
|
---|
| 123 | #if NTDDI_VERSION >= 0x06020000
|
---|
| 124 | #define NCRYPT_PAD_CIPHER_FLAG 0x10
|
---|
| 125 |
|
---|
| 126 | #define NCRYPT_CIPHER_NO_PADDING_FLAG 0x0
|
---|
| 127 | #define NCRYPT_CIPHER_BLOCK_PADDING_FLAG 0x1
|
---|
| 128 | #define NCRYPT_CIPHER_OTHER_PADDING_FLAG 0x2
|
---|
| 129 | #endif
|
---|
| 130 |
|
---|
| 131 | #ifndef HCRYPTPROV_DEFINED
|
---|
| 132 | #define HCRYPTPROV_DEFINED
|
---|
| 133 | typedef ULONG_PTR HCRYPTPROV;
|
---|
| 134 | typedef ULONG_PTR HCRYPTKEY;
|
---|
| 135 | typedef ULONG_PTR HCRYPTHASH;
|
---|
| 136 | #endif
|
---|
| 137 |
|
---|
| 138 | typedef LPVOID (WINAPI *PFN_NCRYPT_ALLOC) (SIZE_T cbSize);
|
---|
| 139 | typedef VOID (WINAPI *PFN_NCRYPT_FREE) (LPVOID pv);
|
---|
| 140 |
|
---|
| 141 | typedef struct NCRYPT_ALLOC_PARA {
|
---|
| 142 | DWORD cbSize;
|
---|
| 143 | PFN_NCRYPT_ALLOC pfnAlloc;
|
---|
| 144 | PFN_NCRYPT_FREE pfnFree;
|
---|
| 145 | } NCRYPT_ALLOC_PARA;
|
---|
| 146 |
|
---|
| 147 | typedef BCryptBuffer NCryptBuffer;
|
---|
| 148 | typedef BCryptBuffer *PNCryptBuffer;
|
---|
| 149 | typedef BCryptBufferDesc NCryptBufferDesc;
|
---|
| 150 | typedef BCryptBufferDesc *PNCryptBufferDesc;
|
---|
| 151 |
|
---|
| 152 | typedef ULONG_PTR NCRYPT_HANDLE;
|
---|
| 153 | typedef ULONG_PTR NCRYPT_PROV_HANDLE;
|
---|
| 154 | typedef ULONG_PTR NCRYPT_KEY_HANDLE;
|
---|
| 155 | typedef ULONG_PTR NCRYPT_HASH_HANDLE;
|
---|
| 156 | typedef ULONG_PTR NCRYPT_SECRET_HANDLE;
|
---|
| 157 |
|
---|
| 158 | #if NTDDI_VERSION >= 0x06020000
|
---|
| 159 | typedef struct _NCRYPT_CIPHER_PADDING_INFO {
|
---|
| 160 | ULONG cbSize;
|
---|
| 161 | DWORD dwFlags;
|
---|
| 162 | PUCHAR pbIV;
|
---|
| 163 | ULONG cbIV;
|
---|
| 164 | PUCHAR pbOtherInfo;
|
---|
| 165 | ULONG cbOtherInfo;
|
---|
| 166 | } NCRYPT_CIPHER_PADDING_INFO,*PNCRYPT_CIPHER_PADDING_INFO;
|
---|
| 167 | #endif
|
---|
| 168 |
|
---|
| 169 | #define NCRYPT_NO_KEY_VALIDATION BCRYPT_NO_KEY_VALIDATION
|
---|
| 170 | #define NCRYPT_MACHINE_KEY_FLAG 0x20
|
---|
| 171 | #define NCRYPT_SILENT_FLAG 0x40
|
---|
| 172 | #define NCRYPT_OVERWRITE_KEY_FLAG 0x80
|
---|
| 173 | #ifndef NCRYPT_WRITE_KEY_TO_LEGACY_STORE_FLAG
|
---|
| 174 | #define NCRYPT_WRITE_KEY_TO_LEGACY_STORE_FLAG 0x200
|
---|
| 175 | #endif
|
---|
| 176 | #ifndef NCRYPT_DO_NOT_FINALIZE_FLAG
|
---|
| 177 | #define NCRYPT_DO_NOT_FINALIZE_FLAG 0x400
|
---|
| 178 | #endif
|
---|
| 179 | #define NCRYPT_PERSIST_ONLY_FLAG 0x40000000
|
---|
| 180 | #define NCRYPT_PERSIST_FLAG 0x80000000
|
---|
| 181 | #define NCRYPT_REGISTER_NOTIFY_FLAG 0x1
|
---|
| 182 | #define NCRYPT_UNREGISTER_NOTIFY_FLAG 0x2
|
---|
| 183 |
|
---|
| 184 | #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) || _WIN32_WINNT >= 0x0A00
|
---|
| 185 | #define NCRYPT_CIPHER_OPERATION BCRYPT_CIPHER_OPERATION
|
---|
| 186 | #define NCRYPT_HASH_OPERATION BCRYPT_HASH_OPERATION
|
---|
| 187 | #define NCRYPT_ASYMMETRIC_ENCRYPTION_OPERATION BCRYPT_ASYMMETRIC_ENCRYPTION_OPERATION
|
---|
| 188 | #define NCRYPT_SECRET_AGREEMENT_OPERATION BCRYPT_SECRET_AGREEMENT_OPERATION
|
---|
| 189 | #define NCRYPT_SIGNATURE_OPERATION BCRYPT_SIGNATURE_OPERATION
|
---|
| 190 | #define NCRYPT_RNG_OPERATION BCRYPT_RNG_OPERATION
|
---|
| 191 | #if NTDDI_VERSION >= 0x06020000
|
---|
| 192 | #define NCRYPT_KEY_DERIVATION_OPERATION BCRYPT_KEY_DERIVATION_OPERATION
|
---|
| 193 | #endif
|
---|
| 194 |
|
---|
| 195 | #define NCRYPT_MACHINE_KEY_FLAG 0x20
|
---|
| 196 |
|
---|
| 197 | #define NCRYPT_MACHINE_KEY_FLAG 0x20
|
---|
| 198 | #define NCRYPT_SILENT_FLAG 0x40
|
---|
| 199 | #define NCRYPT_MACHINE_KEY_FLAG 0x20
|
---|
| 200 | #define NCRYPT_OVERWRITE_KEY_FLAG 0x80
|
---|
| 201 |
|
---|
| 202 | typedef struct _NCryptAlgorithmName {
|
---|
| 203 | LPWSTR pszName;
|
---|
| 204 | DWORD dwClass;
|
---|
| 205 | DWORD dwAlgOperations;
|
---|
| 206 | DWORD dwFlags;
|
---|
| 207 | } NCryptAlgorithmName;
|
---|
| 208 |
|
---|
| 209 | typedef struct NCryptKeyName {
|
---|
| 210 | LPWSTR pszName;
|
---|
| 211 | LPWSTR pszAlgid;
|
---|
| 212 | DWORD dwLegacyKeySpec;
|
---|
| 213 | DWORD dwFlags;
|
---|
| 214 | } NCryptKeyName;
|
---|
| 215 |
|
---|
| 216 | typedef struct NCryptProviderName {
|
---|
| 217 | LPWSTR pszName;
|
---|
| 218 | LPWSTR pszComment;
|
---|
| 219 | } NCryptProviderName;
|
---|
| 220 |
|
---|
| 221 | SECURITY_STATUS WINAPI NCryptOpenStorageProvider (NCRYPT_PROV_HANDLE *phProvider, LPCWSTR pszProviderName, DWORD dwFlags);
|
---|
| 222 | SECURITY_STATUS WINAPI NCryptEnumAlgorithms (NCRYPT_PROV_HANDLE hProvider, DWORD dwAlgOperations, DWORD *pdwAlgCount, NCryptAlgorithmName **ppAlgList, DWORD dwFlags);
|
---|
| 223 | SECURITY_STATUS WINAPI NCryptIsAlgSupported (NCRYPT_PROV_HANDLE hProvider, LPCWSTR pszAlgId, DWORD dwFlags);
|
---|
| 224 | SECURITY_STATUS WINAPI NCryptEnumKeys (NCRYPT_PROV_HANDLE hProvider, LPCWSTR pszScope, NCryptKeyName **ppKeyName, PVOID *ppEnumState, DWORD dwFlags);
|
---|
| 225 | SECURITY_STATUS WINAPI NCryptEnumStorageProviders (DWORD *pdwProviderCount, NCryptProviderName **ppProviderList, DWORD dwFlags);
|
---|
| 226 | SECURITY_STATUS WINAPI NCryptFreeBuffer (PVOID pvInput);
|
---|
| 227 | SECURITY_STATUS WINAPI NCryptOpenKey (NCRYPT_PROV_HANDLE hProvider, NCRYPT_KEY_HANDLE *phKey, LPCWSTR pszKeyName, DWORD dwLegacyKeySpec, DWORD dwFlags);
|
---|
| 228 | SECURITY_STATUS WINAPI NCryptCreatePersistedKey (NCRYPT_PROV_HANDLE hProvider, NCRYPT_KEY_HANDLE *phKey, LPCWSTR pszAlgId, LPCWSTR pszKeyName, DWORD dwLegacyKeySpec, DWORD dwFlags);
|
---|
| 229 |
|
---|
| 230 | #define NCRYPT_NAME_PROPERTY L"Name"
|
---|
| 231 | #define NCRYPT_UNIQUE_NAME_PROPERTY L"Unique Name"
|
---|
| 232 | #define NCRYPT_ALGORITHM_PROPERTY L"Algorithm Name"
|
---|
| 233 | #define NCRYPT_LENGTH_PROPERTY L"Length"
|
---|
| 234 | #define NCRYPT_LENGTHS_PROPERTY L"Lengths"
|
---|
| 235 | #define NCRYPT_BLOCK_LENGTH_PROPERTY L"Block Length"
|
---|
| 236 | #if NTDDI_VERSION >= 0x06020000
|
---|
| 237 | #define NCRYPT_CHAINING_MODE_PROPERTY L"Chaining Mode"
|
---|
| 238 | #define NCRYPT_AUTH_TAG_LENGTH L"AuthTagLength"
|
---|
| 239 | #endif
|
---|
| 240 | #define NCRYPT_UI_POLICY_PROPERTY L"UI Policy"
|
---|
| 241 | #define NCRYPT_EXPORT_POLICY_PROPERTY L"Export Policy"
|
---|
| 242 | #define NCRYPT_WINDOW_HANDLE_PROPERTY L"HWND Handle"
|
---|
| 243 | #define NCRYPT_USE_CONTEXT_PROPERTY L"Use Context"
|
---|
| 244 | #define NCRYPT_IMPL_TYPE_PROPERTY L"Impl Type"
|
---|
| 245 | #define NCRYPT_KEY_USAGE_PROPERTY L"Key Usage"
|
---|
| 246 | #define NCRYPT_KEY_TYPE_PROPERTY L"Key Type"
|
---|
| 247 | #define NCRYPT_VERSION_PROPERTY L"Version"
|
---|
| 248 | #define NCRYPT_SECURITY_DESCR_SUPPORT_PROPERTY L"Security Descr Support"
|
---|
| 249 | #define NCRYPT_SECURITY_DESCR_PROPERTY L"Security Descr"
|
---|
| 250 | #define NCRYPT_USE_COUNT_ENABLED_PROPERTY L"Enabled Use Count"
|
---|
| 251 | #define NCRYPT_USE_COUNT_PROPERTY L"Use Count"
|
---|
| 252 | #define NCRYPT_LAST_MODIFIED_PROPERTY L"Modified"
|
---|
| 253 | #define NCRYPT_MAX_NAME_LENGTH_PROPERTY L"Max Name Length"
|
---|
| 254 | #define NCRYPT_ALGORITHM_GROUP_PROPERTY L"Algorithm Group"
|
---|
| 255 | #define NCRYPT_DH_PARAMETERS_PROPERTY BCRYPT_DH_PARAMETERS
|
---|
| 256 | #define NCRYPT_PROVIDER_HANDLE_PROPERTY L"Provider Handle"
|
---|
| 257 | #define NCRYPT_PIN_PROPERTY L"SmartCardPin"
|
---|
| 258 | #define NCRYPT_READER_PROPERTY L"SmartCardReader"
|
---|
| 259 | #define NCRYPT_SMARTCARD_GUID_PROPERTY L"SmartCardGuid"
|
---|
| 260 | #define NCRYPT_CERTIFICATE_PROPERTY L"SmartCardKeyCertificate"
|
---|
| 261 | #define NCRYPT_PIN_PROMPT_PROPERTY L"SmartCardPinPrompt"
|
---|
| 262 | #define NCRYPT_USER_CERTSTORE_PROPERTY L"SmartCardUserCertStore"
|
---|
| 263 | #define NCRYPT_ROOT_CERTSTORE_PROPERTY L"SmartcardRootCertStore"
|
---|
| 264 | #define NCRYPT_SECURE_PIN_PROPERTY L"SmartCardSecurePin"
|
---|
| 265 | #define NCRYPT_ASSOCIATED_ECDH_KEY L"SmartCardAssociatedECDHKey"
|
---|
| 266 | #define NCRYPT_SCARD_PIN_ID L"SmartCardPinId"
|
---|
| 267 | #define NCRYPT_SCARD_PIN_INFO L"SmartCardPinInfo"
|
---|
| 268 |
|
---|
| 269 | #if NTDDI_VERSION >= 0x06020000
|
---|
| 270 | #define NCRYPT_READER_ICON_PROPERTY L"SmartCardReaderIcon"
|
---|
| 271 | #define NCRYPT_KDF_SECRET_VALUE L"KDFKeySecret"
|
---|
| 272 |
|
---|
| 273 | #define NCRYPT_PCP_PLATFORM_TYPE_PROPERTY L"PCP_PLATFORM_TYPE"
|
---|
| 274 | #define NCRYPT_PCP_PROVIDER_VERSION_PROPERTY L"PCP_PROVIDER_VERSION"
|
---|
| 275 | #define NCRYPT_PCP_EKPUB_PROPERTY L"PCP_EKPUB"
|
---|
| 276 | #define NCRYPT_PCP_EKCERT_PROPERTY L"PCP_EKCERT"
|
---|
| 277 | #define NCRYPT_PCP_EKNVCERT_PROPERTY L"PCP_EKNVCERT"
|
---|
| 278 | #define NCRYPT_PCP_SRKPUB_PROPERTY L"PCP_SRKPUB"
|
---|
| 279 | #define NCRYPT_PCP_PCRTABLE_PROPERTY L"PCP_PCRTABLE"
|
---|
| 280 | #define NCRYPT_PCP_CHANGEPASSWORD_PROPERTY L"PCP_CHANGEPASSWORD"
|
---|
| 281 | #define NCRYPT_PCP_PASSWORD_REQUIRED_PROPERTY L"PCP_PASSWORD_REQUIRED"
|
---|
| 282 | #define NCRYPT_PCP_USAGEAUTH_PROPERTY L"PCP_USAGEAUTH"
|
---|
| 283 | #define NCRYPT_PCP_MIGRATIONPASSWORD_PROPERTY L"PCP_MIGRATIONPASSWORD"
|
---|
| 284 | #define NCRYPT_PCP_EXPORT_ALLOWED_PROPERTY L"PCP_EXPORT_ALLOWED"
|
---|
| 285 | #define NCRYPT_PCP_STORAGEPARENT_PROPERTY L"PCP_STORAGEPARENT"
|
---|
| 286 | #define NCRYPT_PCP_PROVIDERHANDLE_PROPERTY L"PCP_PROVIDERMHANDLE"
|
---|
| 287 | #define NCRYPT_PCP_PLATFORMHANDLE_PROPERTY L"PCP_PLATFORMHANDLE"
|
---|
| 288 | #define NCRYPT_PCP_PLATFORM_BINDING_PCRMASK_PROPERTY L"PCP_PLATFORM_BINDING_PCRMASK"
|
---|
| 289 | #define NCRYPT_PCP_PLATFORM_BINDING_PCRDIGESTLIST_PROPERTY L"PCP_PLATFORM_BINDING_PCRDIGESTLIST"
|
---|
| 290 | #define NCRYPT_PCP_PLATFORM_BINDING_PCRDIGEST_PROPERTY L"PCP_PLATFORM_BINDING_PCRDIGEST"
|
---|
| 291 | #define NCRYPT_PCP_KEY_USAGE_POLICY_PROPERTY L"PCP_KEY_USAGE_POLICY"
|
---|
| 292 | #define NCRYPT_PCP_TPM12_IDBINDING_PROPERTY L"PCP_TPM12_IDBINDING"
|
---|
| 293 | #define NCRYPT_PCP_TPM12_IDACTIVATION_PROPERTY L"PCP_TPM12_IDACTIVATION"
|
---|
| 294 | #define NCRYPT_PCP_KEYATTESTATION_PROPERTY L"PCP_TPM12_KEYATTESTATION"
|
---|
| 295 | #define NCRYPT_PCP_ALTERNATE_KEY_STORAGE_LOCATION_PROPERTY L"PCP_ALTERNATE_KEY_STORAGE_LOCATION"
|
---|
| 296 |
|
---|
| 297 | #define NCRYPT_TPM12_PROVIDER (0x00010000)
|
---|
| 298 | #define NCRYPT_PCP_SIGNATURE_KEY (0x1)
|
---|
| 299 | #define NCRYPT_PCP_ENCRYPTION_KEY (0x2)
|
---|
| 300 | #define NCRYPT_PCP_GENERIC_KEY (NCRYPT_PCP_SIGNATURE_KEY | NCRYPT_PCP_ENCRYPTION_KEY)
|
---|
| 301 | #define NCRYPT_PCP_STORAGE_KEY (0x00000004)
|
---|
| 302 | #define NCRYPT_PCP_IDENTITY_KEY (0x00000008)
|
---|
| 303 | #endif
|
---|
| 304 |
|
---|
| 305 | #if NTDDI_VERSION >= 0x06020000
|
---|
| 306 | #define NCRYPT_INITIALIZATION_VECTOR BCRYPT_INITIALIZATION_VECTOR
|
---|
| 307 | #endif
|
---|
| 308 |
|
---|
| 309 | #define NCRYPT_MAX_PROPERTY_NAME 64
|
---|
| 310 |
|
---|
| 311 | #define NCRYPT_MAX_PROPERTY_DATA 0x100000
|
---|
| 312 |
|
---|
| 313 | #define NCRYPT_ALLOW_EXPORT_FLAG 0x1
|
---|
| 314 | #define NCRYPT_ALLOW_PLAINTEXT_EXPORT_FLAG 0x2
|
---|
| 315 | #define NCRYPT_ALLOW_ARCHIVING_FLAG 0x00000004
|
---|
| 316 | #define NCRYPT_ALLOW_PLAINTEXT_ARCHIVING_FLAG 0x00000008
|
---|
| 317 |
|
---|
| 318 | #define NCRYPT_IMPL_HARDWARE_FLAG 0x1
|
---|
| 319 | #define NCRYPT_IMPL_SOFTWARE_FLAG 0x2
|
---|
| 320 | #define NCRYPT_IMPL_REMOVABLE_FLAG 0x00000008
|
---|
| 321 | #define NCRYPT_IMPL_HARDWARE_RNG_FLAG 0x00000010
|
---|
| 322 |
|
---|
| 323 | #define NCRYPT_ALLOW_DECRYPT_FLAG 0x1
|
---|
| 324 | #define NCRYPT_ALLOW_SIGNING_FLAG 0x2
|
---|
| 325 | #define NCRYPT_ALLOW_KEY_AGREEMENT_FLAG 0x00000004
|
---|
| 326 | #define NCRYPT_ALLOW_ALL_USAGES 0x00ffffff
|
---|
| 327 |
|
---|
| 328 | #define NCRYPT_UI_PROTECT_KEY_FLAG 0x1
|
---|
| 329 | #define NCRYPT_UI_FORCE_HIGH_PROTECTION_FLAG 0x2
|
---|
| 330 |
|
---|
| 331 | #define NCRYPT_PERSIST_ONLY_FLAG 0x40000000
|
---|
| 332 | #define NCRYPT_PERSIST_FLAG 0x80000000
|
---|
| 333 | #define NCRYPT_PERSIST_ONLY_FLAG 0x40000000
|
---|
| 334 |
|
---|
| 335 | typedef struct __NCRYPT_UI_POLICY {
|
---|
| 336 | DWORD dwVersion;
|
---|
| 337 | DWORD dwFlags;
|
---|
| 338 | LPCWSTR pszCreationTitle;
|
---|
| 339 | LPCWSTR pszFriendlyName;
|
---|
| 340 | LPCWSTR pszDescription;
|
---|
| 341 | } NCRYPT_UI_POLICY;
|
---|
| 342 |
|
---|
| 343 | typedef struct __NCRYPT_SUPPORTED_LENGTHS {
|
---|
| 344 | DWORD dwMinLength;
|
---|
| 345 | DWORD dwMaxLength;
|
---|
| 346 | DWORD dwIncrement;
|
---|
| 347 | DWORD dwDefaultLength;
|
---|
| 348 | } NCRYPT_SUPPORTED_LENGTHS;
|
---|
| 349 |
|
---|
| 350 | SECURITY_STATUS WINAPI NCryptGetProperty (NCRYPT_HANDLE hObject, LPCWSTR pszProperty, PBYTE pbOutput, DWORD cbOutput, DWORD *pcbResult, DWORD dwFlags);
|
---|
| 351 | SECURITY_STATUS WINAPI NCryptSetProperty (NCRYPT_HANDLE hObject, LPCWSTR pszProperty, PBYTE pbInput, DWORD cbInput, DWORD dwFlags);
|
---|
| 352 | SECURITY_STATUS WINAPI NCryptFinalizeKey (NCRYPT_KEY_HANDLE hKey, DWORD dwFlags);
|
---|
| 353 | SECURITY_STATUS WINAPI NCryptEncrypt (NCRYPT_KEY_HANDLE hKey, PBYTE pbInput, DWORD cbInput, VOID *pPaddingInfo, PBYTE pbOutput, DWORD cbOutput, DWORD *pcbResult, DWORD dwFlags);
|
---|
| 354 | SECURITY_STATUS WINAPI NCryptDecrypt (NCRYPT_KEY_HANDLE hKey, PBYTE pbInput, DWORD cbInput, VOID *pPaddingInfo, PBYTE pbOutput, DWORD cbOutput, DWORD *pcbResult, DWORD dwFlags);
|
---|
| 355 |
|
---|
| 356 | #if NTDDI_VERSION >= 0x06020000
|
---|
| 357 | typedef struct _NCRYPT_KEY_BLOB_HEADER {
|
---|
| 358 | ULONG cbSize;
|
---|
| 359 | ULONG dwMagic;
|
---|
| 360 | ULONG cbAlgName;
|
---|
| 361 | ULONG cbKeyData;
|
---|
| 362 | } NCRYPT_KEY_BLOB_HEADER,*PNCRYPT_KEY_BLOB_HEADER;
|
---|
| 363 |
|
---|
| 364 | #define NCRYPT_CIPHER_KEY_BLOB_MAGIC 0x52485043
|
---|
| 365 | #define NCRYPT_PROTECTED_KEY_BLOB_MAGIC 0x4b545250
|
---|
| 366 |
|
---|
| 367 | #define NCRYPT_CIPHER_KEY_BLOB L"CipherKeyBlob"
|
---|
| 368 | #define NCRYPT_PROTECTED_KEY_BLOB L"ProtectedKeyBlob"
|
---|
| 369 | #endif
|
---|
| 370 |
|
---|
| 371 | #define NCRYPT_PKCS7_ENVELOPE_BLOB L"PKCS7_ENVELOPE"
|
---|
| 372 | #define NCRYPT_PKCS8_PRIVATE_KEY_BLOB L"PKCS8_PRIVATEKEY"
|
---|
| 373 | #define NCRYPT_OPAQUETRANSPORT_BLOB L"OpaqueTransport"
|
---|
| 374 |
|
---|
| 375 | #define NCRYPT_MACHINE_KEY_FLAG 0x20
|
---|
| 376 | #define NCRYPT_EXPORT_LEGACY_FLAG 0x00000800
|
---|
| 377 |
|
---|
| 378 | #define NCRYPT_REGISTER_NOTIFY_FLAG 0x1
|
---|
| 379 | #define NCRYPT_UNREGISTER_NOTIFY_FLAG 0x2
|
---|
| 380 | #define NCRYPT_MACHINE_KEY_FLAG 0x20
|
---|
| 381 |
|
---|
| 382 | #define NCRYPT_KEY_STORAGE_INTERFACE_VERSION BCRYPT_MAKE_INTERFACE_VERSION (1, 0)
|
---|
| 383 | #define NCRYPT_KEY_STORAGE_INTERFACE_VERSION_2 BCRYPT_MAKE_INTERFACE_VERSION (2, 0)
|
---|
| 384 |
|
---|
| 385 | SECURITY_STATUS WINAPI NCryptImportKey (NCRYPT_PROV_HANDLE hProvider, NCRYPT_KEY_HANDLE hImportKey, LPCWSTR pszBlobType, NCryptBufferDesc *pParameterList, NCRYPT_KEY_HANDLE *phKey, PBYTE pbData, DWORD cbData, DWORD dwFlags);
|
---|
| 386 | SECURITY_STATUS WINAPI NCryptExportKey (NCRYPT_KEY_HANDLE hKey, NCRYPT_KEY_HANDLE hExportKey, LPCWSTR pszBlobType, NCryptBufferDesc *pParameterList, PBYTE pbOutput, DWORD cbOutput, DWORD *pcbResult, DWORD dwFlags);
|
---|
| 387 | SECURITY_STATUS WINAPI NCryptSignHash (NCRYPT_KEY_HANDLE hKey, VOID *pPaddingInfo, PBYTE pbHashValue, DWORD cbHashValue, PBYTE pbSignature, DWORD cbSignature, DWORD *pcbResult, DWORD dwFlags);
|
---|
| 388 | SECURITY_STATUS WINAPI NCryptVerifySignature (NCRYPT_KEY_HANDLE hKey, VOID *pPaddingInfo, PBYTE pbHashValue, DWORD cbHashValue, PBYTE pbSignature, DWORD cbSignature, DWORD dwFlags);
|
---|
| 389 | SECURITY_STATUS WINAPI NCryptDeleteKey (NCRYPT_KEY_HANDLE hKey, DWORD dwFlags);
|
---|
| 390 | SECURITY_STATUS WINAPI NCryptFreeObject (NCRYPT_HANDLE hObject);
|
---|
| 391 | WINBOOL WINAPI NCryptIsKeyHandle (NCRYPT_KEY_HANDLE hKey);
|
---|
| 392 | SECURITY_STATUS WINAPI NCryptTranslateHandle (NCRYPT_PROV_HANDLE *phProvider, NCRYPT_KEY_HANDLE *phKey, HCRYPTPROV hLegacyProv, HCRYPTKEY hLegacyKey, DWORD dwLegacyKeySpec, DWORD dwFlags);
|
---|
| 393 | SECURITY_STATUS WINAPI NCryptNotifyChangeKey (NCRYPT_PROV_HANDLE hProvider, HANDLE *phEvent, DWORD dwFlags);
|
---|
| 394 | SECURITY_STATUS WINAPI NCryptSecretAgreement (NCRYPT_KEY_HANDLE hPrivKey, NCRYPT_KEY_HANDLE hPubKey, NCRYPT_SECRET_HANDLE *phAgreedSecret, DWORD dwFlags);
|
---|
| 395 | SECURITY_STATUS WINAPI NCryptDeriveKey (NCRYPT_SECRET_HANDLE hSharedSecret, LPCWSTR pwszKDF, NCryptBufferDesc *pParameterList, PBYTE pbDerivedKey, DWORD cbDerivedKey, DWORD *pcbResult, ULONG dwFlags);
|
---|
| 396 | #if NTDDI_VERSION >= 0x06020000
|
---|
| 397 | SECURITY_STATUS WINAPI NCryptKeyDerivation (NCRYPT_KEY_HANDLE hKey, NCryptBufferDesc *pParameterList, PUCHAR pbDerivedKey, DWORD cbDerivedKey, DWORD *pcbResult, ULONG dwFlags);
|
---|
| 398 | #endif
|
---|
| 399 | #if NTDDI_VERSION >= NTDDI_WINTHRESHOLD
|
---|
| 400 | SECURITY_STATUS WINAPI NCryptCreateClaim (NCRYPT_KEY_HANDLE hSubjectKey, NCRYPT_KEY_HANDLE hAuthorityKey, DWORD dwClaimType, NCryptBufferDesc *pParameterList, PBYTE pbClaimBlob, DWORD cbClaimBlob, DWORD *pcbResult, DWORD dwFlags);
|
---|
| 401 | SECURITY_STATUS WINAPI NCryptVerifyClaim (NCRYPT_KEY_HANDLE hSubjectKey, NCRYPT_KEY_HANDLE hAuthorityKey, DWORD dwClaimType, NCryptBufferDesc *pParameterList, PBYTE pbClaimBlob, DWORD cbClaimBlob, NCryptBufferDesc *pOutput, DWORD dwFlags);
|
---|
| 402 | #endif
|
---|
| 403 | #endif
|
---|
| 404 |
|
---|
| 405 | #ifdef __cplusplus
|
---|
| 406 | }
|
---|
| 407 | #endif
|
---|
| 408 | #endif
|
---|