pub trait PublicKey: EncryptionPrimitive + PublicKeyParts {
// Required methods
fn encrypt<R: CryptoRngCore, P: PaddingScheme>(
&self,
rng: &mut R,
padding: P,
msg: &[u8],
) -> Result<Vec<u8>>;
fn verify<S: SignatureScheme>(
&self,
scheme: S,
hashed: &[u8],
sig: &[u8],
) -> Result<()>;
}Expand description
Generic trait for operations on a public key.
Required Methods§
sourcefn encrypt<R: CryptoRngCore, P: PaddingScheme>(
&self,
rng: &mut R,
padding: P,
msg: &[u8],
) -> Result<Vec<u8>>
fn encrypt<R: CryptoRngCore, P: PaddingScheme>( &self, rng: &mut R, padding: P, msg: &[u8], ) -> Result<Vec<u8>>
Encrypt the given message.
sourcefn verify<S: SignatureScheme>(
&self,
scheme: S,
hashed: &[u8],
sig: &[u8],
) -> Result<()>
fn verify<S: SignatureScheme>( &self, scheme: S, hashed: &[u8], sig: &[u8], ) -> Result<()>
Verify a signed message.
hashed must be the result of hashing the input using the hashing function
passed in through hash.
If the message is valid Ok(()) is returned, otherwise an Err indicating failure.
Object Safety§
This trait is not object safe.