Trait libp2p_noise::Protocol
source · pub trait Protocol<C> {
// Required methods
fn params_ik() -> ProtocolParams;
fn params_ix() -> ProtocolParams;
fn params_xx() -> ProtocolParams;
fn public_from_bytes(s: &[u8]) -> Result<PublicKey<C>, Error>;
// Provided methods
fn linked(id_pk: &PublicKey, dh_pk: &PublicKey<C>) -> bool { ... }
fn verify(
id_pk: &PublicKey,
dh_pk: &PublicKey<C>,
sig: &Option<Vec<u8>>
) -> bool
where C: AsRef<[u8]> { ... }
fn sign(id_keys: &Keypair, dh_pk: &PublicKey<C>) -> Result<Vec<u8>, Error>
where C: AsRef<[u8]> { ... }
}
libp2p_noise::Config::new
instead to use the noise protocol.Expand description
A Noise protocol over DH keys of type C
. The choice of C
determines the
protocol parameters for each handshake pattern.
Required Methods§
sourcefn params_ik() -> ProtocolParams
fn params_ik() -> ProtocolParams
libp2p_noise::Config::new
instead to use the noise protocol.The protocol parameters for the IK handshake pattern.
sourcefn params_ix() -> ProtocolParams
fn params_ix() -> ProtocolParams
libp2p_noise::Config::new
instead to use the noise protocol.The protocol parameters for the IX handshake pattern.
sourcefn params_xx() -> ProtocolParams
fn params_xx() -> ProtocolParams
libp2p_noise::Config::new
instead to use the noise protocol.The protocol parameters for the XX handshake pattern.
sourcefn public_from_bytes(s: &[u8]) -> Result<PublicKey<C>, Error>
fn public_from_bytes(s: &[u8]) -> Result<PublicKey<C>, Error>
libp2p_noise::Config::new
instead to use the noise protocol.Construct a DH public key from a byte slice.
Provided Methods§
sourcefn linked(id_pk: &PublicKey, dh_pk: &PublicKey<C>) -> bool
fn linked(id_pk: &PublicKey, dh_pk: &PublicKey<C>) -> bool
Determines whether the authenticity of the given DH static public key and public identity key is linked, i.e. that proof of ownership of a secret key for the static DH public key implies that the key is authentic w.r.t. the given public identity key.
The trivial case is when the keys are byte for byte identical.
sourcefn verify(
id_pk: &PublicKey,
dh_pk: &PublicKey<C>,
sig: &Option<Vec<u8>>
) -> boolwhere
C: AsRef<[u8]>,
fn verify( id_pk: &PublicKey, dh_pk: &PublicKey<C>, sig: &Option<Vec<u8>> ) -> boolwhere C: AsRef<[u8]>,
libp2p_noise::Config::new
instead to use the noise protocol.Verifies that a given static DH public key is authentic w.r.t. a given public identity key in the context of an optional signature.
The given static DH public key is assumed to already be authentic in the sense that possession of a corresponding secret key has been established, as is the case at the end of a Noise handshake involving static DH keys.
If the public keys are linked
, verification succeeds
without a signature, otherwise a signature over the static DH public key
must be given and is verified with the public identity key, establishing
the authenticity of the static DH public key w.r.t. the public identity key.