MCPcopy Create free account
hub / github.com/apache/nifi-minifi-cpp / encrypt

Function encrypt

libminifi/src/utils/EncryptionUtils.cpp:79–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77}
78
79std::string encrypt(const std::string& plaintext, const Bytes& key) {
80 Bytes nonce = randomBytes(EncryptionType::nonceLength());
81 Bytes ciphertext_plus_mac = encryptRaw(stringToBytes(plaintext), key, nonce);
82
83 std::string nonce_base64 = utils::StringUtils::to_base64(nonce);
84 std::string ciphertext_plus_mac_base64 = utils::StringUtils::to_base64(ciphertext_plus_mac);
85 return nonce_base64 + EncryptionType::separator() + ciphertext_plus_mac_base64;
86}
87
88Bytes decryptRaw(const Bytes& input, const Bytes& key, const Bytes& nonce) {
89 if (key.size() != EncryptionType::keyLength()) {

Callers 4

encryptFlowConfigMethod · 0.85
encryptMethod · 0.85

Calls 3

randomBytesFunction · 0.85
encryptRawFunction · 0.85
stringToBytesFunction · 0.85

Tested by

no test coverage detected