Trait commonware_p2p::crypto::Crypto
source · pub trait Crypto:
Send
+ Sync
+ Clone
+ 'static {
// Required methods
fn me(&self) -> PublicKey;
fn sign(&mut self, dst: &[u8], data: &[u8]) -> Signature;
fn validate(public_key: &PublicKey) -> bool;
fn verify(
dst: &[u8],
data: &[u8],
public_key: &PublicKey,
signature: &Signature,
) -> bool;
}Expand description
Cryptographic operations required by commonware-p2p.
§Warning
Although data provided to this implementation to be signed are expected to be unique to commonware-p2p, it is strongly recommended to prefix any payloads with a unique identifier (dst) to prevent replay attacks.
Required Methods§
Object Safety§
This trait is not object safe.