|
VLink 2.0.0
A high-performance communication middleware
|
AES-128-CBC encryption/decryption with optional custom callback override. 更多...
#include <functional>#include <memory>#include <string>#include "../base/bytes.h"#include "../base/macros.h"类 | |
| class | vlink::Security |
| Thread-safe AES-128-CBC encryption/decryption utility with custom callback support. 更多... | |
命名空间 | |
| namespace | vlink |
AES-128-CBC encryption/decryption with optional custom callback override.
Security provides message-level encryption and decryption for VLink transports. When compiled with VLINK_ENABLE_SECURITY (requires OpenSSL), it uses AES-128-CBC via the EVP API with PKCS7 padding. The default AES key is "vlink" and the IV is "thun.lu@zohomail.cn" (OpenSSL uses the first 16 bytes of each).
Custom crypto implementations can replace the built-in algorithm by registering a pair of Callback functions via set_callbacks(). When custom callbacks are installed, the AES implementation is bypassed entirely.
-lssl -lcrypto and define VLINK_ENABLE_SECURITY.encrypt() and decrypt() return true on success, false on failure.VLINK_ENABLE_SECURITY is not defined, encrypt() and decrypt() log a warning and return false.Bytes to encrypt() or decrypt() is a no-op that returns true immediately.