[][src]Module signatory::ed25519

Ed25519: Schnorr signatures using the twisted Edwards form of Curve25519

Described in RFC 8032: https://tools.ietf.org/html/rfc8032

This module contains two convenience methods for signing and verifying Ed25519 signatures which work with any signer or verifier.

Example (with ed25519-dalek)

extern crate signatory;
extern crate signatory_dalek; // or another Ed25519 provider

use signatory::ed25519;
use signatory_dalek::{Ed25519Signer, Ed25519Verifier};

// Create a private key (a.k.a. a "seed") and use it to generate a signature
let seed = ed25519::Seed::generate();
let signer = Ed25519Signer::from(&seed);
let msg = "How are you? Fine, thank you.";

// Sign a message
let sig = ed25519::sign(&signer, msg.as_bytes()).unwrap();

// Get the public key for the given signer and make a verifier
let pk = ed25519::public_key(&signer).unwrap();
let verifier = Ed25519Verifier::from(&pk);
assert!(ed25519::verify(&verifier, msg.as_bytes(), &sig).is_ok());

Structs

PublicKey

Ed25519 public keys

Seed

Ed25519 seeds: derivation secrets for Ed25519 private scalars/nonce prefixes

Signature

Ed25519 signatures

Constants

PUBLIC_KEY_SIZE

Size of an Ed25519 public key in bytes (256-bits)

SEED_SIZE

Size of the "seed" value for an Ed25519 private key

SIGNATURE_SIZE

Size of an Ed25519 signature in bytes (512-bits)

Functions

public_key

Get the public key for the given public keyed object (i.e. a Signer)

sign

Sign the given message slice with the given Ed25519 signer

verify

Verify the given message slice with the given Ed25519 verifier