Skip to main content

Crate blind_rsa_signatures

Crate blind_rsa_signatures 

Source
Expand description

Author-blinded RSASSA-PSS RSAE signatures.

This is an implementation of the RSA Blind Signatures (RFC 9474), based on the Zig implementation.

use blind_rsa_signatures::{KeyPair, Sha384, PSS, Randomized, DefaultRng};

// [SERVER]: Generate a RSA-2048 key pair
let kp = KeyPair::<Sha384, PSS, Randomized>::generate(&mut DefaultRng, 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(&mut DefaultRng, msg)?;

// [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_message)?;

// [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, msg)?;

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

Modules§

reexports

Structs§

BlindMessage
A blind message
BlindRsa
Blind RSA signatures with compile-time parameters.
BlindSignature
A blind signature
BlindingResult
Result of a blinding operation
DefaultRng
Default random number generator
Deterministic
Deterministic message preparation
KeyPair
An RSA key pair
MessageRandomizer
A message randomizer (noise added as a prefix to the message)
PSS
PSS mode with salt (salt length = hash output length)
PSSZero
PSS mode without salt (salt length = 0)
PublicKey
An RSA public key
Randomized
Randomized message preparation
Secret
A blinding secret factor
SecretKey
An RSA secret key
Sha256
SHA-256 hash algorithm
Sha384
SHA-384 hash algorithm
Sha512
SHA-512 hash algorithm
Signature
A (non-blind) signature

Enums§

Error

Traits§

HashAlgorithm
MessagePrepare
Trait for message preparation mode (compile-time parameter) The only valid implementations are Randomized and Deterministic.
SaltMode
Trait for PSS salt mode (compile-time parameter) The only valid implementations are PSS and PSSZero.

Type Aliases§

BlindRsaKeyPair
Type alias for KeyPair with the same parameters as BlindRsa
BlindRsaPublicKey
Type alias for PublicKey with the same parameters as BlindRsa
BlindRsaSecretKey
Type alias for SecretKey with the same parameters as BlindRsa
BlindRsaSha384PSSDeterministic
RSABSSA-SHA384-PSS-Deterministic
BlindRsaSha384PSSRandomized
RSABSSA-SHA384-PSS-Randomized (RFC 9474 recommended)
BlindRsaSha384PSSZeroDeterministic
RSABSSA-SHA384-PSSZERO-Deterministic
BlindRsaSha384PSSZeroRandomized
RSABSSA-SHA384-PSSZERO-Randomized
KeyPairSha384PSSDeterministic
Key pair for RSABSSA-SHA384-PSS-Deterministic
KeyPairSha384PSSRandomized
Key pair for RSABSSA-SHA384-PSS-Randomized (RFC 9474 recommended)
KeyPairSha384PSSZeroDeterministic
Key pair for RSABSSA-SHA384-PSSZERO-Deterministic
KeyPairSha384PSSZeroRandomized
Key pair for RSABSSA-SHA384-PSSZERO-Randomized
PublicKeySha384PSSDeterministic
Public key for RSABSSA-SHA384-PSS-Deterministic
PublicKeySha384PSSRandomized
Public key for RSABSSA-SHA384-PSS-Randomized (RFC 9474 recommended)
PublicKeySha384PSSZeroDeterministic
Public key for RSABSSA-SHA384-PSSZERO-Deterministic
PublicKeySha384PSSZeroRandomized
Public key for RSABSSA-SHA384-PSSZERO-Randomized
SecretKeySha384PSSDeterministic
Secret key for RSABSSA-SHA384-PSS-Deterministic
SecretKeySha384PSSRandomized
Secret key for RSABSSA-SHA384-PSS-Randomized (RFC 9474 recommended)
SecretKeySha384PSSZeroDeterministic
Secret key for RSABSSA-SHA384-PSSZERO-Deterministic
SecretKeySha384PSSZeroRandomized
Secret key for RSABSSA-SHA384-PSSZERO-Randomized