Hi Guys,
i'm trying to check if a certificate has been incorporated into a CT log using the official certificate transparency Go library (
https://github.com/google/certificate-transparency-go).
In particolar i'm using the logClient.GetProofByHash method (
https://github.com/google/certificate-transparency-go/blob/master/client/logclient.go).
Below all the step executed (for this test i used the root CA cert exposed by '
google.com'):
1) Calculating the leaf hash:
- leafEntry := ct.CreateX509MerkleTreeLeaf(ct.ASN1Cert{Data: rootCA.Raw}, sct.Timestamp) -->
https://github.com/google/certificate-transparency-go/blob/master/serialization.go - leafHash, err := ct.LeafHashForLeaf(leafEntry) -->
https://github.com/google/certificate-transparency-go/blob/master/serialization.go2) Creating logClient instance (i got the publicKey from
https://www.gstatic.com/ct/log_list/v2/all_logs_list.json and it is related to CT Log rean SCT logID included in root CA cert used for the test )
- got SCT from
google.com certificate
- got logID from SCT
- got CT Log public key from
https://www.gstatic.com/ct/log_list/v2/all_logs_list.json using above logID
- opts := jsonclient.Options{UserAgent: "ct-go-ctclient/1.0", PublicKey: publicKeyPem}
- logClient, err := ctClient.New(ctLog.URL, httpClient, opts)
3) Got Signed Tree Head (STH) from that CT Log
- sth, err := logClient.GetSTH(ctx)
4) Running of GetProofByHash method:
- sthSize := int64(sth.TreeSize)
- rsp, err := logClient.GetProofByHash(ctx, leafHash[:], uint64(sthSize))
the API fails with :
HTTP Error - 400 BadRequest
Not Found
backend GetInclusionProofByHash request failed: rpc error: code = NotFound desc = No leaf found for hash: 484341b83622f400dee4914754ab0a31b9d5e215409bc53e195b250a07019bb5 in tree size 976351352
What am i doing wrong? Do i miss some configuration?
Thanks in advance,
Dario