pub struct KeyPair<PublicKey: ByteArray<{ CRYPTO_KEM_XWING_PUBLICKEYBYTES }> + Zeroize, SecretKey: ByteArray<{ CRYPTO_KEM_XWING_SECRETKEYBYTES }> + Zeroize> {
pub public_key: PublicKey,
pub secret_key: SecretKey,
}Expand description
An X-Wing key pair.
Fields§
§public_key: PublicKeyPublic key, shared with senders.
secret_key: SecretKeySecret key.
Implementations§
Source§impl KeyPair<Protected<HeapByteArray<{ $pk_bytes }>, ReadWrite, Locked>, Protected<HeapByteArray<{ $sk_bytes }>, ReadWrite, Locked>>
impl KeyPair<Protected<HeapByteArray<{ $pk_bytes }>, ReadWrite, Locked>, Protected<HeapByteArray<{ $sk_bytes }>, ReadWrite, Locked>>
Source§impl KeyPair<Protected<HeapByteArray<{ $pk_bytes }>, ReadOnly, Locked>, Protected<HeapByteArray<{ $sk_bytes }>, ReadOnly, Locked>>
impl KeyPair<Protected<HeapByteArray<{ $pk_bytes }>, ReadOnly, Locked>, Protected<HeapByteArray<{ $sk_bytes }>, ReadOnly, Locked>>
Source§impl<PublicKey: NewByteArray<{ CRYPTO_KEM_XWING_PUBLICKEYBYTES }> + Zeroize, SecretKey: NewByteArray<{ CRYPTO_KEM_XWING_SECRETKEYBYTES }> + Zeroize> KeyPair<PublicKey, SecretKey>
impl<PublicKey: NewByteArray<{ CRYPTO_KEM_XWING_PUBLICKEYBYTES }> + Zeroize, SecretKey: NewByteArray<{ CRYPTO_KEM_XWING_SECRETKEYBYTES }> + Zeroize> KeyPair<PublicKey, SecretKey>
Source§impl<PublicKey: NewByteArray<{ CRYPTO_KEM_XWING_PUBLICKEYBYTES }> + Zeroize, SecretKey: ByteArray<{ CRYPTO_KEM_XWING_SECRETKEYBYTES }> + Zeroize> KeyPair<PublicKey, SecretKey>
impl<PublicKey: NewByteArray<{ CRYPTO_KEM_XWING_PUBLICKEYBYTES }> + Zeroize, SecretKey: ByteArray<{ CRYPTO_KEM_XWING_SECRETKEYBYTES }> + Zeroize> KeyPair<PublicKey, SecretKey>
Sourcepub fn from_secret_key(secret_key: SecretKey) -> Self
pub fn from_secret_key(secret_key: SecretKey) -> Self
Returns the key pair for secret_key, deriving its public key.
Source§impl<PublicKey: ByteArray<{ CRYPTO_KEM_XWING_PUBLICKEYBYTES }> + Zeroize, SecretKey: ByteArray<{ CRYPTO_KEM_XWING_SECRETKEYBYTES }> + Zeroize> KeyPair<PublicKey, SecretKey>
impl<PublicKey: ByteArray<{ CRYPTO_KEM_XWING_PUBLICKEYBYTES }> + Zeroize, SecretKey: ByteArray<{ CRYPTO_KEM_XWING_SECRETKEYBYTES }> + Zeroize> KeyPair<PublicKey, SecretKey>
Sourcepub fn decapsulate<SharedSecret: NewByteArray<{ CRYPTO_KEM_XWING_SHAREDSECRETBYTES }>, Ciphertext: ByteArray<{ CRYPTO_KEM_XWING_CIPHERTEXTBYTES }>>(
&self,
ciphertext: &Ciphertext,
) -> Result<SharedSecret, Error>
pub fn decapsulate<SharedSecret: NewByteArray<{ CRYPTO_KEM_XWING_SHAREDSECRETBYTES }>, Ciphertext: ByteArray<{ CRYPTO_KEM_XWING_CIPHERTEXTBYTES }>>( &self, ciphertext: &Ciphertext, ) -> Result<SharedSecret, Error>
Recovers the shared secret that ciphertext encapsulates for
this key pair.
A ciphertext that was not created for this key pair yields an unrelated pseudorandom secret rather than an error, so the result reveals nothing about why it differs.
§Errors
For X-Wing, returns Error::InvalidKey if the X25519 part
of ciphertext is a low-order point. ML-KEM-768 decapsulation
does not fail.
Trait Implementations§
Source§impl<PublicKey: Clone + ByteArray<{ CRYPTO_KEM_XWING_PUBLICKEYBYTES }> + Zeroize, SecretKey: Clone + ByteArray<{ CRYPTO_KEM_XWING_SECRETKEYBYTES }> + Zeroize> Clone for KeyPair<PublicKey, SecretKey>
impl<PublicKey: Clone + ByteArray<{ CRYPTO_KEM_XWING_PUBLICKEYBYTES }> + Zeroize, SecretKey: Clone + ByteArray<{ CRYPTO_KEM_XWING_SECRETKEYBYTES }> + Zeroize> Clone for KeyPair<PublicKey, SecretKey>
Source§impl<PublicKey: ByteArray<{ CRYPTO_KEM_XWING_PUBLICKEYBYTES }> + Zeroize, SecretKey: ByteArray<{ CRYPTO_KEM_XWING_SECRETKEYBYTES }> + Zeroize> Debug for KeyPair<PublicKey, SecretKey>
impl<PublicKey: ByteArray<{ CRYPTO_KEM_XWING_PUBLICKEYBYTES }> + Zeroize, SecretKey: ByteArray<{ CRYPTO_KEM_XWING_SECRETKEYBYTES }> + Zeroize> Debug for KeyPair<PublicKey, SecretKey>
Source§impl<'de, PublicKey, SecretKey> Deserialize<'de> for KeyPair<PublicKey, SecretKey>where
PublicKey: Deserialize<'de> + ByteArray<{ CRYPTO_KEM_XWING_PUBLICKEYBYTES }> + Zeroize,
SecretKey: Deserialize<'de> + ByteArray<{ CRYPTO_KEM_XWING_SECRETKEYBYTES }> + Zeroize,
Available on crate feature serde only.
impl<'de, PublicKey, SecretKey> Deserialize<'de> for KeyPair<PublicKey, SecretKey>where
PublicKey: Deserialize<'de> + ByteArray<{ CRYPTO_KEM_XWING_PUBLICKEYBYTES }> + Zeroize,
SecretKey: Deserialize<'de> + ByteArray<{ CRYPTO_KEM_XWING_SECRETKEYBYTES }> + Zeroize,
Available on crate feature
serde only.Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<PublicKey: ByteArray<{ CRYPTO_KEM_XWING_PUBLICKEYBYTES }> + Zeroize, SecretKey: ByteArray<{ CRYPTO_KEM_XWING_SECRETKEYBYTES }> + Zeroize> Drop for KeyPair<PublicKey, SecretKey>
impl<PublicKey: ByteArray<{ CRYPTO_KEM_XWING_PUBLICKEYBYTES }> + Zeroize, SecretKey: ByteArray<{ CRYPTO_KEM_XWING_SECRETKEYBYTES }> + Zeroize> Drop for KeyPair<PublicKey, SecretKey>
Source§impl<PublicKey, SecretKey> Serialize for KeyPair<PublicKey, SecretKey>
Available on crate feature serde only.
impl<PublicKey, SecretKey> Serialize for KeyPair<PublicKey, SecretKey>
Available on crate feature
serde only.Auto Trait Implementations§
impl<PublicKey, SecretKey> Freeze for KeyPair<PublicKey, SecretKey>
impl<PublicKey, SecretKey> RefUnwindSafe for KeyPair<PublicKey, SecretKey>where
PublicKey: RefUnwindSafe,
SecretKey: RefUnwindSafe,
impl<PublicKey, SecretKey> Send for KeyPair<PublicKey, SecretKey>
impl<PublicKey, SecretKey> Sync for KeyPair<PublicKey, SecretKey>
impl<PublicKey, SecretKey> Unpin for KeyPair<PublicKey, SecretKey>
impl<PublicKey, SecretKey> UnsafeUnpin for KeyPair<PublicKey, SecretKey>where
PublicKey: UnsafeUnpin,
SecretKey: UnsafeUnpin,
impl<PublicKey, SecretKey> UnwindSafe for KeyPair<PublicKey, SecretKey>where
PublicKey: UnwindSafe,
SecretKey: UnwindSafe,
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