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
sourceimpl 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
sourceimpl<'de> Deserialize<'de> for PublicKey
Available on crate feature serde
only.
impl<'de> Deserialize<'de> for PublicKey
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.
sourcefn 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
sourceimpl Serialize for PublicKey
Available on crate feature serde
only.
impl Serialize for PublicKey
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.
sourceimpl 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.
sourcefn try_from(private_key: &PrivateKey) -> Result<Self, Self::Error>
fn try_from(private_key: &PrivateKey) -> Result<Self, Self::Error>
Performs the conversion.
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more