- Collect useful helpers for Azure REST API in a single location.
- Requires C++20
- Clang 18+ or GCC 14+ or MSVC 2019+
- Header-only
- Use the nuget package or CMakeLists to import into your project.
- Use Win32 functions on Windows
- OpenSSL v3.x required for Linux and MacOS
Not every facility of OpenSSL or Crypto lib is provided here. Our focus is to curate code that is of most use when using the Azure ServiceBus, Cosmos, Events REST API. Moreover, the API focusses on the
std::string
and while we've attempted to provide for an API that can be used withstd::wstring
the later is utf-8 conversion fromstd::string
.
- DateUtils (
date-utils.hpp
)- RFC7231 and RFC1123
- ISO8601
- Bas64Utils (
base64-utils.hpp
)- encode, decode
- EncryptionUtils (
encryption-utils.hpp
)- MD5, HMAC, JWTSHA256, SASToken, CosmosToken
- Use the nuget SiddiqSoft.AzureCppUtils
- Use the CPM in your CMakeLists file.
..
.. # import the CPM.cmake module and activate..
..
CPMAddModule("gh:siddiqsoft/AzureCppUtils#3.0.0")
..
..
target_link_libraries(your-project PRIVATE AzureCppUtils::AzureCppUtils)
// Get a SAS signature for ServiceBus API
std::string keyname {"RootManageSharedAccessKey"};
std::string key {"myPrimaryKey"};
std::string url {"myNamespace.servicebus.windows.net/myEventHub"};
// In this test, we're providing the epoch as the expiry string: 1629608276.
// corresponds to Sunday, August 22, 2021 4:57:56 AM UTC
auto sas = EncryptionUtils::SASToken<char>(key, url, keyname, "1629608276");
// Alternatively, you can specify minutes, hours from "now"
auto sas = EncryptionUtils::SASToken<char>(key, url, keyname, std::chrono::minutes(60));
© 2021 Siddiq Software. All rights reserved.