mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-05-01 11:45:13 +00:00
Merge pull request #3026 from MichaelDvP/dev
This commit is contained in:
@@ -70,12 +70,16 @@ void ArduinoJsonJWT::parseJWT(String jwt, JsonDocument & jsonDocument) {
|
|||||||
*/
|
*/
|
||||||
String ArduinoJsonJWT::sign(String & payload) {
|
String ArduinoJsonJWT::sign(String & payload) {
|
||||||
std::array<unsigned char, 32> hmacResult{};
|
std::array<unsigned char, 32> hmacResult{};
|
||||||
mbedtls_md_hmac(mbedtls_md_info_from_type(MBEDTLS_MD_SHA256),
|
{
|
||||||
reinterpret_cast<const unsigned char *>(_secret.c_str()),
|
mbedtls_md_context_t ctx;
|
||||||
_secret.length(),
|
mbedtls_md_type_t md_type = MBEDTLS_MD_SHA256;
|
||||||
reinterpret_cast<const unsigned char *>(payload.c_str()),
|
mbedtls_md_init(&ctx);
|
||||||
payload.length(),
|
mbedtls_md_setup(&ctx, mbedtls_md_info_from_type(md_type), 1);
|
||||||
hmacResult.data());
|
mbedtls_md_hmac_starts(&ctx, reinterpret_cast<const unsigned char *>(_secret.c_str()), _secret.length());
|
||||||
|
mbedtls_md_hmac_update(&ctx, reinterpret_cast<const unsigned char *>(payload.c_str()), payload.length());
|
||||||
|
mbedtls_md_hmac_finish(&ctx, hmacResult.data());
|
||||||
|
mbedtls_md_free(&ctx);
|
||||||
|
}
|
||||||
return encode(reinterpret_cast<const char *>(hmacResult.data()), hmacResult.size());
|
return encode(reinterpret_cast<const char *>(hmacResult.data()), hmacResult.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
#define EMSESP_APP_VERSION "3.8.2-dev.14"
|
#define EMSESP_APP_VERSION "3.8.2-dev.15"
|
||||||
|
|||||||
Reference in New Issue
Block a user