Struct libsignal_protocol::kem::KeyPair
source · pub struct KeyPair {
pub public_key: PublicKey,
pub secret_key: SecretKey,
}
Expand description
A public/secret key pair for a KEM protocol.
Fields§
§public_key: PublicKey
§secret_key: SecretKey
Implementations§
source§impl KeyPair
impl KeyPair
sourcepub fn generate(key_type: KeyType) -> Self
pub fn generate(key_type: KeyType) -> Self
Creates a public-secret key pair for a specified KEM protocol. Uses system randomness implemented by PQClean.
pub fn new(public_key: PublicKey, secret_key: SecretKey) -> Self
sourcepub fn from_public_and_private(
public_key: &[u8],
secret_key: &[u8],
) -> Result<Self>
pub fn from_public_and_private( public_key: &[u8], secret_key: &[u8], ) -> Result<Self>
Deserialize public and secret keys that were serialized by PublicKey::serialize()
and SecretKey::serialize()
respectively.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for KeyPair
impl RefUnwindSafe for KeyPair
impl Send for KeyPair
impl Sync for KeyPair
impl Unpin for KeyPair
impl UnwindSafe for KeyPair
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more