Skip to main content

Module eddsa

Module eddsa 

Source
Expand description

EdDSA (Edwards-curve Digital Signature Algorithm) implementations

This module provides an Ed25519 adapter backed by ed25519-dalek, with strict verification and additional canonical/subgroup input validation. This description is not an independent audit or production-safety claim.

§Security Features

  • Immutable secret keys: Prevents accidental key corruption
  • Automatic zeroization: Clears sensitive data from memory
  • Secure API design: Minimal surface area, maximum safety
  • Maintained arithmetic backend: Secret scalar operations are delegated to ed25519-dalek/curve25519-dalek
  • Type safety: Strong typing prevents key confusion

§Features

  • RFC 8032 Ed25519 signing and strict verification
  • Deterministic signature generation
  • Secure key generation and handling
  • Comprehensive input validation
  • Key derivation and persistence support

§Security Guidelines

  1. Always use a CSPRNG: Use rand::rngs::OsRng for key generation
  2. Protect seeds: Encrypt before storage, decrypt only when needed
  3. Verify public keys: Confirm authenticity through secure channels
  4. Clear sensitive data: Automatic for secret keys, manual for seeds

§Example

use dcrypt_sign::eddsa::{Ed25519, Ed25519SecretKey};
use dcrypt_api::Signature;
use rand::rngs::OsRng;

let mut rng = OsRng;

// Generate a new keypair
let (public_key, secret_key) = Ed25519::keypair(&mut rng)?;

// Sign a message
let message = b"Hello, Ed25519!";
let signature = Ed25519::sign(message, &secret_key)?;

// Verify the signature
assert!(Ed25519::verify(message, &signature, &public_key).is_ok());

// Save the secret key seed (encrypt in production!)
let seed = secret_key.seed();

// Later, reconstruct the secret key
let reconstructed_secret = Ed25519SecretKey::from_seed(seed)?;
let reconstructed_public = reconstructed_secret.public_key()?;

// The reconstructed keys work identically
assert_eq!(public_key.0, reconstructed_public.0);

Structs§

Ed25519
Ed25519 signature scheme.
Ed25519PublicKey
Canonically encoded, non-weak Ed25519 public key.
Ed25519SecretKey
Ed25519 secret seed, wiped on drop.
Ed25519Signature
Ed25519 signature bytes (R || S).