Add client-side SCT verification and entry matching in hammer#897
Open
phbnf wants to merge 1 commit into
Open
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR allows the hammer to verify that the SCTs it receives matches with the requests it sent.
While I'm there, move
isPrecertificatetox509util.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.