Struct ed25519_dalek::PublicKey[][src]

#[repr(C)]
pub struct PublicKey(_);

An ed25519 public key.

Methods

impl PublicKey
[src]

Convert this public key to a byte array.

View this public key as a byte array.

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.

Derive this public key from its corresponding SecretKey.

Verify a signature on a message with this keypair's public key.

Return

Returns Ok(()) if the signature is valid, and Err otherwise.

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 Ed25519ph Signature on the prehashed_message.

Returns

Returns true if the signature was a valid signature created by this Keypair on the prehashed_message.

Trait Implementations

impl Copy for PublicKey
[src]

impl Clone for PublicKey
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Eq for PublicKey
[src]

impl PartialEq for PublicKey
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Debug for PublicKey
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for PublicKey

impl Sync for PublicKey