Skip to content

Add client-side SCT verification and entry matching in hammer#897

Open
phbnf wants to merge 1 commit into
transparency-dev:mainfrom
phbnf:hammersct
Open

Add client-side SCT verification and entry matching in hammer#897
phbnf wants to merge 1 commit into
transparency-dev:mainfrom
phbnf:hammersct

Conversation

@phbnf

@phbnf phbnf commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

This PR allows the hammer to verify that the SCTs it receives matches with the requests it sent.

While I'm there, move isPrecertificate to x509util.

I tested this with the hammer locally and it worked. I'll send a PR afterwards that adds instructions to run the hammer locally with a POSIX log unless someone can point me at them!

Towards #884.

Update hammer's httpWriter to parse and cryptographically verify AddChainResponse signatures against the log's public key. Reconstruct the CertificateTimestamp from the submitted certificate and verify that the LogID, timestamp, and certificate fields in the returned SCT match the request.

Refactor base64 public key extraction into parseLogPublicKeyB64 helper function and reuse it inside logSigVerifier. Implement newAddChainResponseVerifier factory constructor, decoupling HTTP transport from verification logic. Precompute expected Log ID outside verification callback closure to eliminate redundant public key marshaling and SHA-256 computation in the hot path. Pre-allocate chainCerts slice with exact len(req.Chain) capacity and decode response extensions from base64 exactly once into extBytes (parsing via staticct.ParseCTExtensionsBytes) to eliminate redundant allocations and decoding. Ensure verification fails explicitly if public key is nil or request payload is empty, and format verifyWriteResponse error in httpWriter to include verification failure details and readable body string (%q). Export IsPrecertificate in x509util, call x509util.IsPrecertificate directly across chain_validation and hammer without wrappers, and use staticct.NewCertificateTimestamp helper to cleanly construct sctInput.

TAG=agy
CONV=fdd8e21c-6548-461f-8ead-5ec8915de98d
@phbnf phbnf requested review from AlCutter and roger2hk July 10, 2026 16:03
@phbnf phbnf marked this pull request as ready for review July 10, 2026 16:04
@phbnf phbnf requested a review from a team as a code owner July 10, 2026 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants