pub struct PublicKey { /* private fields */ }
Expand description
A type that represents a PublicKey
that X25519 uses.
This type holds a field element and is used internally as the u-coordinate. As the RFC mandates, the most significant bit of the last byte is masked.
Errors:
An error will be returned if:
slice
is not 32 bytes.
Implementations§
source§impl PublicKey
impl PublicKey
sourcepub fn from_slice(slice: &[u8]) -> Result<Self, UnknownCryptoError>
pub fn from_slice(slice: &[u8]) -> Result<Self, UnknownCryptoError>
Construct from a given byte slice.
Trait Implementations§
source§impl<'de> Deserialize<'de> for PublicKey
Available on crate feature serde
only.
impl<'de> Deserialize<'de> for PublicKey
Available on crate feature
serde
only.This type tries to deserialize as a Vec<u8>
would. If it succeeds, the digest
will be built using Self::from_slice
.
Note that this allocates once to store the referenced bytes on the heap.
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 PartialEq<&[u8]> for PublicKey
impl PartialEq<&[u8]> for PublicKey
source§impl PartialEq<PublicKey> for PublicKey
impl PartialEq<PublicKey> for PublicKey
source§impl Serialize for PublicKey
Available on crate feature serde
only.
impl Serialize for PublicKey
Available on crate feature
serde
only.This type tries to serialize as a &[u8]
would. Note that the serialized
type likely does not have the same protections that Orion provides, such
as constant-time operations. A good rule of thumb is to only serialize
these types for storage. Don’t operate on the serialized types.
source§impl TryFrom<&PrivateKey> for PublicKey
impl TryFrom<&PrivateKey> for PublicKey
§type Error = UnknownCryptoError
type Error = UnknownCryptoError
The type returned in the event of a conversion error.
impl StructuralPartialEq for PublicKey
Auto Trait Implementations§
impl RefUnwindSafe for PublicKey
impl Send for PublicKey
impl Sync for PublicKey
impl Unpin for PublicKey
impl UnwindSafe for PublicKey
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