Crate signatory[][src]

Signatory: a multi-provider digital signature library

This crate provides a thread-and-object-safe API for both creating and verifying elliptic curve digital signatures, using either software-based or hardware-based providers.

ECDSA (FIPS 186-4) and Ed25519 (RFC 8032) are the supported digital signature algorithms.

There are several backend providers available, which are each available in their own crates:

  • signatory-dalek: Ed25519 signing/verification using the pure-Rust ed25519-dalek crate. This provider is enabled-by-default.
  • signatory-ring: Ed25519 signing/verification with the ring cryptography library.
  • signatory-secp256k1: ECDSA signing/verification for the secp256k1 elliptic curve (commonly used by Bitcoin and other cryptocurrrencies) which wraps the libsecp256k1 library from Bitcoin Core.
  • signatory-sodiumoxide: Ed25519 signing/verification with the sodiumoxide crate, a Rust wrapper for libsodium (NOTE: requires libsodium to be installed on the system)
  • signatory-yubihsm: Ed25519 signing-only provider using private keys stored in a YubiHSM2 hardware device, via the yubihsm-rs crate.

Re-exports

pub extern crate digest;
pub extern crate generic_array;
pub use error::Error;
pub use error::ErrorKind;

Modules

curve

Elliptic Curves (presently Weierstrass form only)

ecdsa

The Elliptic Curve Digital Signature Algorithm (ECDSA) as specified in FIPS 186-4 (Digital Signature Standard)

ed25519

Ed25519: Schnorr signatures using the twisted Edwards form of Curve25519

encoding

Support for encoding and decoding serialization formats (hex and Base64) with implementations that do not branch on potentially secret data, such as cryptographic keys.

error

Error types

test_vector

Test vector structure for signatures

Macros

ed25519_tests

Structs

Ed25519PublicKey

Ed25519 public keys

Ed25519Seed

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

Ed25519Signature

Ed25519 signatures

Enums

EcdsaPublicKey

ECDSA public keys

Traits

ByteSigner

Trait for signers which accept byte slices as inputs

ByteVerifier

Trait for verifiers which accept byte slices as inputs

Digest

The Digest trait specifies an interface common for digest functions.

DigestSigner

Marker trait for Signer types which take a prehashed Digest as input. The digest cargo feature must be enabled for this to be available.

DigestVerifier

Marker trait for Verifier types which take a prehashed Digest as input. The digest cargo feature must be enabled for this to be available.

EcdsaSignature

Marker trait for ECDSA signatures

FromEd25519Seed

Trait for Ed25519 signers that can be initialized from a seed value

PublicKey

Common trait for all public keys

PublicKeyed

Signers which know their public keys (to be implemented by Signatory providers)

Sha256Signer

Signer which computes SHA-256 digests of messages

Sha256Verifier

Verifier which computes SHA-256 digests of messages

Signature

Common trait for all signatures

Signer

Common trait for all signature providers

Verifier

Common trait for all signature verification providers

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 signer (alias for sign_bytes)

sign_bytes

Sign the given AsRef<[u8]> type with the given signer

sign_digest

Sign the given prehashed Digest with the given signer. This can be used to avoid importing the DigestSigner and Signature traits

sign_sha256

Compute SHA-256 of the given message and then sign the resulting digest. This can be used to avoid importing the Signer and Signature traits

sign_sha384

Compute SHA-384 of the given message and then sign the resulting digest. This can be used to avoid importing the Signer and Signature traits

sign_sha512

Compute SHA-512 of the given message and then sign the resulting digest. This can be used to avoid importing the Signer and Signature traits

verify

Verify the given message slice with the given verifier (alias for verify_bytes)

verify_bytes

Sign the given AsRef<[u8]> type with the given signer

verify_digest

Verify the given prehashed Digest with the given Verifier. This can be used to avoid importing the DigestVerifier and Signature traits

verify_sha256

Verify SHA-256 of the given message and then sign the resulting digest. This can be used to avoid importing the Verifier and Signature traits

verify_sha384

Verify SHA-384 of the given message and then sign the resulting digest. This can be used to avoid importing the Verifier and Signature traits

verify_sha512

Verify SHA-512 of the given message and then sign the resulting digest. This can be used to avoid importing the Verifier and Signature traits