diff --git a/cmd/common.go b/cmd/common.go index 6aac0b2..3cddc6d 100644 --- a/cmd/common.go +++ b/cmd/common.go @@ -108,7 +108,7 @@ func makeLogHandle(logInfo *certspotter.LogInfo) (*logHandle, error) { if err != nil { return nil, fmt.Errorf("Bad public key: %s", err) } - ctlog.scanner = certspotter.NewScanner(logInfo.FullURI(), logKey, &certspotter.ScannerOptions{ + ctlog.scanner = certspotter.NewScanner(logInfo.FullURI(), logInfo.ID(), logKey, &certspotter.ScannerOptions{ BatchSize: *batchSize, NumWorkers: *numWorkers, Quiet: !*verbose, diff --git a/scanner.go b/scanner.go index 41ba6da..462fa78 100644 --- a/scanner.go +++ b/scanner.go @@ -62,6 +62,7 @@ type Scanner struct { // Public key of the log publicKey crypto.PublicKey + LogId []byte // Client used to talk to the CT log instance logClient *client.LogClient @@ -208,6 +209,7 @@ func (s *Scanner) GetSTH() (*ct.SignedTreeHead, error) { return nil, errors.New("STH signature is invalid: " + err.Error()) } } + copy(latestSth.LogID[:], s.LogId) return latestSth, nil } @@ -312,9 +314,10 @@ func (s *Scanner) Scan(startIndex int64, endIndex int64, processCert ProcessCall // Creates a new Scanner instance using |client| to talk to the log, and taking // configuration options from |opts|. -func NewScanner(logUri string, publicKey crypto.PublicKey, opts *ScannerOptions) *Scanner { +func NewScanner(logUri string, logId []byte, publicKey crypto.PublicKey, opts *ScannerOptions) *Scanner { var scanner Scanner scanner.LogUri = logUri + scanner.LogId = logId scanner.publicKey = publicKey scanner.logClient = client.New(logUri) scanner.opts = *opts