[−][src]Struct ed25519_dalek::PublicKey
An ed25519 public key.
Methods
impl PublicKey
[src]
impl PublicKey
pub fn to_bytes(&self) -> [u8; 32]
[src]
pub fn to_bytes(&self) -> [u8; 32]
Convert this public key to a byte array.
pub fn as_bytes<'a>(&'a self) -> &'a [u8; 32]
[src]
pub fn as_bytes<'a>(&'a self) -> &'a [u8; 32]
View this public key as a byte array.
pub fn from_bytes(bytes: &[u8]) -> Result<PublicKey, SignatureError>
[src]
pub fn from_bytes(bytes: &[u8]) -> Result<PublicKey, SignatureError>
Construct a PublicKey
from a slice of bytes.
Warning
The caller is responsible for ensuring that the bytes passed into this
method actually represent a curve25519_dalek::curve::CompressedEdwardsY
and that said compressed point is actually a point on the curve.
Example
use ed25519_dalek::PublicKey; use ed25519_dalek::PUBLIC_KEY_LENGTH; use ed25519_dalek::SignatureError; let public_key_bytes: [u8; PUBLIC_KEY_LENGTH] = [ 215, 90, 152, 1, 130, 177, 10, 183, 213, 75, 254, 211, 201, 100, 7, 58, 14, 225, 114, 243, 218, 166, 35, 37, 175, 2, 26, 104, 247, 7, 81, 26]; let public_key = PublicKey::from_bytes(&public_key_bytes)?;
Returns
A Result
whose okay value is an EdDSA PublicKey
or whose error value
is an SignatureError
describing the error that occurred.
pub fn from_secret<D>(secret_key: &SecretKey) -> PublicKey where
D: Digest<OutputSize = U64> + Default,
[src]
pub fn from_secret<D>(secret_key: &SecretKey) -> PublicKey where
D: Digest<OutputSize = U64> + Default,
Derive this public key from its corresponding SecretKey
.
pub fn from_expanded_secret(
expanded_secret_key: &ExpandedSecretKey
) -> PublicKey
[src]
pub fn from_expanded_secret(
expanded_secret_key: &ExpandedSecretKey
) -> PublicKey
Derive this public key from its corresponding ExpandedSecretKey
.
pub fn verify<D>(
&self,
message: &[u8],
signature: &Signature
) -> Result<(), SignatureError> where
D: Digest<OutputSize = U64> + Default,
[src]
pub fn verify<D>(
&self,
message: &[u8],
signature: &Signature
) -> Result<(), SignatureError> where
D: Digest<OutputSize = U64> + Default,
Verify a signature on a message with this keypair's public key.
Return
Returns Ok(())
if the signature is valid, and Err
otherwise.
pub fn verify_prehashed<D>(
&self,
prehashed_message: D,
context: Option<&[u8]>,
signature: &Signature
) -> Result<(), SignatureError> where
D: Digest<OutputSize = U64> + Default,
[src]
pub fn verify_prehashed<D>(
&self,
prehashed_message: D,
context: Option<&[u8]>,
signature: &Signature
) -> Result<(), SignatureError> where
D: Digest<OutputSize = U64> + Default,
Verify a signature
on a prehashed_message
using the Ed25519ph algorithm.
Inputs
prehashed_message
is an instantiated hash digest with 512-bits of output which has had the message to be signed previously fed into its state.context
is an optional context string, up to 255 bytes inclusive, which may be used to provide additional domain separation. If not set, this will default to an empty string.signature
is a purported Ed25519phSignature
on theprehashed_message
.
Returns
Returns true
if the signature
was a valid signature created by this
Keypair
on the prehashed_message
.
Trait Implementations
impl From<ExpandedSecretKey> for PublicKey
[src]
impl From<ExpandedSecretKey> for PublicKey
fn from(source: ExpandedSecretKey) -> PublicKey
[src]
fn from(source: ExpandedSecretKey) -> PublicKey
Performs the conversion.
impl Debug for PublicKey
[src]
impl Debug for PublicKey
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl PartialEq<PublicKey> for PublicKey
[src]
impl PartialEq<PublicKey> for PublicKey
fn eq(&self, other: &PublicKey) -> bool
[src]
fn eq(&self, other: &PublicKey) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &PublicKey) -> bool
[src]
fn ne(&self, other: &PublicKey) -> bool
This method tests for !=
.
impl Eq for PublicKey
[src]
impl Eq for PublicKey
impl Copy for PublicKey
[src]
impl Copy for PublicKey
impl Clone for PublicKey
[src]
impl Clone for PublicKey
fn clone(&self) -> PublicKey
[src]
fn clone(&self) -> PublicKey
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Default for PublicKey
[src]
impl Default for PublicKey
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
type Owned = T
fn to_owned(&self) -> T
[src]
fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
fn clone_into(&self, target: &mut T)
[src]
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T> Clear for T where
T: InitializableFromZeroed + ?Sized,
[src]
impl<T> Clear for T where
T: InitializableFromZeroed + ?Sized,
impl<T> InitializableFromZeroed for T where
T: Default,
[src]
impl<T> InitializableFromZeroed for T where
T: Default,
unsafe fn initialize(place: *mut T)
[src]
unsafe fn initialize(place: *mut T)
Called to initialize a place to a valid value, after it is set to all-bits-zero. Read more
impl<T> Same for T
impl<T> Same for T
type Output = T
Should always be Self