MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / encryptKey

Function encryptKey

Tactility/Source/app/chat/ChatSettings.cpp:66–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64}
65
66static bool encryptKey(const uint8_t key[ESP_NOW_KEY_LEN], std::string& hexOutput) {
67 uint8_t iv[16];
68 crypt::getIv(IV_SEED, std::strlen(IV_SEED), iv);
69
70 uint8_t encrypted[ESP_NOW_KEY_LEN];
71 if (crypt::encrypt(iv, key, encrypted, ESP_NOW_KEY_LEN) != 0) {
72 LOGGER.error("Failed to encrypt key");
73 return false;
74 }
75
76 hexOutput = toHexString(encrypted, ESP_NOW_KEY_LEN);
77 return true;
78}
79
80static bool decryptKey(const std::string& hexInput, uint8_t key[ESP_NOW_KEY_LEN]) {
81 if (hexInput.size() != ESP_NOW_KEY_LEN * 2) {

Callers 1

saveSettingsFunction · 0.85

Calls 4

getIvFunction · 0.85
errorMethod · 0.80
toHexStringFunction · 0.70
encryptFunction · 0.50

Tested by

no test coverage detected