Azure C++ Utils 1.5.2+3
Azure REST API Helpers for Modern C++
|
Encryption utility functions for ServiceBus, Cosmos, EventGrid, EventHub Implementation Note! The support for wstring is for completeness and typically the use-case is where we fiddle with utf8 data and not utf16 over the internet and especially json documents! More...
#include <encryption-utils.hpp>
Static Public Member Functions | |
template<typename T = char> requires std::same_as<T, char> || std::same_as<T, wchar_t> | |
static std::string | MD5 (const std::basic_string< T > &source) |
Create a MD5 hash for the given source as a string. More... | |
template<typename T = char> requires std::same_as<T, char> || std::same_as<T, wchar_t> | |
static std::string | HMAC (const std::basic_string< T > &message, const std::string &key) |
Returns binary HMAC using SHA-256. https://www.liavaag.org/English/SHA-Generator/HMAC/. More... | |
template<typename T = char> requires std::same_as<T, char> || std::same_as<T, wchar_t> | |
static std::basic_string< T > | JWTHMAC256 (const std::string &key, const std::basic_string< T > &header, const std::basic_string< T > &payload) |
Create a JsonWebToken authorization with HMAC 256. More... | |
template<typename T = char> requires std::same_as<T, char> || std::same_as<T, wchar_t> | |
static std::basic_string< T > | SASToken (const std::string &key, const std::basic_string< T > &url, const std::basic_string< T > &keyName, const std::chrono::seconds &timeout) |
Create a Shared Access Signature for Azure storage https://docs.microsoft.com/en-us/rest/api/eventhub/generate-sas-token. More... | |
template<typename T = char> requires std::same_as<T, char> || std::same_as<T, wchar_t> | |
static std::basic_string< T > | SASToken (const std::string &key, const std::basic_string< T > &url, const std::basic_string< T > &keyName, const std::basic_string< T > &expiry) |
Create a Shared Access Signature for Azure storage https://docs.microsoft.com/en-us/rest/api/eventhub/generate-sas-token. More... | |
template<typename T = char> requires std::same_as<T, char> || std::same_as<T, wchar_t> | |
static std::basic_string< T > | CosmosToken (const std::string &key, const std::basic_string< T > &verb, const std::basic_string< T > &type, const std::basic_string< T > &resourceLink, const std::basic_string< T > &date) |
Create the Cosmos Authorization Token using the Key for this connection. More... | |
Encryption utility functions for ServiceBus, Cosmos, EventGrid, EventHub Implementation Note! The support for wstring is for completeness and typically the use-case is where we fiddle with utf8 data and not utf16 over the internet and especially json documents!
Definition at line 72 of file encryption-utils.hpp.
|
inlinestatic |
Create the Cosmos Authorization Token using the Key for this connection.
key | Binary. The key must be decoded from the base64 value in the connection string from the Azure portal |
verb | GET, POST, PUT, DELETE |
type | One of the following: dbs, docs, colls, attachments or empty |
resourceLink | The resource link sub-uri |
date | Date in RFC7231 as string |
Definition at line 298 of file encryption-utils.hpp.
|
inlinestatic |
Returns binary HMAC using SHA-256. https://www.liavaag.org/English/SHA-Generator/HMAC/.
message | Source text |
key | Source key; MUST NOT be base64 encoded |
Definition at line 136 of file encryption-utils.hpp.
|
inlinestatic |
Create a JsonWebToken authorization with HMAC 256.
key | Must be std::string as the contents are the "key" and treated as "binary" |
header | The JWT header |
payload | The string wiht json tokens |
Definition at line 206 of file encryption-utils.hpp.
|
inlinestatic |
Create a MD5 hash for the given source as a string.
source | Maybe std::string or std::wstring |
Definition at line 79 of file encryption-utils.hpp.
|
inlinestatic |
Create a Shared Access Signature for Azure storage https://docs.microsoft.com/en-us/rest/api/eventhub/generate-sas-token.
key | The key to sign the url with time |
url | The url for the session |
keyName | The key name |
expiry | The expiry is the number of seconds since 1970-1-1 plus timeout |
Definition at line 261 of file encryption-utils.hpp.
|
inlinestatic |
Create a Shared Access Signature for Azure storage https://docs.microsoft.com/en-us/rest/api/eventhub/generate-sas-token.
key | The key is "binary" in std::string |
url | The url for the session |
keyName | The key name |
timeout | Amount of ticks past the "now" (number of seconds since 1970-1-1) |
Definition at line 234 of file encryption-utils.hpp.