pub trait AsymmetricCipher:
Identified
+ Send
+ Sync {
// Required methods
fn encrypt(&self, plaintext: &[u8], public_key_hex: &str) -> Result<String>;
fn decrypt(
&self,
ciphertext_hex: &str,
private_key_hex: &str,
) -> Result<Vec<u8>>;
}Expand description
非对称加密:每次调用传入密钥材料(十六进制,格式由实现决定,如 SM2)。
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".