Struct AgreementPrivateKey
Source pub struct AgreementPrivateKey { }
examples/13_key_agreement_shared_secret.rs (
line 4)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let alice = AgreementPrivateKey::generate_p256()?;
5 let bob = AgreementPrivateKey::generate_p256()?;
6 let alice_public = alice.public_key()?;
7 let bob_public = bob.public_key()?;
8 let alice_secret = alice.shared_secret(&bob_public, 32, b"shared-info")?;
9 let bob_secret = bob.shared_secret(&alice_public, 32, b"shared-info")?;
10 println!("shared_secret_match={}", alice_secret == bob_secret);
11 Ok(())
12}
examples/13_key_agreement_shared_secret.rs (
line 6)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let alice = AgreementPrivateKey::generate_p256()?;
5 let bob = AgreementPrivateKey::generate_p256()?;
6 let alice_public = alice.public_key()?;
7 let bob_public = bob.public_key()?;
8 let alice_secret = alice.shared_secret(&bob_public, 32, b"shared-info")?;
9 let bob_secret = bob.shared_secret(&alice_public, 32, b"shared-info")?;
10 println!("shared_secret_match={}", alice_secret == bob_secret);
11 Ok(())
12}
examples/13_key_agreement_shared_secret.rs (
line 8)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let alice = AgreementPrivateKey::generate_p256()?;
5 let bob = AgreementPrivateKey::generate_p256()?;
6 let alice_public = alice.public_key()?;
7 let bob_public = bob.public_key()?;
8 let alice_secret = alice.shared_secret(&bob_public, 32, b"shared-info")?;
9 let bob_secret = bob.shared_secret(&alice_public, 32, b"shared-info")?;
10 println!("shared_secret_match={}", alice_secret == bob_secret);
11 Ok(())
12}
Formats the value using the given formatter.
Read more
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
Returns the argument unchanged.
Calls U::from(self).
That is, this conversion is whatever the implementation of
From<T> for U chooses to do.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.