pub struct X25519PublicKey(/* private fields */);Expand description
A public key for X25519 key agreement operations.
X25519 is an elliptic-curve Diffie-Hellman key exchange protocol based on Curve25519 as defined in RFC 7748. It allows two parties to establish a shared secret key over an insecure channel.
The X25519 public key is generated from a corresponding private key and is designed to be:
- Compact (32 bytes)
- Fast to use in key agreement operations
- Resistant to various cryptographic attacks
This implementation provides:
- Creation of X25519 public keys from raw data
- CBOR serialization and deserialization
- Support for the Encrypter trait for key encapsulation
- Various utility and conversion methods
Implementations§
Source§impl X25519PublicKey
impl X25519PublicKey
pub const KEY_SIZE: usize = 32usize
Sourcepub const fn from_data(data: [u8; 32]) -> Self
pub const fn from_data(data: [u8; 32]) -> Self
Restore an X25519PublicKey from a fixed-size array of bytes.
Sourcepub fn from_data_ref(data: impl AsRef<[u8]>) -> Result<Self>
pub fn from_data_ref(data: impl AsRef<[u8]>) -> Result<Self>
Restore an X25519PublicKey from a reference to an array of bytes.
Trait Implementations§
Source§impl AsRef<[u8]> for X25519PublicKey
impl AsRef<[u8]> for X25519PublicKey
Source§impl AsRef<X25519PublicKey> for X25519PublicKey
Implements AsRef<X25519PublicKey> to allow self-reference.
impl AsRef<X25519PublicKey> for X25519PublicKey
Implements AsRef<X25519PublicKey> to allow self-reference.
Source§fn as_ref(&self) -> &X25519PublicKey
fn as_ref(&self) -> &X25519PublicKey
Source§impl CBORTagged for X25519PublicKey
Implements the CBORTagged trait to provide CBOR tag information.
impl CBORTagged for X25519PublicKey
Implements the CBORTagged trait to provide CBOR tag information.
Source§impl CBORTaggedDecodable for X25519PublicKey
Implements CBORTaggedDecodable to provide CBOR decoding functionality.
impl CBORTaggedDecodable for X25519PublicKey
Implements CBORTaggedDecodable to provide CBOR decoding functionality.
Source§fn from_untagged_cbor(untagged_cbor: CBOR) -> Result<Self>
fn from_untagged_cbor(untagged_cbor: CBOR) -> Result<Self>
Source§fn from_tagged_cbor(cbor: CBOR) -> Result<Self, Error>where
Self: Sized,
fn from_tagged_cbor(cbor: CBOR) -> Result<Self, Error>where
Self: Sized,
Source§impl CBORTaggedEncodable for X25519PublicKey
Implements CBORTaggedEncodable to provide CBOR encoding functionality.
impl CBORTaggedEncodable for X25519PublicKey
Implements CBORTaggedEncodable to provide CBOR encoding functionality.
Source§fn untagged_cbor(&self) -> CBOR
fn untagged_cbor(&self) -> CBOR
Source§fn tagged_cbor(&self) -> CBOR
fn tagged_cbor(&self) -> CBOR
Source§impl Clone for X25519PublicKey
impl Clone for X25519PublicKey
Source§fn clone(&self) -> X25519PublicKey
fn clone(&self) -> X25519PublicKey
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for X25519PublicKey
Implements Debug to output the key with a type label.
impl Debug for X25519PublicKey
Implements Debug to output the key with a type label.
Source§impl Display for X25519PublicKey
impl Display for X25519PublicKey
Source§impl Encrypter for X25519PublicKey
Implements the Encrypter trait to support key encapsulation mechanisms.
impl Encrypter for X25519PublicKey
Implements the Encrypter trait to support key encapsulation mechanisms.
Source§fn encapsulation_public_key(&self) -> EncapsulationPublicKey
fn encapsulation_public_key(&self) -> EncapsulationPublicKey
Source§impl<'a> From<&'a X25519PublicKey> for &'a [u8; 32]
Implements conversion from an X25519PublicKey reference to a byte array
reference.
impl<'a> From<&'a X25519PublicKey> for &'a [u8; 32]
Implements conversion from an X25519PublicKey reference to a byte array reference.
Source§fn from(value: &'a X25519PublicKey) -> Self
fn from(value: &'a X25519PublicKey) -> Self
Source§impl From<&X25519PublicKey> for Vec<u8>
Implements conversion from an X25519PublicKey reference to a byte vector.
impl From<&X25519PublicKey> for Vec<u8>
Implements conversion from an X25519PublicKey reference to a byte vector.
Source§fn from(key: &X25519PublicKey) -> Self
fn from(key: &X25519PublicKey) -> Self
Source§impl From<&X25519PublicKey> for X25519PublicKey
Implements conversion from an X25519PublicKey reference to an owned
X25519PublicKey.
impl From<&X25519PublicKey> for X25519PublicKey
Implements conversion from an X25519PublicKey reference to an owned X25519PublicKey.
Source§fn from(key: &X25519PublicKey) -> Self
fn from(key: &X25519PublicKey) -> Self
Source§impl From<Rc<X25519PublicKey>> for X25519PublicKey
Implements conversion from a reference-counted X25519PublicKey to an owned
X25519PublicKey.
impl From<Rc<X25519PublicKey>> for X25519PublicKey
Implements conversion from a reference-counted X25519PublicKey to an owned X25519PublicKey.
Source§fn from(value: Rc<X25519PublicKey>) -> Self
fn from(value: Rc<X25519PublicKey>) -> Self
Source§impl From<X25519PublicKey> for CBOR
Implements conversion from X25519PublicKey to CBOR for serialization.
impl From<X25519PublicKey> for CBOR
Implements conversion from X25519PublicKey to CBOR for serialization.
Source§fn from(value: X25519PublicKey) -> Self
fn from(value: X25519PublicKey) -> Self
Source§impl From<X25519PublicKey> for Vec<u8>
Implements conversion from an X25519PublicKey to a byte vector.
impl From<X25519PublicKey> for Vec<u8>
Implements conversion from an X25519PublicKey to a byte vector.
Source§fn from(key: X25519PublicKey) -> Self
fn from(key: X25519PublicKey) -> Self
Source§impl Hash for X25519PublicKey
impl Hash for X25519PublicKey
Source§impl PartialEq for X25519PublicKey
impl PartialEq for X25519PublicKey
Source§impl ReferenceProvider for X25519PublicKey
Implements ReferenceProvider to provide a unique reference for the key.
impl ReferenceProvider for X25519PublicKey
Implements ReferenceProvider to provide a unique reference for the key.
Source§fn reference(&self) -> Reference
fn reference(&self) -> Reference
Source§fn ref_hex_short(&self) -> String
fn ref_hex_short(&self) -> String
Source§impl TryFrom<CBOR> for X25519PublicKey
Implements TryFrom<CBOR> for X25519PublicKey to support conversion from
CBOR data.
impl TryFrom<CBOR> for X25519PublicKey
Implements TryFrom<CBOR> for X25519PublicKey to support conversion from
CBOR data.
impl Eq for X25519PublicKey
impl StructuralPartialEq for X25519PublicKey
Auto Trait Implementations§
impl Freeze for X25519PublicKey
impl RefUnwindSafe for X25519PublicKey
impl Send for X25519PublicKey
impl Sync for X25519PublicKey
impl Unpin for X25519PublicKey
impl UnwindSafe for X25519PublicKey
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
Source§impl<T> CBORDecodable for T
impl<T> CBORDecodable for T
Source§impl<T> CBOREncodable for T
impl<T> CBOREncodable for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
self into the result. Lower case
letters are used (e.g. f9b4ca)Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
self into the result. Upper case
letters are used (e.g. F9B4CA)