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.
| Selector | Hash | Salt | Message randomizer |
|---|---|---|---|
BLIND_RSA.SHA384_PSS_RANDOMIZED | SHA-384 | 48 bytes | 32 bytes |
BLIND_RSA.SHA384_PSSZERO_RANDOMIZED | SHA-384 | none | 32 bytes |
BLIND_RSA.SHA384_PSS_DETERMINISTIC | SHA-384 | 48 bytes | none |
BLIND_RSA.SHA384_PSSZERO_DETERMINISTIC | SHA-384 | none | none |
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_derandload_private_pemread PKCS#8 or PKCS#1.load_public_derandload_public_pemread SPKI or PKCS#1.to_der(*, format=...)andto_pem(*, format=...)write"pkcs8"(the default) or"pkcs1"for private keys, and"spki"(the default) or"pkcs1"for public keys. PEM is returned asbytes.verifyreturnsbool. A missing randomizer for a randomized variant, a randomizer for a deterministic variant, or a randomizer that is not 32 bytes raisesValueError.- The selector is not part of the key encoding. Signer and client must agree on it out of band.
| Standard | RFC 9474 (Informational, IRTF CFRG) |
| Crate | blind-rsa-signatures 0.19.0, pre-1.0, on RustCrypto rsa 0.10.0 (hazmat feature) and crypto-bigint 0.7 |
| Audit | No published audit of blind-rsa-signatures or rsa 0.10 |
| MSRV | blind-rsa-signatures declares none; rsa 0.10.0 declares 1.87. Builds with the project MSRV 1.88 |
| Experimental | Yes (pre-1.0 crate) |
| Test vectors | RFC 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
rsaprivate key drop handler zeroizes the private exponent and the primes.rsa0.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-signaturesstores the blinding inverse in a plainVec<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
blindandfinalize, and the intermediate values of the RSA private-key operation.