Set log ID in STHs that we download

This will facilitate STH pollination.
This commit is contained in:
Andrew Ayer 2017-01-06 12:50:21 -08:00
parent 0eb6d199a4
commit 1719aa5d8e
2 changed files with 5 additions and 2 deletions

View File

@ -108,7 +108,7 @@ func makeLogHandle(logInfo *certspotter.LogInfo) (*logHandle, error) {
if err != nil { if err != nil {
return nil, fmt.Errorf("Bad public key: %s", err) 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, BatchSize: *batchSize,
NumWorkers: *numWorkers, NumWorkers: *numWorkers,
Quiet: !*verbose, Quiet: !*verbose,

View File

@ -62,6 +62,7 @@ type Scanner struct {
// Public key of the log // Public key of the log
publicKey crypto.PublicKey publicKey crypto.PublicKey
LogId []byte
// Client used to talk to the CT log instance // Client used to talk to the CT log instance
logClient *client.LogClient logClient *client.LogClient
@ -208,6 +209,7 @@ func (s *Scanner) GetSTH() (*ct.SignedTreeHead, error) {
return nil, errors.New("STH signature is invalid: " + err.Error()) return nil, errors.New("STH signature is invalid: " + err.Error())
} }
} }
copy(latestSth.LogID[:], s.LogId)
return latestSth, nil 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 // Creates a new Scanner instance using |client| to talk to the log, and taking
// configuration options from |opts|. // 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 var scanner Scanner
scanner.LogUri = logUri scanner.LogUri = logUri
scanner.LogId = logId
scanner.publicKey = publicKey scanner.publicKey = publicKey
scanner.logClient = client.New(logUri) scanner.logClient = client.New(logUri)
scanner.opts = *opts scanner.opts = *opts