| ncrypt.h (6.1.7601.23418-Windows_7.0) | | ncrypt.h (6.3.9600.17415-Windows_8.1) |
|
| | #include <winapifamily.h> |
| //+--------------------------------------------------------------------------- | | //+--------------------------------------------------------------------------- |
| // | | // |
| // Microsoft Windows | | // Microsoft Windows |
| // Copyright (C) Microsoft Corporation, 2004. | | // Copyright (C) Microsoft Corporation, 2004. |
| // | | // |
| // File: ncrypt.h | | // File: ncrypt.h |
| // | | // |
| // Contents: Cryptographic API Prototypes and Definitions | | // Contents: Cryptographic API Prototypes and Definitions |
| // | | // |
| //---------------------------------------------------------------------------- | | //---------------------------------------------------------------------------- |
| | |
| skipping to change at line 30 | | skipping to change at line 31 |
| #define WINAPI __stdcall | | #define WINAPI __stdcall |
| #endif | | #endif |
| | |
| #ifndef __SECSTATUS_DEFINED__ | | #ifndef __SECSTATUS_DEFINED__ |
| typedef LONG SECURITY_STATUS; | | typedef LONG SECURITY_STATUS; |
| #define __SECSTATUS_DEFINED__ | | #define __SECSTATUS_DEFINED__ |
| #endif | | #endif |
| | |
| #include <bcrypt.h> | | #include <bcrypt.h> |
| | |
|
| | #ifndef HCRYPTPROV_DEFINED |
| | #define HCRYPTPROV_DEFINED |
| | typedef ULONG_PTR HCRYPTPROV; |
| | typedef ULONG_PTR HCRYPTKEY; |
| | typedef ULONG_PTR HCRYPTHASH; |
| | #endif |
| | |
| | // |
| | // Maximum length of Key name, in characters |
| | // |
| | #define NCRYPT_MAX_KEY_NAME_LENGTH 512 |
| | |
| | // |
| | // Maximum length of Algorithm name, in characters |
| | // |
| | #define NCRYPT_MAX_ALG_ID_LENGTH 512 |
| | |
| | /**************************************************************************** |
| | |
| | NCRYPT memory management routines for functions that require |
| | the caller to allocate memory |
| | |
| | ****************************************************************************/ |
| | typedef LPVOID (WINAPI *PFN_NCRYPT_ALLOC)( |
| | _In_ SIZE_T cbSize |
| | ); |
| | |
| | typedef VOID (WINAPI *PFN_NCRYPT_FREE)( |
| | _In_ LPVOID pv |
| | ); |
| | |
| | typedef struct NCRYPT_ALLOC_PARA { |
| | DWORD cbSize; // size of this structure |
| | PFN_NCRYPT_ALLOC pfnAlloc; |
| | PFN_NCRYPT_FREE pfnFree; |
| | } NCRYPT_ALLOC_PARA; |
| | |
| // | | // |
| // Microsoft built-in providers. | | // Microsoft built-in providers. |
| // | | // |
| | |
| #define MS_KEY_STORAGE_PROVIDER L"Microsoft Software Key Storage Provide
r" | | #define MS_KEY_STORAGE_PROVIDER L"Microsoft Software Key Storage Provide
r" |
| #define MS_SMART_CARD_KEY_STORAGE_PROVIDER L"Microsoft Smart Card Key Storage Pr
ovider" | | #define MS_SMART_CARD_KEY_STORAGE_PROVIDER L"Microsoft Smart Card Key Storage Pr
ovider" |
|
| | #define MS_PLATFORM_KEY_STORAGE_PROVIDER L"Microsoft Platform Crypto Provider" |
| | |
| // | | // |
| // Common algorithm identifiers. | | // Common algorithm identifiers. |
| // | | // |
| | |
| #define NCRYPT_RSA_ALGORITHM BCRYPT_RSA_ALGORITHM | | #define NCRYPT_RSA_ALGORITHM BCRYPT_RSA_ALGORITHM |
| #define NCRYPT_RSA_SIGN_ALGORITHM BCRYPT_RSA_SIGN_ALGORITHM | | #define NCRYPT_RSA_SIGN_ALGORITHM BCRYPT_RSA_SIGN_ALGORITHM |
| #define NCRYPT_DH_ALGORITHM BCRYPT_DH_ALGORITHM | | #define NCRYPT_DH_ALGORITHM BCRYPT_DH_ALGORITHM |
| #define NCRYPT_DSA_ALGORITHM BCRYPT_DSA_ALGORITHM | | #define NCRYPT_DSA_ALGORITHM BCRYPT_DSA_ALGORITHM |
| #define NCRYPT_MD2_ALGORITHM BCRYPT_MD2_ALGORITHM | | #define NCRYPT_MD2_ALGORITHM BCRYPT_MD2_ALGORITHM |
| | |
| skipping to change at line 59 | | skipping to change at line 98 |
| #define NCRYPT_SHA256_ALGORITHM BCRYPT_SHA256_ALGORITHM | | #define NCRYPT_SHA256_ALGORITHM BCRYPT_SHA256_ALGORITHM |
| #define NCRYPT_SHA384_ALGORITHM BCRYPT_SHA384_ALGORITHM | | #define NCRYPT_SHA384_ALGORITHM BCRYPT_SHA384_ALGORITHM |
| #define NCRYPT_SHA512_ALGORITHM BCRYPT_SHA512_ALGORITHM | | #define NCRYPT_SHA512_ALGORITHM BCRYPT_SHA512_ALGORITHM |
| #define NCRYPT_ECDSA_P256_ALGORITHM BCRYPT_ECDSA_P256_ALGORITHM | | #define NCRYPT_ECDSA_P256_ALGORITHM BCRYPT_ECDSA_P256_ALGORITHM |
| #define NCRYPT_ECDSA_P384_ALGORITHM BCRYPT_ECDSA_P384_ALGORITHM | | #define NCRYPT_ECDSA_P384_ALGORITHM BCRYPT_ECDSA_P384_ALGORITHM |
| #define NCRYPT_ECDSA_P521_ALGORITHM BCRYPT_ECDSA_P521_ALGORITHM | | #define NCRYPT_ECDSA_P521_ALGORITHM BCRYPT_ECDSA_P521_ALGORITHM |
| #define NCRYPT_ECDH_P256_ALGORITHM BCRYPT_ECDH_P256_ALGORITHM | | #define NCRYPT_ECDH_P256_ALGORITHM BCRYPT_ECDH_P256_ALGORITHM |
| #define NCRYPT_ECDH_P384_ALGORITHM BCRYPT_ECDH_P384_ALGORITHM | | #define NCRYPT_ECDH_P384_ALGORITHM BCRYPT_ECDH_P384_ALGORITHM |
| #define NCRYPT_ECDH_P521_ALGORITHM BCRYPT_ECDH_P521_ALGORITHM | | #define NCRYPT_ECDH_P521_ALGORITHM BCRYPT_ECDH_P521_ALGORITHM |
| | |
|
| | #if (NTDDI_VERSION >= NTDDI_WIN8) |
| | #define NCRYPT_AES_ALGORITHM BCRYPT_AES_ALGORITHM |
| | #define NCRYPT_RC2_ALGORITHM BCRYPT_RC2_ALGORITHM |
| | #define NCRYPT_3DES_ALGORITHM BCRYPT_3DES_ALGORITHM |
| | #define NCRYPT_DES_ALGORITHM BCRYPT_DES_ALGORITHM |
| | #define NCRYPT_DESX_ALGORITHM BCRYPT_DESX_ALGORITHM |
| | #define NCRYPT_3DES_112_ALGORITHM BCRYPT_3DES_112_ALGORITHM |
| | |
| | #define NCRYPT_SP800108_CTR_HMAC_ALGORITHM BCRYPT_SP800108_CTR_HMAC_ALGORITHM |
| | #define NCRYPT_SP80056A_CONCAT_ALGORITHM BCRYPT_SP80056A_CONCAT_ALGORITHM |
| | #define NCRYPT_PBKDF2_ALGORITHM BCRYPT_PBKDF2_ALGORITHM |
| | #define NCRYPT_CAPI_KDF_ALGORITHM BCRYPT_CAPI_KDF_ALGORITHM |
| | #endif // (NTDDI_VERSION >= NTDDI_WIN8) |
| | |
| #define NCRYPT_KEY_STORAGE_ALGORITHM L"KEY_STORAGE" | | #define NCRYPT_KEY_STORAGE_ALGORITHM L"KEY_STORAGE" |
| | |
| // | | // |
| // Interfaces | | // Interfaces |
| // | | // |
|
| | | #define NCRYPT_CIPHER_INTERFACE BCRYPT_CIPHER_INTERFACE |
| #define NCRYPT_HASH_INTERFACE BCRYPT_HASH_INTERFACE | | #define NCRYPT_HASH_INTERFACE BCRYPT_HASH_INTERFACE |
| #define NCRYPT_ASYMMETRIC_ENCRYPTION_INTERFACE BCRYPT_ASYMMETRIC_ENCRYPTION_INT
ERFACE | | #define NCRYPT_ASYMMETRIC_ENCRYPTION_INTERFACE BCRYPT_ASYMMETRIC_ENCRYPTION_INT
ERFACE |
|
| | | |
| #define NCRYPT_SECRET_AGREEMENT_INTERFACE BCRYPT_SECRET_AGREEMENT_INTERFAC
E | | #define NCRYPT_SECRET_AGREEMENT_INTERFACE BCRYPT_SECRET_AGREEMENT_INTERFAC
E |
|
| | | |
| #define NCRYPT_SIGNATURE_INTERFACE BCRYPT_SIGNATURE_INTERFACE | | #define NCRYPT_SIGNATURE_INTERFACE BCRYPT_SIGNATURE_INTERFACE |
|
| | #if (NTDDI_VERSION >= NTDDI_WIN8) |
| | #define NCRYPT_KEY_DERIVATION_INTERFACE BCRYPT_KEY_DERIVATION_INTERFACE |
| | #endif |
| | |
| #define NCRYPT_KEY_STORAGE_INTERFACE 0x00010001 | | #define NCRYPT_KEY_STORAGE_INTERFACE 0x00010001 |
| #define NCRYPT_SCHANNEL_INTERFACE 0x00010002 | | #define NCRYPT_SCHANNEL_INTERFACE 0x00010002 |
| #define NCRYPT_SCHANNEL_SIGNATURE_INTERFACE 0x00010003 | | #define NCRYPT_SCHANNEL_SIGNATURE_INTERFACE 0x00010003 |
|
| | #if (NTDDI_VERSION >= NTDDI_WIN8) |
| | #define NCRYPT_KEY_PROTECTION_INTERFACE 0x00010004 |
| | #endif // (NTDDI_VERSION >= NTDDI_WIN8) |
| | |
| // | | // |
| // algorithm groups. | | // algorithm groups. |
| // | | // |
| | |
|
| #define NCRYPT_RSA_ALGORITHM_GROUP NCRYPT_RSA_ALGORITHM | | #define NCRYPT_RSA_ALGORITHM_GROUP NCRYPT_RSA_ALGORITHM |
| #define NCRYPT_DH_ALGORITHM_GROUP NCRYPT_DH_ALGORITHM | | #define NCRYPT_DH_ALGORITHM_GROUP NCRYPT_DH_ALGORITHM |
| #define NCRYPT_DSA_ALGORITHM_GROUP NCRYPT_DSA_ALGORITHM | | #define NCRYPT_DSA_ALGORITHM_GROUP NCRYPT_DSA_ALGORITHM |
| #define NCRYPT_ECDSA_ALGORITHM_GROUP L"ECDSA" | | #define NCRYPT_ECDSA_ALGORITHM_GROUP L"ECDSA" |
| #define NCRYPT_ECDH_ALGORITHM_GROUP L"ECDH" | | #define NCRYPT_ECDH_ALGORITHM_GROUP L"ECDH" |
| | |
| | #if (NTDDI_VERSION >= NTDDI_WIN8) |
| | #define NCRYPT_AES_ALGORITHM_GROUP NCRYPT_AES_ALGORITHM |
| | #define NCRYPT_RC2_ALGORITHM_GROUP NCRYPT_RC2_ALGORITHM |
| | #define NCRYPT_DES_ALGORITHM_GROUP L"DES" |
| | #define NCRYPT_KEY_DERIVATION_GROUP L"KEY_DERIVATION" |
| | #endif |
| | |
| // | | // |
| // NCrypt generic memory descriptors | | // NCrypt generic memory descriptors |
| // | | // |
| | |
|
| #define NCRYPTBUFFER_VERSION 0 | | #define NCRYPTBUFFER_VERSION 0 |
| | |
|
| #define NCRYPTBUFFER_EMPTY 0 | | #define NCRYPTBUFFER_EMPTY 0 |
| #define NCRYPTBUFFER_DATA 1 | | #define NCRYPTBUFFER_DATA 1 |
| #define NCRYPTBUFFER_SSL_CLIENT_RANDOM 20 | | #define NCRYPTBUFFER_PROTECTION_DESCRIPTOR_STRING 3 // The buffer contains a |
| #define NCRYPTBUFFER_SSL_SERVER_RANDOM 21 | | null-terminated Unicode string that contains the Protection Descriptor. |
| #define NCRYPTBUFFER_SSL_HIGHEST_VERSION 22 | | #define NCRYPTBUFFER_PROTECTION_FLAGS 4 // DWORD flags to be pas |
| #define NCRYPTBUFFER_SSL_CLEAR_KEY 23 | | sed to NCryptCreateProtectionDescriptor function. |
| #define NCRYPTBUFFER_SSL_KEY_ARG_DATA 24 | | |
| | |
|
| #define NCRYPTBUFFER_PKCS_OID 40 | | #define NCRYPTBUFFER_SSL_CLIENT_RANDOM 20 |
| #define NCRYPTBUFFER_PKCS_ALG_OID 41 | | #define NCRYPTBUFFER_SSL_SERVER_RANDOM 21 |
| #define NCRYPTBUFFER_PKCS_ALG_PARAM 42 | | #define NCRYPTBUFFER_SSL_HIGHEST_VERSION 22 |
| #define NCRYPTBUFFER_PKCS_ALG_ID 43 | | #define NCRYPTBUFFER_SSL_CLEAR_KEY 23 |
| #define NCRYPTBUFFER_PKCS_ATTRS 44 | | #define NCRYPTBUFFER_SSL_KEY_ARG_DATA 24 |
| #define NCRYPTBUFFER_PKCS_KEY_NAME 45 | | |
| #define NCRYPTBUFFER_PKCS_SECRET 46 | | |
| | |
|
| #define NCRYPTBUFFER_CERT_BLOB 47 | | #define NCRYPTBUFFER_PKCS_OID 40 |
| | #define NCRYPTBUFFER_PKCS_ALG_OID 41 |
| | #define NCRYPTBUFFER_PKCS_ALG_PARAM 42 |
| | #define NCRYPTBUFFER_PKCS_ALG_ID 43 |
| | #define NCRYPTBUFFER_PKCS_ATTRS 44 |
| | #define NCRYPTBUFFER_PKCS_KEY_NAME 45 |
| | #define NCRYPTBUFFER_PKCS_SECRET 46 |
| | |
| | #define NCRYPTBUFFER_CERT_BLOB 47 |
| | |
| // NCRYPT shares the same BCRYPT definitions | | // NCRYPT shares the same BCRYPT definitions |
| typedef BCryptBuffer NCryptBuffer; | | typedef BCryptBuffer NCryptBuffer; |
| typedef BCryptBuffer* PNCryptBuffer; | | typedef BCryptBuffer* PNCryptBuffer; |
| typedef BCryptBufferDesc NCryptBufferDesc; | | typedef BCryptBufferDesc NCryptBufferDesc; |
| typedef BCryptBufferDesc* PNCryptBufferDesc; | | typedef BCryptBufferDesc* PNCryptBufferDesc; |
| | |
| // | | // |
| // NCrypt handles | | // NCrypt handles |
| // | | // |
| | |
| typedef ULONG_PTR NCRYPT_HANDLE; | | typedef ULONG_PTR NCRYPT_HANDLE; |
| typedef ULONG_PTR NCRYPT_PROV_HANDLE; | | typedef ULONG_PTR NCRYPT_PROV_HANDLE; |
| typedef ULONG_PTR NCRYPT_KEY_HANDLE; | | typedef ULONG_PTR NCRYPT_KEY_HANDLE; |
| typedef ULONG_PTR NCRYPT_HASH_HANDLE; | | typedef ULONG_PTR NCRYPT_HASH_HANDLE; |
| typedef ULONG_PTR NCRYPT_SECRET_HANDLE; | | typedef ULONG_PTR NCRYPT_SECRET_HANDLE; |
| | |
|
| | #if (NTDDI_VERSION >= NTDDI_WIN8) |
| | |
| | typedef _Struct_size_bytes_(cbSize + cbIV + cbOtherInfo) |
| | struct _NCRYPT_CIPHER_PADDING_INFO |
| | { |
| | // size of this struct |
| | ULONG cbSize; |
| | |
| | // See NCRYPT_CIPHER_ flag values |
| | DWORD dwFlags; |
| | |
| | // [in, out, optional] |
| | // The address of a buffer that contains the initialization vector (IV) to u |
| | se during encryption. |
| | // The cbIV parameter contains the size of this buffer. This function will m |
| | odify the contents of this buffer. |
| | // If you need to reuse the IV later, make sure you make a copy of this buff |
| | er before calling this function. |
| | _Field_size_bytes_(cbIV) |
| | PUCHAR pbIV; |
| | ULONG cbIV; |
| | |
| | // [in, out, optional] |
| | // The address of a buffer that contains the algorithm specific info to use |
| | during encryption. |
| | // The cbOtherInfo parameter contains the size of this buffer. This function |
| | will modify the contents of this buffer. |
| | // If you need to reuse the buffer later, make sure you make a copy of this |
| | buffer before calling this function. |
| | // |
| | // For Microsoft providers, when an authenticated encryption mode is used, |
| | // this parameter must point to a serialized BCRYPT_AUTHENTICATED_CIPHER_MOD |
| | E_INFO structure. |
| | // |
| | // NOTE: All pointers inside a structure must be to a data allocated within |
| | pbOtherInfo buffer. |
| | // |
| | _Field_size_bytes_(cbOtherInfo) |
| | PUCHAR pbOtherInfo; |
| | ULONG cbOtherInfo; |
| | |
| | } NCRYPT_CIPHER_PADDING_INFO, *PNCRYPT_CIPHER_PADDING_INFO; |
| | |
| | // |
| | // The following flags are used with NCRYPT_CIPHER_PADDING_INFO |
| | // |
| | #define NCRYPT_CIPHER_NO_PADDING_FLAG 0x00000000 |
| | #define NCRYPT_CIPHER_BLOCK_PADDING_FLAG 0x00000001 |
| | #define NCRYPT_CIPHER_OTHER_PADDING_FLAG 0x00000002 |
| | |
| | #endif // (NTDDI_VERSION >= NTDDI_WIN8) |
| | |
| | #if (NTDDI_VERSION >= NTDDI_WINBLUE) |
| | |
| | #define NCRYPT_PLATFORM_ATTEST_MAGIC 0x44504150 // 'PAPD' |
| | |
| | typedef struct _NCRYPT_PLATFORM_ATTEST_PADDING_INFO { |
| | ULONG magic; // 'PAPD' |
| | ULONG pcrMask; |
| | } NCRYPT_PLATFORM_ATTEST_PADDING_INFO; |
| | |
| | #define NCRYPT_KEY_ATTEST_MAGIC 0x4450414b // 'KAPD' |
| | |
| | typedef struct _NCRYPT_KEY_ATTEST_PADDING_INFO { |
| | ULONG magic; // 'KAPD' |
| | PUCHAR pbKeyBlob; |
| | ULONG cbKeyBlob; |
| | PUCHAR pbKeyAuth; |
| | ULONG cbKeyAuth; |
| | } NCRYPT_KEY_ATTEST_PADDING_INFO; |
| | |
| | #endif // (NTDDI_VERSION >= NTDDI_WINBLUE) |
| | |
| // | | // |
| // NCrypt API Flags | | // NCrypt API Flags |
| // | | // |
| | |
|
| #define NCRYPT_NO_PADDING_FLAG BCRYPT_PAD_NONE | | #define NCRYPT_NO_PADDING_FLAG 0x00000001 // NCryptEncrypt/Dec |
| #define NCRYPT_PAD_PKCS1_FLAG BCRYPT_PAD_PKCS1 // NCryptEncrypt/Decrypt N | | rypt |
| CryptSignHash/VerifySignature | | #define NCRYPT_PAD_PKCS1_FLAG 0x00000002 // NCryptEncrypt/Dec |
| #define NCRYPT_PAD_OAEP_FLAG BCRYPT_PAD_OAEP // BCryptEncrypt/Decrypt | | rypt NCryptSignHash/VerifySignature |
| #define NCRYPT_PAD_PSS_FLAG BCRYPT_PAD_PSS // BCryptSignHash/VerifySi | | #define NCRYPT_PAD_OAEP_FLAG 0x00000004 // BCryptEncrypt/Dec |
| gnature | | rypt |
| | #define NCRYPT_PAD_PSS_FLAG 0x00000008 // BCryptSignHash/Ve |
| | rifySignature |
| | #if (NTDDI_VERSION >= NTDDI_WIN8) |
| | #define NCRYPT_PAD_CIPHER_FLAG 0x00000010 // NCryptEncrypt/Dec |
| | rypt |
| | #endif |
| | |
| | #define NCRYPT_REGISTER_NOTIFY_FLAG 0x00000001 // NCryptNotifyChang |
| | eKey |
| | #define NCRYPT_UNREGISTER_NOTIFY_FLAG 0x00000002 // NCryptNotifyChang |
| | eKey |
| #define NCRYPT_NO_KEY_VALIDATION BCRYPT_NO_KEY_VALIDATION | | #define NCRYPT_NO_KEY_VALIDATION BCRYPT_NO_KEY_VALIDATION |
| #define NCRYPT_MACHINE_KEY_FLAG 0x00000020 // same as CAPI CRYP
T_MACHINE_KEYSET | | #define NCRYPT_MACHINE_KEY_FLAG 0x00000020 // same as CAPI CRYP
T_MACHINE_KEYSET |
| #define NCRYPT_SILENT_FLAG 0x00000040 // same as CAPI CRYP
T_SILENT | | #define NCRYPT_SILENT_FLAG 0x00000040 // same as CAPI CRYP
T_SILENT |
| #define NCRYPT_OVERWRITE_KEY_FLAG 0x00000080 | | #define NCRYPT_OVERWRITE_KEY_FLAG 0x00000080 |
| #define NCRYPT_WRITE_KEY_TO_LEGACY_STORE_FLAG 0x00000200 | | #define NCRYPT_WRITE_KEY_TO_LEGACY_STORE_FLAG 0x00000200 |
| #define NCRYPT_DO_NOT_FINALIZE_FLAG 0x00000400 | | #define NCRYPT_DO_NOT_FINALIZE_FLAG 0x00000400 |
|
| | #define NCRYPT_EXPORT_LEGACY_FLAG 0x00000800 |
| | #if (NTDDI_VERSION >= NTDDI_WINBLUE) |
| | #define NCRYPT_IGNORE_DEVICE_STATE_FLAG 0x00001000 // NCryptOpenStorage |
| | Provider |
| | #endif |
| #define NCRYPT_PERSIST_ONLY_FLAG 0x40000000 | | #define NCRYPT_PERSIST_ONLY_FLAG 0x40000000 |
| #define NCRYPT_PERSIST_FLAG 0x80000000 | | #define NCRYPT_PERSIST_FLAG 0x80000000 |
|
| #define NCRYPT_REGISTER_NOTIFY_FLAG 0x00000001 | | |
| #define NCRYPT_UNREGISTER_NOTIFY_FLAG 0x00000002 | | #pragma region Desktop Family |
| | #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) |
| | |
| // | | // |
| // Functions used to manage persisted keys. | | // Functions used to manage persisted keys. |
| // | | // |
|
| __checkReturn | | |
| | // NCryptOpenStorageProvider flags |
| | #define NCRYPT_SILENT_FLAG 0x00000040 // same as CAPI CRYP |
| | T_SILENT |
| | #if (NTDDI_VERSION >= NTDDI_WINBLUE) |
| | #define NCRYPT_IGNORE_DEVICE_STATE_FLAG 0x00001000 // NCryptOpenStorage |
| | Provider |
| | #endif |
| | |
| | _Check_return_ |
| SECURITY_STATUS | | SECURITY_STATUS |
| WINAPI | | WINAPI |
| NCryptOpenStorageProvider( | | NCryptOpenStorageProvider( |
|
| __out NCRYPT_PROV_HANDLE *phProvider, | | _Out_ NCRYPT_PROV_HANDLE *phProvider, |
| __in_opt LPCWSTR pszProviderName, | | _In_opt_ LPCWSTR pszProviderName, |
| __in DWORD dwFlags); | | _In_ DWORD dwFlags); |
| | |
| // AlgOperations flags for use with NCryptEnumAlgorithms() | | // AlgOperations flags for use with NCryptEnumAlgorithms() |
| #define NCRYPT_CIPHER_OPERATION BCRYPT_CIPHER_OPERATION | | #define NCRYPT_CIPHER_OPERATION BCRYPT_CIPHER_OPERATION |
| #define NCRYPT_HASH_OPERATION BCRYPT_HASH_OPERATION | | #define NCRYPT_HASH_OPERATION BCRYPT_HASH_OPERATION |
| #define NCRYPT_ASYMMETRIC_ENCRYPTION_OPERATION BCRYPT_ASYMMETRIC_ENCRYPTION_OPE
RATION | | #define NCRYPT_ASYMMETRIC_ENCRYPTION_OPERATION BCRYPT_ASYMMETRIC_ENCRYPTION_OPE
RATION |
| #define NCRYPT_SECRET_AGREEMENT_OPERATION BCRYPT_SECRET_AGREEMENT_OPERATIO
N | | #define NCRYPT_SECRET_AGREEMENT_OPERATION BCRYPT_SECRET_AGREEMENT_OPERATIO
N |
| #define NCRYPT_SIGNATURE_OPERATION BCRYPT_SIGNATURE_OPERATION | | #define NCRYPT_SIGNATURE_OPERATION BCRYPT_SIGNATURE_OPERATION |
| #define NCRYPT_RNG_OPERATION BCRYPT_RNG_OPERATION | | #define NCRYPT_RNG_OPERATION BCRYPT_RNG_OPERATION |
|
| | | #if (NTDDI_VERSION >= NTDDI_WIN8) |
| | #define NCRYPT_KEY_DERIVATION_OPERATION BCRYPT_KEY_DERIVATION_OPERATION |
| | #endif // (NTDDI_VERSION >= NTDDI_WIN8) |
| // USE EXTREME CAUTION: editing comments that contain "certenrolls_*" tokens | | // USE EXTREME CAUTION: editing comments that contain "certenrolls_*" tokens |
| // could break building CertEnroll idl files: | | // could break building CertEnroll idl files: |
| // certenrolls_begin -- NCryptAlgorithmName | | // certenrolls_begin -- NCryptAlgorithmName |
| typedef struct _NCryptAlgorithmName | | typedef struct _NCryptAlgorithmName |
| { | | { |
| LPWSTR pszName; | | LPWSTR pszName; |
| DWORD dwClass; // the CNG interface that supports this algorith
m | | DWORD dwClass; // the CNG interface that supports this algorith
m |
| DWORD dwAlgOperations; // the types of operations supported by this alg
orithm | | DWORD dwAlgOperations; // the types of operations supported by this alg
orithm |
| DWORD dwFlags; | | DWORD dwFlags; |
| } NCryptAlgorithmName; | | } NCryptAlgorithmName; |
| // certenrolls_end | | // certenrolls_end |
| | |
|
| __checkReturn | | _Check_return_ |
| SECURITY_STATUS | | SECURITY_STATUS |
| WINAPI | | WINAPI |
| NCryptEnumAlgorithms( | | NCryptEnumAlgorithms( |
|
| __in NCRYPT_PROV_HANDLE hProvider, | | _In_ NCRYPT_PROV_HANDLE hProvider, |
| __in DWORD dwAlgOperations, | | _In_ DWORD dwAlgOperations, |
| __out DWORD * pdwAlgCount, | | _Out_ DWORD * pdwAlgCount, |
| __deref_out_ecount(*pdwAlgCount) NCryptAlgorithmName **ppAlgList, | | _Outptr_result_buffer_(*pdwAlgCount) NCryptAlgorithmName **ppAlgList, |
| __in DWORD dwFlags); | | _In_ DWORD dwFlags); |
| | |
|
| __checkReturn | | _Check_return_ |
| SECURITY_STATUS | | SECURITY_STATUS |
| WINAPI | | WINAPI |
| NCryptIsAlgSupported( | | NCryptIsAlgSupported( |
|
| __in NCRYPT_PROV_HANDLE hProvider, | | _In_ NCRYPT_PROV_HANDLE hProvider, |
| __in LPCWSTR pszAlgId, | | _In_ LPCWSTR pszAlgId, |
| __in DWORD dwFlags); | | _In_ DWORD dwFlags); |
| | |
| // NCryptEnumKeys flags | | // NCryptEnumKeys flags |
| #define NCRYPT_MACHINE_KEY_FLAG 0x00000020 | | #define NCRYPT_MACHINE_KEY_FLAG 0x00000020 |
| | |
| typedef struct NCryptKeyName | | typedef struct NCryptKeyName |
| { | | { |
| LPWSTR pszName; | | LPWSTR pszName; |
| LPWSTR pszAlgid; | | LPWSTR pszAlgid; |
| DWORD dwLegacyKeySpec; | | DWORD dwLegacyKeySpec; |
| DWORD dwFlags; | | DWORD dwFlags; |
| } NCryptKeyName; | | } NCryptKeyName; |
| | |
|
| __checkReturn | | _Check_return_ |
| SECURITY_STATUS | | SECURITY_STATUS |
| WINAPI | | WINAPI |
| NCryptEnumKeys( | | NCryptEnumKeys( |
|
| __in NCRYPT_PROV_HANDLE hProvider, | | _In_ NCRYPT_PROV_HANDLE hProvider, |
| __in_opt LPCWSTR pszScope, | | _In_opt_ LPCWSTR pszScope, |
| __deref_out NCryptKeyName **ppKeyName, | | _Outptr_ NCryptKeyName **ppKeyName, |
| __inout PVOID * ppEnumState, | | _Inout_ PVOID * ppEnumState, |
| __in DWORD dwFlags); | | _In_ DWORD dwFlags); |
| | |
| typedef struct NCryptProviderName | | typedef struct NCryptProviderName |
| { | | { |
| LPWSTR pszName; | | LPWSTR pszName; |
| LPWSTR pszComment; | | LPWSTR pszComment; |
| } NCryptProviderName; | | } NCryptProviderName; |
| | |
|
| __checkReturn | | _Check_return_ |
| SECURITY_STATUS | | SECURITY_STATUS |
| WINAPI | | WINAPI |
| NCryptEnumStorageProviders( | | NCryptEnumStorageProviders( |
|
| __out DWORD * pdwProviderCount, | | _Out_ DWORD * pdwProviderCount, |
| __deref_out_ecount(*pdwProviderCount) NCryptProviderName **ppProviderList, | | _Outptr_result_buffer_(*pdwProviderCount) NCryptProviderName **ppProviderLis |
| __in DWORD dwFlags); | | t, |
| | _In_ DWORD dwFlags); |
| | |
| SECURITY_STATUS | | SECURITY_STATUS |
| WINAPI | | WINAPI |
| NCryptFreeBuffer( | | NCryptFreeBuffer( |
|
| __deref PVOID pvInput); | | _Pre_notnull_ PVOID pvInput); |
| | |
| // NCryptOpenKey flags | | // NCryptOpenKey flags |
| #define NCRYPT_MACHINE_KEY_FLAG 0x00000020 | | #define NCRYPT_MACHINE_KEY_FLAG 0x00000020 |
| #define NCRYPT_SILENT_FLAG 0x00000040 | | #define NCRYPT_SILENT_FLAG 0x00000040 |
| | |
|
| __checkReturn | | _Check_return_ |
| SECURITY_STATUS | | SECURITY_STATUS |
| WINAPI | | WINAPI |
| NCryptOpenKey( | | NCryptOpenKey( |
|
| __inout NCRYPT_PROV_HANDLE hProvider, | | _In_ NCRYPT_PROV_HANDLE hProvider, |
| __out NCRYPT_KEY_HANDLE *phKey, | | _Out_ NCRYPT_KEY_HANDLE *phKey, |
| __in LPCWSTR pszKeyName, | | _In_ LPCWSTR pszKeyName, |
| __in_opt DWORD dwLegacyKeySpec, | | _In_opt_ DWORD dwLegacyKeySpec, |
| __in DWORD dwFlags); | | _In_ DWORD dwFlags); |
| | |
| // NCryptCreatePersistedKey flags | | // NCryptCreatePersistedKey flags |
| #define NCRYPT_MACHINE_KEY_FLAG 0x00000020 | | #define NCRYPT_MACHINE_KEY_FLAG 0x00000020 |
| #define NCRYPT_OVERWRITE_KEY_FLAG 0x00000080 | | #define NCRYPT_OVERWRITE_KEY_FLAG 0x00000080 |
| | |
|
| __checkReturn | | _Check_return_ |
| SECURITY_STATUS | | SECURITY_STATUS |
| WINAPI | | WINAPI |
| NCryptCreatePersistedKey( | | NCryptCreatePersistedKey( |
|
| __in NCRYPT_PROV_HANDLE hProvider, | | _In_ NCRYPT_PROV_HANDLE hProvider, |
| __out NCRYPT_KEY_HANDLE *phKey, | | _Out_ NCRYPT_KEY_HANDLE *phKey, |
| __in LPCWSTR pszAlgId, | | _In_ LPCWSTR pszAlgId, |
| __in_opt LPCWSTR pszKeyName, | | _In_opt_ LPCWSTR pszKeyName, |
| __in DWORD dwLegacyKeySpec, | | _In_ DWORD dwLegacyKeySpec, |
| __in DWORD dwFlags); | | _In_ DWORD dwFlags); |
| | |
| // Standard property names. | | // Standard property names. |
| #define NCRYPT_NAME_PROPERTY L"Name" | | #define NCRYPT_NAME_PROPERTY L"Name" |
| #define NCRYPT_UNIQUE_NAME_PROPERTY L"Unique Name" | | #define NCRYPT_UNIQUE_NAME_PROPERTY L"Unique Name" |
| #define NCRYPT_ALGORITHM_PROPERTY L"Algorithm Name" | | #define NCRYPT_ALGORITHM_PROPERTY L"Algorithm Name" |
| #define NCRYPT_LENGTH_PROPERTY L"Length" | | #define NCRYPT_LENGTH_PROPERTY L"Length" |
| #define NCRYPT_LENGTHS_PROPERTY L"Lengths" | | #define NCRYPT_LENGTHS_PROPERTY L"Lengths" |
| #define NCRYPT_BLOCK_LENGTH_PROPERTY L"Block Length" | | #define NCRYPT_BLOCK_LENGTH_PROPERTY L"Block Length" |
|
| | #if (NTDDI_VERSION >= NTDDI_WIN8) |
| | #define NCRYPT_CHAINING_MODE_PROPERTY L"Chaining Mode" |
| | #define NCRYPT_AUTH_TAG_LENGTH L"AuthTagLength" |
| | #endif // (NTDDI_VERSION >= NTDDI_WIN8) |
| #define NCRYPT_UI_POLICY_PROPERTY L"UI Policy" | | #define NCRYPT_UI_POLICY_PROPERTY L"UI Policy" |
| #define NCRYPT_EXPORT_POLICY_PROPERTY L"Export Policy" | | #define NCRYPT_EXPORT_POLICY_PROPERTY L"Export Policy" |
| #define NCRYPT_WINDOW_HANDLE_PROPERTY L"HWND Handle" | | #define NCRYPT_WINDOW_HANDLE_PROPERTY L"HWND Handle" |
| #define NCRYPT_USE_CONTEXT_PROPERTY L"Use Context" | | #define NCRYPT_USE_CONTEXT_PROPERTY L"Use Context" |
| #define NCRYPT_IMPL_TYPE_PROPERTY L"Impl Type" | | #define NCRYPT_IMPL_TYPE_PROPERTY L"Impl Type" |
| #define NCRYPT_KEY_USAGE_PROPERTY L"Key Usage" | | #define NCRYPT_KEY_USAGE_PROPERTY L"Key Usage" |
| #define NCRYPT_KEY_TYPE_PROPERTY L"Key Type" | | #define NCRYPT_KEY_TYPE_PROPERTY L"Key Type" |
| #define NCRYPT_VERSION_PROPERTY L"Version" | | #define NCRYPT_VERSION_PROPERTY L"Version" |
| #define NCRYPT_SECURITY_DESCR_SUPPORT_PROPERTY L"Security Descr Support" | | #define NCRYPT_SECURITY_DESCR_SUPPORT_PROPERTY L"Security Descr Support" |
| #define NCRYPT_SECURITY_DESCR_PROPERTY L"Security Descr" | | #define NCRYPT_SECURITY_DESCR_PROPERTY L"Security Descr" |
| | |
| skipping to change at line 298 | | skipping to change at line 454 |
| #define NCRYPT_READER_PROPERTY L"SmartCardReader" | | #define NCRYPT_READER_PROPERTY L"SmartCardReader" |
| #define NCRYPT_SMARTCARD_GUID_PROPERTY L"SmartCardGuid" | | #define NCRYPT_SMARTCARD_GUID_PROPERTY L"SmartCardGuid" |
| #define NCRYPT_CERTIFICATE_PROPERTY L"SmartCardKeyCertificate" | | #define NCRYPT_CERTIFICATE_PROPERTY L"SmartCardKeyCertificate" |
| #define NCRYPT_PIN_PROMPT_PROPERTY L"SmartCardPinPrompt" | | #define NCRYPT_PIN_PROMPT_PROPERTY L"SmartCardPinPrompt" |
| #define NCRYPT_USER_CERTSTORE_PROPERTY L"SmartCardUserCertStore" | | #define NCRYPT_USER_CERTSTORE_PROPERTY L"SmartCardUserCertStore" |
| #define NCRYPT_ROOT_CERTSTORE_PROPERTY L"SmartcardRootCertStore" | | #define NCRYPT_ROOT_CERTSTORE_PROPERTY L"SmartcardRootCertStore" |
| #define NCRYPT_SECURE_PIN_PROPERTY L"SmartCardSecurePin" | | #define NCRYPT_SECURE_PIN_PROPERTY L"SmartCardSecurePin" |
| #define NCRYPT_ASSOCIATED_ECDH_KEY L"SmartCardAssociatedECDHKey" | | #define NCRYPT_ASSOCIATED_ECDH_KEY L"SmartCardAssociatedECDHKey" |
| #define NCRYPT_SCARD_PIN_ID L"SmartCardPinId" | | #define NCRYPT_SCARD_PIN_ID L"SmartCardPinId" |
| #define NCRYPT_SCARD_PIN_INFO L"SmartCardPinInfo" | | #define NCRYPT_SCARD_PIN_INFO L"SmartCardPinInfo" |
|
| | #if (NTDDI_VERSION >= NTDDI_WIN8) |
| | #define NCRYPT_READER_ICON_PROPERTY L"SmartCardReaderIcon" |
| | #define NCRYPT_KDF_SECRET_VALUE L"KDFKeySecret" |
| | // |
| | // Additional property strings specific for the Platform Crypto Provider |
| | // |
| | #define NCRYPT_PCP_PLATFORM_TYPE_PROPERTY L"PCP_PLATFORM_TYPE" |
| | #define NCRYPT_PCP_PROVIDER_VERSION_PROPERTY L"PCP_PROVIDER_VERSIO |
| | N" |
| | #define NCRYPT_PCP_EKPUB_PROPERTY L"PCP_EKPUB" |
| | #define NCRYPT_PCP_EKCERT_PROPERTY L"PCP_EKCERT" |
| | #define NCRYPT_PCP_EKNVCERT_PROPERTY L"PCP_EKNVCERT" |
| | #define NCRYPT_PCP_SRKPUB_PROPERTY L"PCP_SRKPUB" |
| | #define NCRYPT_PCP_PCRTABLE_PROPERTY L"PCP_PCRTABLE" |
| | #define NCRYPT_PCP_CHANGEPASSWORD_PROPERTY L"PCP_CHANGEPASSWORD" |
| | #define NCRYPT_PCP_PASSWORD_REQUIRED_PROPERTY L"PCP_PASSWORD_REQUIR |
| | ED" |
| | #define NCRYPT_PCP_USAGEAUTH_PROPERTY L"PCP_USAGEAUTH" |
| | #define NCRYPT_PCP_MIGRATIONPASSWORD_PROPERTY L"PCP_MIGRATIONPASSWO |
| | RD" |
| | #define NCRYPT_PCP_EXPORT_ALLOWED_PROPERTY L"PCP_EXPORT_ALLOWED" |
| | #define NCRYPT_PCP_STORAGEPARENT_PROPERTY L"PCP_STORAGEPARENT" |
| | #define NCRYPT_PCP_PROVIDERHANDLE_PROPERTY L"PCP_PROVIDERMHANDLE |
| | " |
| | #define NCRYPT_PCP_PLATFORMHANDLE_PROPERTY L"PCP_PLATFORMHANDLE" |
| | #define NCRYPT_PCP_PLATFORM_BINDING_PCRMASK_PROPERTY L"PCP_PLATFORM_BINDIN |
| | G_PCRMASK" |
| | #define NCRYPT_PCP_PLATFORM_BINDING_PCRDIGESTLIST_PROPERTY L"PCP_PLATFORM_BINDIN |
| | G_PCRDIGESTLIST" |
| | #define NCRYPT_PCP_PLATFORM_BINDING_PCRDIGEST_PROPERTY L"PCP_PLATFORM_BINDIN |
| | G_PCRDIGEST" |
| | #define NCRYPT_PCP_KEY_USAGE_POLICY_PROPERTY L"PCP_KEY_USAGE_POLIC |
| | Y" |
| | #define NCRYPT_PCP_TPM12_IDBINDING_PROPERTY L"PCP_TPM12_IDBINDING |
| | " |
| | #define NCRYPT_PCP_TPM12_IDBINDING_DYNAMIC_PROPERTY L"PCP_TPM12_IDBINDING |
| | _DYNAMIC" |
| | #define NCRYPT_PCP_TPM12_IDACTIVATION_PROPERTY L"PCP_TPM12_IDACTIVAT |
| | ION" |
| | #define NCRYPT_PCP_KEYATTESTATION_PROPERTY L"PCP_TPM12_KEYATTEST |
| | ATION" |
| | #define NCRYPT_PCP_ALTERNATE_KEY_STORAGE_LOCATION_PROPERTY L"PCP_ALTERNATE_KEY_S |
| | TORAGE_LOCATION" |
| | // |
| | // BCRYPT_PCP_KEY_USAGE_POLICY values |
| | // |
| | #define NCRYPT_TPM12_PROVIDER (0x00010000) |
| | #define NCRYPT_PCP_SIGNATURE_KEY (0x00000001) |
| | #define NCRYPT_PCP_ENCRYPTION_KEY (0x00000002) |
| | #define NCRYPT_PCP_GENERIC_KEY (NCRYPT_PCP_SIGNATURE_KEY | NCRYP |
| | T_PCP_ENCRYPTION_KEY) |
| | #define NCRYPT_PCP_STORAGE_KEY (0x00000004) |
| | #define NCRYPT_PCP_IDENTITY_KEY (0x00000008) |
| | #endif // (NTDDI_VERSION >= NTDDI_WIN8) |
| | |
| | #if (NTDDI_VERSION >= NTDDI_WIN8) |
| | // |
| | // Used to set IV for block ciphers, before calling NCryptEncrypt/NCryptDecrypt |
| | // |
| | #define NCRYPT_INITIALIZATION_VECTOR BCRYPT_INITIALIZATION_VECTOR |
| | #endif // (NTDDI_VERSION >= NTDDI_WIN8) |
| | |
| // Maximum length of property name (in characters) | | // Maximum length of property name (in characters) |
| #define NCRYPT_MAX_PROPERTY_NAME 64 | | #define NCRYPT_MAX_PROPERTY_NAME 64 |
| | |
| // Maximum length of property data (in bytes) | | // Maximum length of property data (in bytes) |
| #define NCRYPT_MAX_PROPERTY_DATA 0x100000 | | #define NCRYPT_MAX_PROPERTY_DATA 0x100000 |
| | |
| // NCRYPT_EXPORT_POLICY_PROPERTY property flags. | | // NCRYPT_EXPORT_POLICY_PROPERTY property flags. |
| #define NCRYPT_ALLOW_EXPORT_FLAG 0x00000001 | | #define NCRYPT_ALLOW_EXPORT_FLAG 0x00000001 |
| #define NCRYPT_ALLOW_PLAINTEXT_EXPORT_FLAG 0x00000002 | | #define NCRYPT_ALLOW_PLAINTEXT_EXPORT_FLAG 0x00000002 |
| | |
| skipping to change at line 326 | | skipping to change at line 529 |
| | |
| // NCRYPT_KEY_USAGE_PROPERTY property flags. | | // NCRYPT_KEY_USAGE_PROPERTY property flags. |
| #define NCRYPT_ALLOW_DECRYPT_FLAG 0x00000001 | | #define NCRYPT_ALLOW_DECRYPT_FLAG 0x00000001 |
| #define NCRYPT_ALLOW_SIGNING_FLAG 0x00000002 | | #define NCRYPT_ALLOW_SIGNING_FLAG 0x00000002 |
| #define NCRYPT_ALLOW_KEY_AGREEMENT_FLAG 0x00000004 | | #define NCRYPT_ALLOW_KEY_AGREEMENT_FLAG 0x00000004 |
| #define NCRYPT_ALLOW_ALL_USAGES 0x00ffffff | | #define NCRYPT_ALLOW_ALL_USAGES 0x00ffffff |
| | |
| // NCRYPT_UI_POLICY_PROPERTY property flags and structure | | // NCRYPT_UI_POLICY_PROPERTY property flags and structure |
| #define NCRYPT_UI_PROTECT_KEY_FLAG 0x00000001 | | #define NCRYPT_UI_PROTECT_KEY_FLAG 0x00000001 |
| #define NCRYPT_UI_FORCE_HIGH_PROTECTION_FLAG 0x00000002 | | #define NCRYPT_UI_FORCE_HIGH_PROTECTION_FLAG 0x00000002 |
|
| | | #if (NTDDI_VERSION >= NTDDI_WINBLUE) |
| typedef struct __NCRYPT_UI_POLICY_BLOB | | #define NCRYPT_UI_FINGERPRINT_PROTECTION_FLAG 0x00000004 |
| { | | #define NCRYPT_UI_APPCONTAINER_ACCESS_MEDIUM_FLAG 0x00000008 |
| DWORD dwVersion; | | #endif |
| DWORD dwFlags; | | |
| DWORD cbCreationTitle; | | |
| DWORD cbFriendlyName; | | |
| DWORD cbDescription; | | |
| // creation title string | | |
| // friendly name string | | |
| // description string | | |
| } NCRYPT_UI_POLICY_BLOB; | | |
| | |
| typedef struct __NCRYPT_UI_POLICY | | typedef struct __NCRYPT_UI_POLICY |
| { | | { |
| DWORD dwVersion; | | DWORD dwVersion; |
| DWORD dwFlags; | | DWORD dwFlags; |
| LPCWSTR pszCreationTitle; | | LPCWSTR pszCreationTitle; |
| LPCWSTR pszFriendlyName; | | LPCWSTR pszFriendlyName; |
| LPCWSTR pszDescription; | | LPCWSTR pszDescription; |
| } NCRYPT_UI_POLICY; | | } NCRYPT_UI_POLICY; |
| | |
| | |
| skipping to change at line 360 | | skipping to change at line 555 |
| { | | { |
| DWORD dwMinLength; | | DWORD dwMinLength; |
| DWORD dwMaxLength; | | DWORD dwMaxLength; |
| DWORD dwIncrement; | | DWORD dwIncrement; |
| DWORD dwDefaultLength; | | DWORD dwDefaultLength; |
| } NCRYPT_SUPPORTED_LENGTHS; | | } NCRYPT_SUPPORTED_LENGTHS; |
| | |
| // NCryptGetProperty flags | | // NCryptGetProperty flags |
| #define NCRYPT_PERSIST_ONLY_FLAG 0x40000000 | | #define NCRYPT_PERSIST_ONLY_FLAG 0x40000000 |
| | |
|
| __checkReturn | | _Check_return_ |
| | _Success_( return == 0 ) |
| SECURITY_STATUS | | SECURITY_STATUS |
| WINAPI | | WINAPI |
| NCryptGetProperty( | | NCryptGetProperty( |
|
| __in NCRYPT_HANDLE hObject, | | _In_ NCRYPT_HANDLE hObject, |
| __in LPCWSTR pszProperty, | | _In_ LPCWSTR pszProperty, |
| __out_bcount_part_opt(cbOutput, *pcbResult) PBYTE pbOutput, | | _Out_writes_bytes_to_opt_(cbOutput, *pcbResult) PBYTE pbOutput, |
| __in DWORD cbOutput, | | _In_ DWORD cbOutput, |
| __out DWORD * pcbResult, | | _Out_ DWORD * pcbResult, |
| __in DWORD dwFlags); | | _In_ DWORD dwFlags); |
| | |
| // NCryptSetProperty flags | | // NCryptSetProperty flags |
| #define NCRYPT_PERSIST_FLAG 0x80000000 | | #define NCRYPT_PERSIST_FLAG 0x80000000 |
| #define NCRYPT_PERSIST_ONLY_FLAG 0x40000000 | | #define NCRYPT_PERSIST_ONLY_FLAG 0x40000000 |
| | |
|
| __checkReturn | | _Check_return_ |
| SECURITY_STATUS | | SECURITY_STATUS |
| WINAPI | | WINAPI |
| NCryptSetProperty( | | NCryptSetProperty( |
|
| __in NCRYPT_HANDLE hObject, | | _In_ NCRYPT_HANDLE hObject, |
| __in LPCWSTR pszProperty, | | _In_ LPCWSTR pszProperty, |
| __in_bcount(cbInput) PBYTE pbInput, | | _In_reads_bytes_(cbInput) PBYTE pbInput, |
| __in DWORD cbInput, | | _In_ DWORD cbInput, |
| __in DWORD dwFlags); | | _In_ DWORD dwFlags); |
| | |
|
| | // NCryptFinalizeKey flags |
| #define NCRYPT_WRITE_KEY_TO_LEGACY_STORE_FLAG 0x00000200 | | #define NCRYPT_WRITE_KEY_TO_LEGACY_STORE_FLAG 0x00000200 |
| | |
|
| __checkReturn | | _Check_return_ |
| SECURITY_STATUS | | SECURITY_STATUS |
| WINAPI | | WINAPI |
| NCryptFinalizeKey( | | NCryptFinalizeKey( |
|
| __in NCRYPT_KEY_HANDLE hKey, | | _In_ NCRYPT_KEY_HANDLE hKey, |
| __in DWORD dwFlags); | | _In_ DWORD dwFlags); |
| | |
|
| __checkReturn | | _Check_return_ |
| SECURITY_STATUS | | SECURITY_STATUS |
| WINAPI | | WINAPI |
| NCryptEncrypt( | | NCryptEncrypt( |
|
| __in NCRYPT_KEY_HANDLE hKey, | | _In_ NCRYPT_KEY_HANDLE hKey, |
| __in_bcount_opt(cbInput) PBYTE pbInput, | | _In_reads_bytes_opt_(cbInput) PBYTE pbInput, |
| __in DWORD cbInput, | | _In_ DWORD cbInput, |
| __in_opt VOID *pPaddingInfo, | | _In_opt_ VOID *pPaddingInfo, |
| __out_bcount_part_opt(cbOutput, *pcbResult) PBYTE pbOutput, | | _Out_writes_bytes_to_opt_(cbOutput, *pcbResult) PBYTE pbOutput, |
| __in DWORD cbOutput, | | _In_ DWORD cbOutput, |
| __out DWORD * pcbResult, | | _Out_ DWORD * pcbResult, |
| __in DWORD dwFlags); | | _In_ DWORD dwFlags); |
| | |
|
| __checkReturn | | _Check_return_ |
| SECURITY_STATUS | | SECURITY_STATUS |
| WINAPI | | WINAPI |
| NCryptDecrypt( | | NCryptDecrypt( |
|
| __in NCRYPT_KEY_HANDLE hKey, | | _In_ NCRYPT_KEY_HANDLE hKey, |
| __in_bcount_opt(cbInput) PBYTE pbInput, | | _In_reads_bytes_opt_(cbInput) PBYTE pbInput, |
| __in DWORD cbInput, | | _In_ DWORD cbInput, |
| __in_opt VOID *pPaddingInfo, | | _In_opt_ VOID *pPaddingInfo, |
| __out_bcount_part_opt(cbOutput, *pcbResult) PBYTE pbOutput, | | _Out_writes_bytes_to_opt_(cbOutput, *pcbResult) PBYTE pbOutput, |
| __in DWORD cbOutput, | | _In_ DWORD cbOutput, |
| __out DWORD * pcbResult, | | _Out_ DWORD * pcbResult, |
| __in DWORD dwFlags); | | _In_ DWORD dwFlags); |
| | |
| | #if (NTDDI_VERSION >= NTDDI_WIN8) |
| | |
| | typedef struct _NCRYPT_KEY_BLOB_HEADER |
| | { |
| | ULONG cbSize; // size of this structure |
| | ULONG dwMagic; |
| | ULONG cbAlgName; // size of the algorithm, in bytes, including te |
| | rminating 0 |
| | ULONG cbKeyData; |
| | } NCRYPT_KEY_BLOB_HEADER, *PNCRYPT_KEY_BLOB_HEADER; |
| | |
| | #define NCRYPT_CIPHER_KEY_BLOB_MAGIC 0x52485043 // CPHR |
| | #define NCRYPT_PROTECTED_KEY_BLOB_MAGIC 0x4B545250 // PRTK |
| | |
| | #define NCRYPT_CIPHER_KEY_BLOB L"CipherKeyBlob" |
| | #define NCRYPT_PROTECTED_KEY_BLOB L"ProtectedKeyBlob" |
| | |
| | #endif // (NTDDI_VERSION >= NTDDI_WIN8) |
| | |
| #define NCRYPT_PKCS7_ENVELOPE_BLOB L"PKCS7_ENVELOPE" | | #define NCRYPT_PKCS7_ENVELOPE_BLOB L"PKCS7_ENVELOPE" |
| #define NCRYPT_PKCS8_PRIVATE_KEY_BLOB L"PKCS8_PRIVATEKEY" | | #define NCRYPT_PKCS8_PRIVATE_KEY_BLOB L"PKCS8_PRIVATEKEY" |
| #define NCRYPT_OPAQUETRANSPORT_BLOB L"OpaqueTransport" | | #define NCRYPT_OPAQUETRANSPORT_BLOB L"OpaqueTransport" |
| | |
|
| | // NCryptImportKey flags |
| #define NCRYPT_MACHINE_KEY_FLAG 0x00000020 | | #define NCRYPT_MACHINE_KEY_FLAG 0x00000020 |
| #define NCRYPT_DO_NOT_FINALIZE_FLAG 0x00000400 | | #define NCRYPT_DO_NOT_FINALIZE_FLAG 0x00000400 |
| #define NCRYPT_EXPORT_LEGACY_FLAG 0x00000800 | | #define NCRYPT_EXPORT_LEGACY_FLAG 0x00000800 |
| | |
|
| __checkReturn | | _Check_return_ |
| SECURITY_STATUS | | SECURITY_STATUS |
| WINAPI | | WINAPI |
| NCryptImportKey( | | NCryptImportKey( |
|
| __in NCRYPT_PROV_HANDLE hProvider, | | _In_ NCRYPT_PROV_HANDLE hProvider, |
| __in_opt NCRYPT_KEY_HANDLE hImportKey, | | _In_opt_ NCRYPT_KEY_HANDLE hImportKey, |
| __in LPCWSTR pszBlobType, | | _In_ LPCWSTR pszBlobType, |
| __in_opt NCryptBufferDesc *pParameterList, | | _In_opt_ NCryptBufferDesc *pParameterList, |
| __out NCRYPT_KEY_HANDLE *phKey, | | _Out_ NCRYPT_KEY_HANDLE *phKey, |
| __in_bcount(cbData) PBYTE pbData, | | _In_reads_bytes_(cbData) PBYTE pbData, |
| __in DWORD cbData, | | _In_ DWORD cbData, |
| __in DWORD dwFlags); | | _In_ DWORD dwFlags); |
| | |
|
| __checkReturn | | _Check_return_ |
| SECURITY_STATUS | | SECURITY_STATUS |
| WINAPI | | WINAPI |
| NCryptExportKey( | | NCryptExportKey( |
|
| __in NCRYPT_KEY_HANDLE hKey, | | _In_ NCRYPT_KEY_HANDLE hKey, |
| __in_opt NCRYPT_KEY_HANDLE hExportKey, | | _In_opt_ NCRYPT_KEY_HANDLE hExportKey, |
| __in LPCWSTR pszBlobType, | | _In_ LPCWSTR pszBlobType, |
| __in_opt NCryptBufferDesc *pParameterList, | | _In_opt_ NCryptBufferDesc *pParameterList, |
| __out_bcount_part_opt(cbOutput, *pcbResult) PBYTE pbOutput, | | _Out_writes_bytes_to_opt_(cbOutput, *pcbResult) PBYTE pbOutput, |
| __in DWORD cbOutput, | | _In_ DWORD cbOutput, |
| __out DWORD * pcbResult, | | _Out_ DWORD * pcbResult, |
| __in DWORD dwFlags); | | _In_ DWORD dwFlags); |
| | |
|
| __checkReturn | | _Check_return_ |
| SECURITY_STATUS | | SECURITY_STATUS |
| WINAPI | | WINAPI |
| NCryptSignHash( | | NCryptSignHash( |
|
| __in NCRYPT_KEY_HANDLE hKey, | | _In_ NCRYPT_KEY_HANDLE hKey, |
| __in_opt VOID *pPaddingInfo, | | _In_opt_ VOID *pPaddingInfo, |
| __in_bcount(cbHashValue) PBYTE pbHashValue, | | _In_reads_bytes_(cbHashValue) PBYTE pbHashValue, |
| __in DWORD cbHashValue, | | _In_ DWORD cbHashValue, |
| __out_bcount_part_opt(cbSignature, *pcbResult) PBYTE pbSignature, | | _Out_writes_bytes_to_opt_(cbSignature, *pcbResult) PBYTE pbSignature, |
| __in DWORD cbSignature, | | _In_ DWORD cbSignature, |
| __out DWORD * pcbResult, | | _Out_ DWORD * pcbResult, |
| __in DWORD dwFlags); | | _In_ DWORD dwFlags); |
| | |
|
| __checkReturn | | _Check_return_ |
| SECURITY_STATUS | | SECURITY_STATUS |
| WINAPI | | WINAPI |
| NCryptVerifySignature( | | NCryptVerifySignature( |
|
| __in NCRYPT_KEY_HANDLE hKey, | | _In_ NCRYPT_KEY_HANDLE hKey, |
| __in_opt VOID *pPaddingInfo, | | _In_opt_ VOID *pPaddingInfo, |
| __in_bcount(cbHashValue) PBYTE pbHashValue, | | _In_reads_bytes_(cbHashValue) PBYTE pbHashValue, |
| __in DWORD cbHashValue, | | _In_ DWORD cbHashValue, |
| __in_bcount(cbSignature) PBYTE pbSignature, | | _In_reads_bytes_(cbSignature) PBYTE pbSignature, |
| __in DWORD cbSignature, | | _In_ DWORD cbSignature, |
| __in DWORD dwFlags); | | _In_ DWORD dwFlags); |
| | |
| SECURITY_STATUS | | SECURITY_STATUS |
| WINAPI | | WINAPI |
| NCryptDeleteKey( | | NCryptDeleteKey( |
|
| __in NCRYPT_KEY_HANDLE hKey, | | _In_ NCRYPT_KEY_HANDLE hKey, |
| __in DWORD dwFlags); | | _In_ DWORD dwFlags); |
| | |
| SECURITY_STATUS | | SECURITY_STATUS |
| WINAPI | | WINAPI |
| NCryptFreeObject( | | NCryptFreeObject( |
|
| __in NCRYPT_HANDLE hObject); | | _In_ NCRYPT_HANDLE hObject); |
| | |
| BOOL | | BOOL |
| WINAPI | | WINAPI |
| NCryptIsKeyHandle( | | NCryptIsKeyHandle( |
|
| __in NCRYPT_KEY_HANDLE hKey); | | _In_ NCRYPT_KEY_HANDLE hKey); |
| | |
|
| __checkReturn | | _Check_return_ |
| SECURITY_STATUS | | SECURITY_STATUS |
| WINAPI | | WINAPI |
| NCryptTranslateHandle( | | NCryptTranslateHandle( |
|
| __out_opt NCRYPT_PROV_HANDLE *phProvider, | | _Out_opt_ NCRYPT_PROV_HANDLE *phProvider, |
| __out NCRYPT_KEY_HANDLE *phKey, | | _Out_ NCRYPT_KEY_HANDLE *phKey, |
| __in HCRYPTPROV hLegacyProv, | | _In_ HCRYPTPROV hLegacyProv, |
| __in_opt HCRYPTKEY hLegacyKey, | | _In_opt_ HCRYPTKEY hLegacyKey, |
| __in_opt DWORD dwLegacyKeySpec, | | _In_opt_ DWORD dwLegacyKeySpec, |
| __in DWORD dwFlags); | | _In_ DWORD dwFlags); |
| | |
| // NCryptNotifyChangeKey flags | | // NCryptNotifyChangeKey flags |
| #define NCRYPT_REGISTER_NOTIFY_FLAG 0x00000001 | | #define NCRYPT_REGISTER_NOTIFY_FLAG 0x00000001 |
| #define NCRYPT_UNREGISTER_NOTIFY_FLAG 0x00000002 | | #define NCRYPT_UNREGISTER_NOTIFY_FLAG 0x00000002 |
| #define NCRYPT_MACHINE_KEY_FLAG 0x00000020 | | #define NCRYPT_MACHINE_KEY_FLAG 0x00000020 |
| | |
|
| __checkReturn | | _Check_return_ |
| SECURITY_STATUS | | SECURITY_STATUS |
| WINAPI | | WINAPI |
| NCryptNotifyChangeKey( | | NCryptNotifyChangeKey( |
|
| __in NCRYPT_PROV_HANDLE hProvider, | | _In_ NCRYPT_PROV_HANDLE hProvider, |
| __inout HANDLE *phEvent, | | _Inout_ HANDLE *phEvent, |
| __in DWORD dwFlags); | | _In_ DWORD dwFlags); |
| | |
|
| __checkReturn | | _Check_return_ |
| SECURITY_STATUS | | SECURITY_STATUS |
| WINAPI | | WINAPI |
| NCryptSecretAgreement( | | NCryptSecretAgreement( |
|
| __in NCRYPT_KEY_HANDLE hPrivKey, | | _In_ NCRYPT_KEY_HANDLE hPrivKey, |
| __in NCRYPT_KEY_HANDLE hPubKey, | | _In_ NCRYPT_KEY_HANDLE hPubKey, |
| __out NCRYPT_SECRET_HANDLE *phAgreedSecret, | | _Out_ NCRYPT_SECRET_HANDLE *phAgreedSecret, |
| __in DWORD dwFlags); | | _In_ DWORD dwFlags); |
| | |
|
| __checkReturn | | _Check_return_ |
| SECURITY_STATUS | | SECURITY_STATUS |
| WINAPI | | WINAPI |
| NCryptDeriveKey( | | NCryptDeriveKey( |
|
| __in NCRYPT_SECRET_HANDLE hSharedSecret, | | _In_ NCRYPT_SECRET_HANDLE hSharedSecret, |
| __in LPCWSTR pwszKDF, | | _In_ LPCWSTR pwszKDF, |
| __in_opt NCryptBufferDesc *pParameterList, | | _In_opt_ NCryptBufferDesc *pParameterList, |
| __out_bcount_part_opt(cbDerivedKey, *pcbResult) PBYTE pbDerivedKey, | | _Out_writes_bytes_to_opt_(cbDerivedKey, *pcbResult) PBYTE pbDerivedKey, |
| __in DWORD cbDerivedKey, | | _In_ DWORD cbDerivedKey, |
| __out DWORD *pcbResult, | | _Out_ DWORD *pcbResult, |
| __in ULONG dwFlags); | | _In_ ULONG dwFlags); |
| | |
| | #if (NTDDI_VERSION >= NTDDI_WIN8) |
| | |
| | _Check_return_ |
| | SECURITY_STATUS |
| | WINAPI |
| | NCryptKeyDerivation( |
| | _In_ NCRYPT_KEY_HANDLE hKey, |
| | _In_opt_ NCryptBufferDesc *pParameterList, |
| | _Out_writes_bytes_to_(cbDerivedKey, *pcbResult) PUCHAR pbDerivedKey, |
| | _In_ DWORD cbDerivedKey, |
| | _Out_ DWORD *pcbResult, |
| | _In_ ULONG dwFlags); |
| | |
| | #endif // (NTDDI_VERSION >= NTDDI_WIN8) |
| | |
| #define NCRYPT_KEY_STORAGE_INTERFACE_VERSION BCRYPT_MAKE_INTERFACE_VERSION(1,0) | | #define NCRYPT_KEY_STORAGE_INTERFACE_VERSION BCRYPT_MAKE_INTERFACE_VERSION(1,0) |
|
| | #define NCRYPT_KEY_STORAGE_INTERFACE_VERSION_2 BCRYPT_MAKE_INTERFACE_VERSION(2,0 |
| | ) |
| | |
| | #endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */ |
| | #pragma endregion |
| | |
| #ifdef __cplusplus | | #ifdef __cplusplus |
| } // Balance extern "C" above | | } // Balance extern "C" above |
| #endif | | #endif |
| | |
| #endif // __NCRYPT_H__ | | #endif // __NCRYPT_H__ |
| | |
| End of changes. 69 change blocks. |
| 180 lines changed or deleted | | 450 lines changed or added |
|