liveBook · Manning

Signature verification

As explained in Hacking Cryptography

Signature verification is the cryptographic process of checking whether a signature validly corresponds to data under the appropriate key.

Signature verification checks whether data matches a signature produced with the appropriate secret. A recipient detects modification because an attacker without the signing secret cannot produce a valid signature. With asymmetric signatures, signing uses a private key while verification uses the corresponding public key, so verifiers cannot forge signatures themselves. section 1.2.2 section 9.1

The verification role differs by construction:

  • Symmetric signing and MACs let parties holding the shared secret reconstruct or check the authenticated result, but every verifier can also create messages. section 1.2.2 section 9.1
  • ECDSA verification computes P = (h(m)G + rA) / s and accepts the signature (r, s) when P_x equals r. section 9.5.1
  • Verification can be correct while signing is catastrophically unsafe: reusing an ECDSA nonce produces valid signatures with the same r value, and weak PKCS#1 v1.5 parsing enables forgery. section 9.5.1 section 9.6.2

Validating vulnerable ECDSA signatures

A Go test signs an empty message, “Hello World!”, a pangram, and a timestamp using a fixed nonce, then verifies each signature with ecdsa.Verify. Every signature verifies, but repeated r values expose the nonce-reuse failure. Go’s standard signing API mixes a supplied RNG with a CSPRNG, so this attack fails against that implementation. section 9.5.1

Equation 9.7
\[\begin{aligned} \begin{aligned} (P_x, P_y) &= \frac{h(m)G + rA}{s} \end{aligned} \label{equation:ecdsa-4} \end{aligned}\]

Use the verification equation to trace how the message hash, signature values, and public key reconstruct the point checked against r. section 9.5.1

How Hacking Cryptography covers it

How deep it goes
Derives ECDSA verification and implements vulnerable signing and RSA parsing, but defers the ECDSA algebraic proof and standard verification implementation.
Examples
Uses Go tests with fixed-nonce ECDSA, repeated signature values, SHA-256 messages, and a permissive PKCS#1 v1.5 verifier.
What you can do after
Diagnose/debug with it by validating signatures and recognizing nonce reuse and incomplete PKCS#1 v1.5 padding checks as forgery risks.
How it connects
Connects integrity, authenticity, hashing, MACs, digital signatures, ECDSA, RSA, public-key cryptography, and PKCS#1 v1.5.

Also explained in

Compare how 4 books explain signature verification →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Hacking Cryptography. The section links point to the parts of the book it draws on.