Skip to Content
oxcrypto

RSA blind signatures

RFC 9474 RSABSSA-SHA384 blind signatures.

Warning

Experimental: blind-rsa-signatures is a pre-1.0 crate with no published audit.

from oxcrypto.signature.blind_rsa import BLIND_RSA

alg = BLIND_RSA.SHA384_PSS_RANDOMIZED
private_key = alg.generate(bits=2048)
public_key = private_key.public_key()

# Client: blind the message and send blinding.blinded_message to the signer.
blinding = public_key.blind(b"message")
# Signer: sign the blinded message without learning the message.
blind_signature = private_key.blind_sign(blinding.blinded_message)
# Client: unblind. finalize verifies the result and consumes the blinding.
signature = blinding.finalize(blind_signature)
assert public_key.verify(signature, b"message", randomizer=blinding.randomizer)

In a blind signature protocol a client gets a signer's RSA-PSS signature on a message the signer never sees. The signer cannot later link a signature to the signing request that produced it.

SelectorHashSaltMessage randomizer
BLIND_RSA.SHA384_PSS_RANDOMIZEDSHA-38448 bytes32 bytes
BLIND_RSA.SHA384_PSSZERO_RANDOMIZEDSHA-384none32 bytes
BLIND_RSA.SHA384_PSS_DETERMINISTICSHA-38448 bytesnone
BLIND_RSA.SHA384_PSSZERO_DETERMINISTICSHA-384nonenone

RFC 9474 recommends SHA384_PSS_RANDOMIZED and SHA384_PSSZERO_RANDOMIZED. For the randomized variants, blind picks a random 32-byte prefix for the message. Verifiers need it, so send blinding.randomizer with the signature and pass it to verify(..., randomizer=...). Deterministic variants take no randomizer.

  • generate(*, bits=2048) makes a key with a 2048- to 4096-bit modulus from the operating system's random source.
  • load_private_der and load_private_pem read PKCS#8 or PKCS#1. load_public_der and load_public_pem read SPKI or PKCS#1.
  • to_der(*, format=...) and to_pem(*, format=...) write "pkcs8" (the default) or "pkcs1" for private keys, and "spki" (the default) or "pkcs1" for public keys. PEM is returned as bytes.
  • verify returns bool. A missing randomizer for a randomized variant, a randomizer for a deterministic variant, or a randomizer that is not 32 bytes raises ValueError.
  • The selector is not part of the key encoding. Signer and client must agree on it out of band.
StandardRFC 9474 (Informational, IRTF CFRG)
Crateblind-rsa-signatures 0.19.0, pre-1.0, on RustCrypto rsa 0.10.0 (hazmat feature) and crypto-bigint 0.7
AuditNo published audit of blind-rsa-signatures or rsa 0.10
MSRVblind-rsa-signatures declares none; rsa 0.10.0 declares 1.87. Builds with the project MSRV 1.88
ExperimentalYes (pre-1.0 crate)
Test vectorsRFC 9474 Appendix A, all four variants (blind signing and verification; blinding is randomized, so blinded messages are checked by round trip)

rsa 0.10 does its private-key arithmetic with crypto-bigint, which is written to run in constant time; oxcrypto has not verified this independently.

Important

A BlindRSABlinding is single-use: finalize consumes it, and a second call raises ValueError. A blind signature that does not verify also raises ValueError.

Zeroization

Note

Read from the blind-rsa-signatures 0.19.0 and rsa 0.10.0 sources; oxcrypto has not verified it independently. Python bytes passed in or returned are not wiped.

  • The rsa private key drop handler zeroizes the private exponent and the primes. rsa 0.10 does not zeroize its cached CRT values, so oxcrypto drops them when a key is generated or loaded, and blind signing uses the slower non-CRT path.
  • blind-rsa-signatures stores the blinding inverse in a plain Vec<u8>. oxcrypto wipes it when the blinding is finalized or dropped, and keeps its copy of the message in a buffer that is wiped on drop. Private-key DER and PEM output is built in zeroizing buffers before it is copied to Python.
  • Short-lived copies during a call are not wiped: the blinding factor and its inverse as big integers inside blind and finalize, and the intermediate values of the RSA private-key operation.

On this page