RustCrypto: Signatures

repository·master·Indexed 20 days ago

https://github.com/rustcrypto/signatures

A collection of Rust crates providing various digital signature algorithms, including DSA, ECDSA, Ed25519, Ed448, LMS, ML-DSA, SLH-DSA, and XMSS. The library uses a unified trait-based interface from the `signature` crate and supports `no_std` for bare-metal and WebAssembly environments. It includes specialized crates like `rfc6979` for deterministic signatures and `bign-genk` for the STB 34.101.45 standard.

Tokens
33.8K
Snippets
124
Records
165
Agent score
70%

What's inside rustcrypto-signatures

  1. Overview of SLH-DSA (SPHINCS+)

    master

    The slh-dsa crate provides a pure Rust implementation of the SLH-DSA (formerly known as SPHINCS+) signature scheme. This implementation is based on the [FIPS-205 Standard].

    ⚠️ Security Warning: This implementation has never been independently audited. Use it at your own risk.

  2. Overview of bign-genk

    master
    The bign-genk crate provides a pure Rust implementation of the STB 34.101.45 standard. It enables deterministic usage of the Digital Signature Algorithm (DSA) and the Elliptic Curve Digital Signature Algorithm (ECDSA), as described in STB 34.101.45-2013 § 6.3.
  3. Overview of RustCrypto: Signatures

    master

    RustCrypto: Signatures provides support for digital signatures using public-key cryptography. The project is a collection of individual crates, each implementing a specific signature algorithm.

    Key characteristics:

    • Trait-based API: All algorithms are implemented using traits from the signature crate, ensuring a consistent interface across different algorithms.
    • no_std support: Crates are designed to work without the Rust standard library, making them suitable for bare-metal environments or WebAssembly (Wasm).
  4. Use the DSA implementation in Rust

    master
    The dsa crate provides a pure Rust implementation of the Digital Signature Algorithm (DSA) as specified in FIPS 186-4. It integrates with the signature crate, meaning you can use standard Signer and Verifier traits to create and verify signatures.
  5. Understand the role of the ed25519 crate

    master

    The ed25519 crate does not provide a standalone implementation of the Ed25519 algorithm. Instead, it provides the ed25519::Signature type.

    This type is designed to be used with the signature::Signer and signature::Verifier traits from the signature crate. This abstraction allows you to write code that consumes or produces Ed25519 signatures without being tied to a specific implementation, making it easy to swap in different providers such as Hardware Security Modules (HSMs) or Cloud KMS services.

  6. How to use RustCrypto signature crates

    master

    To use these crates, you should interact with them through the traits defined in the signature crate. This allows you to write code that is generic over different signature algorithms.

    When adding a crate to your project, ensure you also include the signature crate to access the necessary traits for signing and verification.

  7. Understand the role of the ed448 crate

    master

    The ed448 crate does not provide a full implementation of the Ed448 algorithm. Instead, it provides the ed448::Signature type. This type is designed to be used by other crates that implement the Ed448 algorithm in conjunction with the signature::Signer and signature::Verifier traits.

    This design allows you to write code that produces or consumes Ed448 signatures abstractly. By using these traits, you can swap out different signer/verifier providers (such as different software implementations, HSMs, or Cloud KMS services) without changing your core logic.

  8. How to use the ECDSA crate

    master

    The ecdsa crate provides a generic implementation of the Elliptic Curve Digital Signature Algorithm (ECDSA) as specified in FIPS 186-4. Because it is a generic implementation, it cannot be used in isolation; it must be paired with a crate that provides concrete arithmetic for a specific elliptic curve.

    Common Usage Patterns

    1. Using with specific curve crates: You can use this crate alongside the following curve implementations:

      • k256 (secp256k1)
      • p256 (NIST P-256)
      • p384 (NIST P-384)
    2. Interoperability for custom implementations: If you are building a custom ECDSA implementation, you can leverage ecdsa::Signature along with the signature::Signer and signature::Verifier traits to ensure your implementation is generic and interoperable with the rest of the RustCrypto ecosystem.

  9. Use ed448::Signature with Signer and Verifier traits

    master

    To work with Ed448 signatures, use the ed448::Signature type alongside the standard signature crate traits. This enables interoperability between different Ed448 providers.

    Key components:

    • ed448::Signature: The data type representing an Ed448 signature.
    • signature::Signer: The trait used for creating signatures.
    • signature::Verifier: The trait used for validating signatures.
  10. Install the rfc6979 crate

    master

    The rfc6979 crate provides a pure Rust implementation of RFC 6979, which enables deterministic usage of the Digital Signature Algorithm (DSA) and Elliptic Curve Digital Signature Algorithm (ECDSA). This ensures that signatures are generated deterministically from the private key and the message, mitigating risks associated with poor entropy during signature generation.

    Minimum Supported Rust Version (MSRV): This crate requires Rust 1.85 or higher.