Trait rubble::ecdh::SecretKey [−][src]
pub trait SecretKey: Sized {
fn agree(
self,
foreign_key: &PublicKey
) -> Result<SharedSecret, InvalidPublicKey>;
}
Expand description
Secret key operations required by Rubble.
This API imposes no requirements on the representation or location of secret keys. This means that it should be possible to implement this trait even for keys stored in some secure key storage like a smartcard.
Required methods
fn agree(
self,
foreign_key: &PublicKey
) -> Result<SharedSecret, InvalidPublicKey>
fn agree(
self,
foreign_key: &PublicKey
) -> Result<SharedSecret, InvalidPublicKey>
Performs ECDH key agreement using an ephemeral secret key self
and the public key of the
other party.
Here, “ephemeral” just means that this method takes self
by value. This allows
implementing SecretKey
for providers that enforce single-use keys using Rust ownership
(like ring).
Errors
If foreign_key
is an invalid public key, implementors must return an error.