#crypto #rsa #blind #signatures

blind-rsa-signatures

RSA blind signatures in pure Rust

17 releases

0.13.0 Jul 2, 2022
0.12.6 Feb 4, 2022
0.12.5 Jan 31, 2022
0.12.3 Jul 30, 2021
0.9.0 Feb 26, 2021

#1 in #blind

Download history 199/week @ 2022-06-04 142/week @ 2022-06-11 53/week @ 2022-06-18 108/week @ 2022-06-25 106/week @ 2022-07-02 133/week @ 2022-07-09 119/week @ 2022-07-16 150/week @ 2022-07-23 108/week @ 2022-07-30 67/week @ 2022-08-06 54/week @ 2022-08-13 30/week @ 2022-08-20 73/week @ 2022-08-27 74/week @ 2022-09-03 100/week @ 2022-09-10 73/week @ 2022-09-17

324 downloads per month

MIT license

24KB
506 lines

GitHub CI Docs.rs crates.io

Blind RSA signatures

Author-blinded RSASSA-PSS RSAE signatures.

This is an implementation of the RSA Blind Signatures IETF draft, based on the Zig implementation.

Protocol overview

A client asks a server to sign a message. The server receives the message, and returns the signature.

Using that (message, signature) pair, the client can locally compute a second, valid (message', signature') pair.

Anyone can verify that (message', signature') is valid for the server's public key, even though the server didn't see that pair before. But no one besides the client can link (message', signature') to (message, signature).

Using that scheme, a server can issue a token and verify that a client has a valid token, without being able to link both actions to the same client.

  1. The client creates a random message, and blinds it with a random, secret factor.
  2. The server receives the blind message, signs it and returns a blind signature.
  3. From the blind signature, and knowing the secret factor, the client can locally compute a (message, signature) pair that can be verified using the server's public key.
  4. Anyone, including the server, can thus later verify that (message, signature) is valid, without knowing when step 2 occurred.

The scheme was designed by David Chaum, and was originally implemented for anonymizing DigiCash transactions.

Usage

    // Options: hash function and deterministic padding
    let options = Options::default();

    // [SERVER]: Generate a RSA-2048 key pair
    let kp = KeyPair::generate(2048)?;
    let (pk, sk) = (kp.pk, kp.sk);

    // [CLIENT]: create a random message and blind it for the server whose public key is `pk`.
    // The client must store the message and the secret.
    let msg = b"test";
    let blinding_result = pk.blind(msg, &options)?;

    // [SERVER]: compute a signature for a blind message, to be sent to the client.
    // The client secret should not be sent to the server.
    let blind_sig = sk.blind_sign(&blinding_result.blind_msg)?;

    // [CLIENT]: later, when the client wants to redeem a signed blind message,
    // using the blinding secret, it can locally compute the signature of the
    // original message.
    // The client then owns a new valid (message, signature) pair, and the
    // server cannot link it to a previous(blinded message, blind signature) pair.
    // Note that the finalization function also verifies that the new signature
    // is correct for the server public key.
    let sig = pk.finalize(&blind_sig, &blinding_result.secret, &msg, &options)?;

    // [SERVER]: a non-blind signature can be verified using the server's public key.
    sig.verify(&pk, msg, &options)?

This crate also includes utility functions to import and export keys.

For other languages

Dependencies

~4MB
~84K SLoC