pub struct PqHandshake<'a, EKEM, SKEM, C, H, RNG>{ /* private fields */ }Expand description
Post-quantum Noise handshake
Implementations§
Source§impl<'a, EKEM, SKEM, C, H, RNG> PqHandshake<'a, EKEM, SKEM, C, H, RNG>
impl<'a, EKEM, SKEM, C, H, RNG> PqHandshake<'a, EKEM, SKEM, C, H, RNG>
Sourcepub fn new(
pattern: HandshakePattern,
prologue: &[u8],
initiator: bool,
s: Option<SKEM::SecretKey>,
e: Option<EKEM::SecretKey>,
rs: Option<SKEM::PubKey>,
re: Option<EKEM::PubKey>,
rng: &'a mut RNG,
) -> Result<PqHandshake<'a, EKEM, SKEM, C, H, RNG>, HandshakeError>
pub fn new( pattern: HandshakePattern, prologue: &[u8], initiator: bool, s: Option<SKEM::SecretKey>, e: Option<EKEM::SecretKey>, rs: Option<SKEM::PubKey>, re: Option<EKEM::PubKey>, rng: &'a mut RNG, ) -> Result<PqHandshake<'a, EKEM, SKEM, C, H, RNG>, HandshakeError>
Initialize new post-quantum handshake
§Arguments:
pattern- Handshake patternprolopgue- Optional prologue data for the handshakeinitiator- True if we are the initiators- Our static secret keye- Our ephemeral secret key - Shouldn’t usually be provided manuallyrs- Peer public static keyre- Peer public ephemeral key - Shouldn’t usually be provided manuallyrng- RNG to use during the handshake
§Generic parameters:
EKEM- KEM algorithm to use for ephemeral key encapsulationSKEM- KEM algorithm to use for static key encapsulationC- Cipher algorithm to useH- Hashing algorithm to use
Trait Implementations§
Source§impl<'a, EKEM, SKEM, C, H, RNG> Handshaker<C, H> for PqHandshake<'a, EKEM, SKEM, C, H, RNG>
impl<'a, EKEM, SKEM, C, H, RNG> Handshaker<C, H> for PqHandshake<'a, EKEM, SKEM, C, H, RNG>
Source§fn is_write_turn(&self) -> bool
fn is_write_turn(&self) -> bool
Is it our turn to send
Source§fn is_initiator(&self) -> bool
fn is_initiator(&self) -> bool
Are we the initiator
Source§fn get_next_message_overhead(&self) -> HandshakeResult<usize>
fn get_next_message_overhead(&self) -> HandshakeResult<usize>
Get next message overhead in bytes
Source§fn build_name(pattern: &HandshakePattern) -> ArrayString<128>
fn build_name(pattern: &HandshakePattern) -> ArrayString<128>
Build full name of the protocol with the given pattern
Source§fn write_message(
&mut self,
payload: &[u8],
out: &mut [u8],
) -> HandshakeResult<usize>
fn write_message( &mut self, payload: &[u8], out: &mut [u8], ) -> HandshakeResult<usize>
Write next handshake message to the given buffer Read more
Source§fn read_message(
&mut self,
message: &[u8],
out: &mut [u8],
) -> HandshakeResult<usize>
fn read_message( &mut self, message: &[u8], out: &mut [u8], ) -> HandshakeResult<usize>
Read and process next handshake message from given buffer Read more
Source§fn is_finished(&self) -> bool
fn is_finished(&self) -> bool
Is the handshake finished
Source§fn get_name(&self) -> ArrayString<128>
fn get_name(&self) -> ArrayString<128>
Get full name of the selected protocol
Source§fn finalize(self) -> HandshakeResult<TransportState<C, H>>where
Self: Sized,
fn finalize(self) -> HandshakeResult<TransportState<C, H>>where
Self: Sized,
Transition into transport mode Read more
Auto Trait Implementations§
impl<'a, EKEM, SKEM, C, H, RNG> Freeze for PqHandshake<'a, EKEM, SKEM, C, H, RNG>
impl<'a, EKEM, SKEM, C, H, RNG> RefUnwindSafe for PqHandshake<'a, EKEM, SKEM, C, H, RNG>where
<H as Hash>::Output: RefUnwindSafe,
<SKEM as Kem>::SecretKey: RefUnwindSafe,
<EKEM as Kem>::SecretKey: RefUnwindSafe,
<SKEM as Kem>::PubKey: RefUnwindSafe,
<EKEM as Kem>::PubKey: RefUnwindSafe,
RNG: RefUnwindSafe,
<C as Cipher>::Key: RefUnwindSafe,
impl<'a, EKEM, SKEM, C, H, RNG> Send for PqHandshake<'a, EKEM, SKEM, C, H, RNG>
impl<'a, EKEM, SKEM, C, H, RNG> Sync for PqHandshake<'a, EKEM, SKEM, C, H, RNG>
impl<'a, EKEM, SKEM, C, H, RNG> Unpin for PqHandshake<'a, EKEM, SKEM, C, H, RNG>
impl<'a, EKEM, SKEM, C, H, RNG> !UnwindSafe for PqHandshake<'a, EKEM, SKEM, C, H, RNG>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more