Digital Signatures Scheme

For a very brief theory of digital signature schemes and their analysis, click here

Digital signatures are cryptographic mechanisms that provide authentication, integrity, and non-repudiation for digital documents and messages. Unlike handwritten signatures, digital signatures use mathematical algorithms to ensure that a document hasn't been altered and to verify the identity of the signer. They do not, however, provide confidentiality — encrypting the message content itself for privacy requires a separate encryption step in addition to signing.

How Digital Signatures Work

The digital signature process involves three main phases:

1. Hash Generation: h=H(m)h = H(m) The original message mm is processed through a cryptographic hash function HH (such as SHA-1, used in this experiment, or SHA-256 in modern systems) to create a fixed-size digest hh.

2. Signature Creation: s=Signsk(h)=hdmodns = \text{Sign}_{sk}(h) = h^d \bmod n The hash hh is encrypted using the signer's private key dd to create the digital signature ss.

3. Verification:

Verifypk(m,s)={Validif H(m)=semodnInvalidotherwise \text{Verify}_{pk}(m, s) = \begin{cases} \text{Valid} & \text{if } H(m) = s^e \bmod n \\ \text{Invalid} & \text{otherwise} \end{cases}

Recipients can verify the signature using the signer's public key ee to decrypt the signature and compare it with a freshly computed hash.

Why Hashing Is Essential: Hashing before signing is not just a convenience — it is a security requirement.

  • Efficiency: RSA operations are computationally expensive. Signing a short, fixed-size hash (e.g., 160 or 256 bits) is far cheaper than signing an arbitrarily long message directly, and lets the scheme handle messages of any size, even those larger than the modulus nn.
  • Security against forgery: If a scheme signs the raw message directly, s=mdmodns = m^d \bmod n, RSA's multiplicative structure becomes exploitable. Given two valid signatures s1=m1dmodns_1 = m_1^d \bmod n and s2=m2dmodns_2 = m_2^d \bmod n, an attacker can compute

s1s2modn=(m1m2)dmodns_1 \cdot s_2 \bmod n = (m_1 \cdot m_2)^d \bmod n

which is a valid forged signature for the message m1m2modnm_1 m_2 \bmod nwithout ever knowing the private key dd. A cryptographic hash function is not multiplicative in this way (H(m1)H(m2)modnH(m1m2modn)H(m_1) \cdot H(m_2) \bmod n \neq H(m_1 m_2 \bmod n) in general), so hashing first breaks this algebraic shortcut and is what makes "sign-the-hash" schemes resistant to this class of existential forgery.

RSA-Based Digital Signatures

RSA (Rivest–Shamir–Adleman) is widely used for digital signatures due to its mathematical foundation:

Key Properties:

  • Key Generation: Create a public–private key pair (e,n)(e, n) and (d,n)(d, n)
  • Signing: Encrypt the message hash with the private key: s=H(m)dmodns = H(m)^d \bmod n
  • Verification: Decrypt the signature with the public key: H(m)=?semodnH(m) \stackrel{?}{=} s^e \bmod n

Note: This experiment focuses on RSA-based signatures. This should not be confused with the NIST Digital Signature Algorithm (DSA), a separate, distinct signature scheme based on the discrete logarithm problem rather than integer factorization — DSA is not used in this experiment.

RSA Security Assumption: The security of RSA digital signatures relies on the believed difficulty of the Integer Factorization Problem: Given n=p×q, find p and q\text{Given } n = p \times q \text{, find } p \text{ and } q

More precisely, forging signatures without dd requires solving the RSA problem — computing ee-th roots modulo nn — which is at least as easy as factoring nn, though whether it is exactly as hard as factoring remains an open question in cryptography.

Trapdoor Function: RSA uses a trapdoor one-way function:

  • Easy direction (for anyone): Computing y=xemodny = x^e \bmod n is efficient using only the public key (e,n)(e, n).
  • Easy direction (with the trapdoor): If you know the private exponent dd — the "trapdoor" — recovering x=ydmodnx = y^d \bmod n is equally efficient.
  • Hard direction (without the trapdoor): Given only yy, ee, and nn, and without knowing dd or the factorization of nn, finding xx such that xey(modn)x^e \equiv y \pmod{n} is believed to be computationally infeasible for sufficiently large nn.

Mathematical Representation

For RSA digital signatures:

Signature Generation: s=H(m)dmodns = H(m)^d \bmod n

Signature Verification: H(m)=semodnH(m) = s^e \bmod n

Where:

  • H(m)H(m) is the hash of message mm
  • dd is the private key exponent
  • ee is the public key exponent
  • nn is the modulus (n=p×qn = p \times q for primes pp and qq)

RSA Key Generation Process:

  1. Choose two large prime numbers pp and qq

  2. Compute n=p×qn = p \times q

  3. Compute Euler's totient function: ϕ(n)=(p1)(q1)\phi(n) = (p-1)(q-1)

  4. Choose public exponent ee such that 1<e<ϕ(n)1 < e < \phi(n) and gcd(e,ϕ(n))=1\gcd(e, \phi(n)) = 1

  5. Compute private exponent dd such that de1(modϕ(n))d \equiv e^{-1} \pmod{\phi(n)}

    (Modern implementations, e.g. FIPS 186-5, often use the Carmichael function λ(n)=lcm(p1,q1)\lambda(n) = \text{lcm}(p-1, q-1) instead of ϕ(n)\phi(n) in this step, since λ(n)\lambda(n) divides ϕ(n)\phi(n) and gives the smallest valid private exponent — but computing dd from ϕ(n)\phi(n), as taught here, also yields a mathematically valid key.)

Digital Signature Algorithm Steps:

Signing Process:

  1. Compute message hash: h=H(m)h = H(m)
  2. Generate signature: s=hdmodns = h^d \bmod n
  3. Send (m,s)(m, s) to verifier

Verification Process:

  1. Compute message hash: h=H(m)h' = H(m)
  2. Decrypt signature: h=semodnh'' = s^e \bmod n
  3. Verify: signature is valid if h=hh' = h''

Security Properties

Digital signatures provide three key security properties:

  1. Authentication: Verifies the identity of the message sender
  2. Integrity: Ensures the message hasn't been modified
  3. Non-repudiation: Prevents the sender from denying they signed the message

Does not provide — Confidentiality: A digital signature does not hide the message. mm travels alongside ss in plain form, so anyone who intercepts (m,s)(m, s) can read mm regardless of whether they verify the signature. Achieving confidentiality requires separately encrypting mm (e.g., with the recipient's public key) in addition to signing it.

Key Size Considerations

The security of RSA digital signatures depends on key size and computational complexity. Let kk denote the bit-length of the modulus nn (i.e., a "kk-bit key"). Approximate security levels, following the widely cited NIST SP 800-57 equivalences to symmetric-key strength, are:

Key Size (kk) Approx. Security Level Status Use Case
512-bit 250\approx 2^{50} operations Broken in practice (factored publicly since 1999) Educational demonstration only
1024-bit 280\approx 2^{80} operations Deprecated by NIST for federal use since 2013 Legacy systems only
2048-bit 2112\approx 2^{112} operations Currently recommended minimum Production use
3072-bit 2128\approx 2^{128} operations Recommended for long-term security (beyond 2030) High-value, long-lived data
4096-bit 2150\approx 2^{150} operations (approx.) High security, not an official NIST tier High-value applications

Security Growth (Advanced / Optional Reading): The best known classical algorithm for factoring the RSA modulus NN (the actual large integer, not its bit-length) is the General Number Field Sieve (GNFS), with heuristic sub-exponential running time:

LN[1/3,c]=exp((c+o(1))(lnN)1/3(lnlnN)2/3),c=(649)1/31.923L_N[1/3, c] = \exp\Big((c + o(1))\,(\ln N)^{1/3}(\ln \ln N)^{2/3}\Big), \qquad c = \left(\frac{64}{9}\right)^{1/3} \approx 1.923

Here ln\ln is the natural logarithm and N=nN = n is the modulus itself. This grows faster than any polynomial in logN\log N (the bit-length), which is why increasing key size rapidly increases factoring cost — but it is still sub-exponential, unlike the fully exponential 2562^{56} brute-force cost of a symmetric cipher like DES with a comparable key length. This classical hardness assumption would also be broken by a sufficiently large quantum computer running Shor's algorithm, which factors integers in polynomial time — a key reason post-quantum signature schemes are being standardized for future use.

Performance vs Security Trade-off:

  • Signature time: O(k3)O(k^3) for a kk-bit modulus, using schoolbook modular exponentiation (faster with optimized multiplication algorithms)
  • Verification time: Typically faster than signing, due to the small public exponent ee (often e=65537=216+1e = 65537 = 2^{16} + 1)
  • Key generation time: Increases significantly with key size due to the cost of primality testing for larger pp and qq