pub struct Ecies { /* private fields */ }
Expand description
An unestablished ECIES session.
Implementations§
source§impl Ecies
impl Ecies
sourcepub fn new() -> Self
pub fn new() -> Self
Create a new, random, unestablished ECIES session.
This method will use the MATRIX_QR_CODE_LOGIN
info. If you are using
this for a different purpose, consider using the Ecies::with_info()
method.
sourcepub fn with_info(info: &str) -> Self
pub fn with_info(info: &str) -> Self
Create a new, random, unestablished ECIES session with the given application info.
The application info will be used to derive the various secrets and provide domain separation.
sourcepub fn establish_outbound_channel(
self,
their_public_key: Curve25519PublicKey,
initial_plaintext: &[u8],
) -> Result<OutboundCreationResult, Error>
pub fn establish_outbound_channel( self, their_public_key: Curve25519PublicKey, initial_plaintext: &[u8], ) -> Result<OutboundCreationResult, Error>
Create an EstablishedEcies
session using the other side’s Curve25519
public key and an initial plaintext.
After the channel has been established, we can encrypt messages to send to the other side. The other side uses the initial message to establishes the same channel on its side.
sourcepub fn establish_inbound_channel(
self,
message: &InitialMessage,
) -> Result<InboundCreationResult, Error>
pub fn establish_inbound_channel( self, message: &InitialMessage, ) -> Result<InboundCreationResult, Error>
Create a EstablishedEcies
from an InitialMessage
encrypted by
the other side.
sourcepub fn public_key(&self) -> Curve25519PublicKey
pub fn public_key(&self) -> Curve25519PublicKey
Get our Curve25519PublicKey
.
This public key needs to be sent to the other side to be able to establish an ECIES channel.