Struct nis1_crypto::CryptoNis1 [−][src]
pub struct CryptoNis1;
Trait Implementations
Encode a message text with AES algorithm using the signer’s the PrivateKey and receiver’s PublicKey.
Inputs
-
signer_sk
: The signer’s private key. -
receiver_pk
: The receiver’s public key. -
msg
: Message to encrypt.
Returns
A Result
whose okay value is an encrypt message Vec<u8>
or whose error value
is an failure::Error
describing the error that occurred.
Decrypt a message text with AES algorithm using the receiver’s the PrivateKey and signer’s PublicKey.
Inputs
-
receiver_sk
: The receiver’s private key. -
signer_pk
: The signer’s public key. -
enc_msg
: Message encrypted.
Example
ⓘ
use std::str::FromStr; use symbol_crypto_core::{PrivateKey, PublicKey,decrypt_message }; let receiver_sk = PrivateKey::from_str("A22A4BBF126A2D7D7ECE823174DFD184C5DE0FDE4CB2075D30CFA409F7EF8908").unwrap(); let signer_pk = PublicKey::from_str("3FD283D8543C12B81917C154CDF4EFD3D48E553E6D7BC77E29CB168138CED17D").unwrap(); let encrypt_text_vec = [ 125, 59, 126, 248, 124, 129, 157, 100, 111, 84, 49, 163, 111, 68, 22, 137, 75, 132, 135, 217, 251, 158, 115, 74, 226, 172, 200, 208, 33, 183, 110, 103, 107, 170, 52, 174, 192, 110, 164, 44, 77, 69, 203, 48, 43, 17, 206, 143, 154, 155, 231, 72, 28, 24, 20, 241, 234, 202, 184, 66, ]; let decrypted_text = decrypt_message( receiver_sk.as_fixed_bytes(), signer_pk.as_fixed_bytes(), &encrypt_text_vec).unwrap();
Returns
A Result
whose okay value is an decrypted message Vec<u8>
or whose error value
is an failure::Error
describing the error that occurred.
Auto Trait Implementations
impl RefUnwindSafe for CryptoNis1
impl Send for CryptoNis1
impl Sync for CryptoNis1
impl Unpin for CryptoNis1
impl UnwindSafe for CryptoNis1