Documentation

CslibFrontier.Crypto.Computational.RSASignature

RSA signatures on a digest #

[BS23], Section 13.3.1, signs a message m with the RSA key (n, d) as σ := H(m) ^ d ∈ ℤ_n and accepts σ on m when σ ^ e = H(m). rsaSignature desc H is this Signature.Scheme for the key desc and any digest function H : M → ℕ, and unhashedRSASignature desc is the unhashed RSA system of p. 537, which signs a residue m : Fin N directly.

The scheme is the scheme of one key: key generation returns desc, where the book's key generator runs RSAGen(ℓ, e). Every statement about it holds for every key, so it holds for a key drawn from any law first, as rsaInversionGame draws its key. Signatures are natural numbers, and verify accepts σ on m when σ < N and σ ^ e % N = H m % N; the book takes σ ∈ ℤ_n and compares σ ^ e with H(m), whose range it describes as "embedded in ℤ_n".

Main definitions #

Main results #

References #

RSA signatures on a digest, for the key desc and the digest function H ([BS23], Section 13.3.1): the signature on m is H m ^ d % N, and σ is accepted on m when σ < N and σ ^ e % N = H m % N. Key generation returns the fixed key.

@[reducible, inline]

The unhashed RSA system ([BS23], p. 537): the messages are the residues modulo N and the signature on m is m ^ d % N.

@[simp]
theorem Cslib.Crypto.rsaSignature_verify_iff {M : Type} (desc : RSADesc) (H : M → ℕ) (pk : RSAPublicKey) (m : M) (σ : ℕ) :
(rsaSignature desc H).verify pk m σ = true ↔ σ < pk.N ∧ rsaEval pk.N pk.e σ = H m % pk.N

The verification test of rsaSignature: σ < N and σ ^ e % N = H m % N.

theorem Cslib.Crypto.rsaSignature_correct {M : Type} (desc : RSADesc) (H : M → ℕ) :

Every signature of rsaSignature verifies.