CryptoWrappers v1.17 A set of
C++ classes to provide a complete C++ encapsulation of the various Cryptography
APIs on Windows
The classes provided are: CryptoWrappers::CCertificate, CryptoWrappers::CChain,
CryptoWrappers::CChainEngine, CryptoWrappers::CCRL, CryptoWrappers::CCTL, CryptoWrappers::CDefaultContext,
CryptoWrappers::CHash, CryptoWrappers::CKey, CryptoWrappers::CMessage, CryptoWrappers::COCSPResponseContext,
CryptoWrappers::COCSPServerResponse, CryptoWrappers::CProvider, CryptoWrappers::CStore,
CryptoWrappers::CCNGHash, CryptoWrappers::CCNGKey, CryptoWrappers::CCNGKey2, CryptoWrappers::CCNGProvider,
CryptoWrappers::CCNGSecret, CryptoWrappers::CCNGSecret2 & CryptoWrappers::CCNGStorageProvider.
CCertificate provides a class based encapsulation of a CryptoAPI certificate
as represented by a PCCERT_CONTEXT.
CChain provides a class based encapsulation of a CryptoAPI certificate
chain as represented by a PCCERT_CHAIN_CONTEXT.
CChainEngine provides a class based encapsulation of a CryptoAPI chain
engine as represented by a HCERTCHAINENGINE.
CCRL provides a class based encapsulation of a CryptoAPI Certificate Revocation
List as represented by a PCCRL_CONTEXT.
CCTL provides a class based encapsulation of a CryptoAPI Certificate Trust
List as represented by a PCCTL_CONTEXT.
CDefaultContext provides a class based encapsulation of a CryptoAPI default
context provider as represented by a HCRYPTDEFAULTCONTEXT.
CHash provides a class based encapsulation of a CryptoAPI Hash as represented
by a HCRYPTHASH.
CKey provides a class based encapsulation of a CryptoAPI Key as represented
by a HCRYPTKEY.
CMessage provides a class based encapsulation of a cryptographic message
as represented by a HCRYPTMSG.
COCSPResponseContext provides a class based encapsulation of an online
certificate status protocol (OCSP) response context as represented by a PCCERT_SERVER_OCSP_RESPONSE_CONTEXT.
COCSPServerResponse provides a class based encapsulation of an OCSP response
associated with a server certificate chain as represented by a HCERT_SERVER_OCSP_RESPONSE.
CProvider provides a class based encapsulation of a CryptoAPI cryptographic
service provider (CSP) as represented by a HCRYPTPROV.
CStore provides a class based encapsulation of a CryptoAPI certificate
store as represented by a HCERTSTORE.
CCNGHash provides a class based encapsulation of a CNG (Cryptography Next
Generation) BCrypt Hash as represented by a BCRYPT_HASH_HANDLE.
CCNGKey provides a class based encapsulation of a CNG BCrypt Key as represented
by a BCRYPT_KEY_HANDLE.
CCNGKey2 provides a class based encapsulation of a CNG NCrypt Key as represented
by a NCRYPT_KEY_HANDLE.
CCNGProvider provides a class based encapsulation of a CNG BCrypt algorithm
provider as represented by a BCRYPT_ALG_HANDLE.
CCNGSecret provides a class based encapsulation of a CNG BCrypt secret
agreement value as represented by a BCRYPT_SECRET_HANDLE.
CCNGSecret2 provides a class based encapsulation of a CNG NCrypt secret
agreement value as represented by a NCRYPT_SECRET_HANDLE.
CCNGStorageProvider provides a class based encapsulation of CNG NCrypt
storage provider as represented by a NCRYPT_PROV_HANDLE.
Features
- Provides twenty one simple C++ Header only modules to encapsulate all of
the Cryptography APIs on Windows.
- Provides a number of helper methods in CryptoWrappersHelpers.h which encapsulates
the CryptBinaryToString and CryptStringToBinary APIs which integrates with STL's
and MFC's string classes for easier client coding.
- Should make it easier to use all the Cryptography API's from C++ going forward
with automatic Resource Acquisition Is Initialization (RAII) resource management.
The enclosed zip file contains the
CryptoWrappers source code and a VC 2017 console based application which exercises
all of the various classes functionality.
Copyright
- You are allowed to include the source code in any product (commercial, shareware,
freeware or otherwise) when your product is released in binary form.
- You are allowed to modify the source code in any way you want except you
cannot modify the copyright details at the top of each module.
- If you want to distribute source code with your application, then you are
only allowed to distribute versions released by the author. This is to maintain
a single distribution point for the source code.
Updates
v1.17 (7 May 2023)
- Updated copyright details.
- Renamed CCertificate::SerializStoreElement method to
SerializeStoreElement.
- Renamed CStore::AddCertifcate method to AddCertificate.
v1.16 (26 February 2022)
- Updated the code to use C++ uniform initialization for all variable
declarations.
v1.15 (26 January 2022)
- Updated copyright details.
- Fixed more static code analysis warnings in Visual Studio 2022.
v1.14 (4 July 2021)
- Updated copyright details
- Made code independent of ATL by replacing calls to ATLASSERT with
_ASSERTE
v1.13 (12 April 2020)
- Fixed more Clang-Tidy static code analysis warnings in the code.
v1.12 (2 January 2020)
- Fixed more Clang-Tidy static code analysis warnings in the code.
v1.11 (16 December 2019)
- Fixed various Clang-Tidy static code analysis warnings in the code.
v1.10 (20 April 2019)
- Updated copyright details
- Updated the sample app to clean compile on VC 2019
v1.09 (22 August 2018)
- Fixed a number of compiler warnings when using VS 2017 15.8.1
v1.08 (12 June 2018)
- Updated copyright details.
- Fixed a number of C++ core guidelines compiler warnings. These changes
mean that the code will now only compile on VC 2017 or later.
v1.07 (21 December 2017)
- Replaced NULL throughout the codebase with nullptr.
- Reviewed the latest Windows 10 SDK to verify that CryptoWrappers is up
to date.
v1.06 (27 April 2017)
- Updated the code to compile cleanly using /permissive-.
V1.05 (17 April 2017)
- Updated copyright details.
- Verified code compiles cleanly on VC 2017
- Updated code to include updates from latest Windows 10 SDK. Added support
for CryptSignAndEncodeCertificate to the CCNGKey class. Added support for CryptSignCertificate
to the CCNGKey class.
V1.04 (12 May 2016)
- Updated copyright details.
- Updated code to be /analyze clean on VC 2015
- Fixed a compile problem in CryptoWrappersCNGProvider.h when compiled in
VC 2013 related to the preprocessor define NTDDI_WINTHRESHOLD
V1.03 (1 November 2015)
- Updated code to clean compile on VC 2015.
- Reviewed all the changes in the Windows 10 SDK to do with Cryptography to
make sure the classes support all the new functionality and compile correctly
when used with this updated SDK.
- Updated SAL annotations for CCNGProvider::GenRandom to be consistent with
the annotations in the Windows 10 SDK.
- Updated COCSPServerResponse::Open to optionally take a PCERT_SERVER_OCSP_RESPONSE_OPEN_PARA
as exposed in the Windows 10 SDK.
- Added a CCNGProvider::CreateMultiHash method to encapsulate the new BCryptCreateMultiHash
provided with Windows 8.1 Update.
- Added a CCNGHash::ProcessMultiOperations method to encapsulate the new BCryptProcessMultiOperations
provided with Windows 8.1 Update.
- Added a CCNGProvider::Hash method to encapsulate the new BCryptHash provided
with Windows 10.
V1.02 (31 January 2015)
- Updated copyright details
- Marked functions in CryptoWrappersHelpers.h as inline.
V1.01 (21 September 2014)
- Added missing include of CryptoWrapperHelpers.h to CryptoWrappersCertificate.h
- Updated copyright details
- Marked functions in CryptoWrappersHelpers.h as inline.
V1.0 (1 August 2014)