Struct pqc_kyber::Ake [−][src]
pub struct Ake { pub shared_secret: SharedSecret, // some fields omitted }
Expand description
Used for mutually authenticated key exchange between two parties.
Example:
let mut rng = rand::thread_rng(); let mut alice = Ake::new(); let mut bob = Ake::new(); let alice_keys = keypair(&mut rng); let bob_keys = keypair(&mut rng); let client_init = alice.client_init(&bob_keys.public, &mut rng); let server_send = bob.server_receive(client_init, &alice_keys.public, &bob_keys.secret, &mut rng)?; let client_confirm = alice.client_confirm(server_send, &alice_keys.secret); assert_eq!(alice.shared_secret, bob.shared_secret);
Fields
The resulting shared secret from a key exchange
Implementations
impl Ake
[src]
impl Ake
[src]pub fn client_init<R>(&mut self, pubkey: &PublicKey, rng: &mut R) -> AkeSendInit where
R: CryptoRng + RngCore,
[src]
pub fn client_init<R>(&mut self, pubkey: &PublicKey, rng: &mut R) -> AkeSendInit where
R: CryptoRng + RngCore,
[src]Initiates a Mutually Authenticated Key Exchange.
let mut rng = rand::thread_rng(); let mut alice = Ake::new(); let bob_keys = keypair(&mut rng); let client_init = alice.client_init(&bob_keys.public, &mut rng);
pub fn server_receive<R>(
&mut self,
ake_send_a: AkeSendInit,
pubkey: &PublicKey,
secretkey: &SecretKey,
rng: &mut R
) -> Result<AkeSendResponse, KyberError> where
R: CryptoRng + RngCore,
[src]
pub fn server_receive<R>(
&mut self,
ake_send_a: AkeSendInit,
pubkey: &PublicKey,
secretkey: &SecretKey,
rng: &mut R
) -> Result<AkeSendResponse, KyberError> where
R: CryptoRng + RngCore,
[src]Handles and authenticates the output of a client_init()
request
let mut alice = Ake::new(); let mut bob = Ake::new(); let alice_keys = keypair(&mut rng); let bob_keys = keypair(&mut rng); let client_init = alice.client_init(&bob_keys.public, &mut rng); let server_send = bob.server_receive(client_init, &alice_keys.public, &bob_keys.secret, &mut rng)?;
pub fn client_confirm(
&mut self,
send_b: AkeSendResponse,
secretkey: &SecretKey
) -> Result<(), KyberError>
[src]
pub fn client_confirm(
&mut self,
send_b: AkeSendResponse,
secretkey: &SecretKey
) -> Result<(), KyberError>
[src]Decapsulates and authenticates the shared secret from the output of
server_receive()
let server_send = bob.server_receive(client_init, &alice_keys.public, &bob_keys.secret, &mut rng)?; let client_confirm = alice.client_confirm(server_send, &alice_keys.secret); assert_eq!(alice.shared_secret, bob.shared_secret);
Trait Implementations
impl Copy for Ake
[src]
impl Eq for Ake
[src]
impl StructuralEq for Ake
[src]
impl StructuralPartialEq for Ake
[src]
Auto Trait Implementations
impl RefUnwindSafe for Ake
impl Send for Ake
impl Sync for Ake
impl Unpin for Ake
impl UnwindSafe for Ake
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more