diff --git a/monitor/discoveredcert.go b/monitor/discoveredcert.go index bc1fbfc..f09c878 100644 --- a/monitor/discoveredcert.go +++ b/monitor/discoveredcert.go @@ -23,17 +23,17 @@ import ( ) type discoveredCert struct { - WatchItem WatchItem - LogEntry *logEntry - Info *certspotter.CertInfo - Chain []ct.ASN1Cert // first entry is the leaf certificate or precertificate - TBSSHA256 [32]byte // computed over Info.TBS.Raw - LeafSHA256 [32]byte // computed over Chain[0] - PubkeySHA256 [32]byte // computed over Info.TBS.PublicKey.FullBytes - Identifiers *certspotter.Identifiers - CertPath string // empty if not saved on the filesystem - JSONPath string // empty if not saved on the filesystem - TextPath string // empty if not saved on the filesystem + WatchItem WatchItem + LogEntry *logEntry + Info *certspotter.CertInfo + Chain []ct.ASN1Cert // first entry is the leaf certificate or precertificate + TBSSHA256 [32]byte // computed over Info.TBS.Raw + LeafSHA256 [32]byte // computed over Chain[0] + PubkeySHA256 [32]byte // computed over Info.TBS.PublicKey.FullBytes + Identifiers *certspotter.Identifiers + CertPath string // empty if not saved on the filesystem + JSONPath string // empty if not saved on the filesystem + TextPath string // empty if not saved on the filesystem } func (cert *discoveredCert) pemChain() []byte { @@ -51,7 +51,7 @@ func (cert *discoveredCert) pemChain() []byte { func (cert *discoveredCert) json() []byte { object := map[string]any{ - "tbs_sha256": hex.EncodeToString(cert.TBSSHA256[:]), + "tbs_sha256": hex.EncodeToString(cert.TBSSHA256[:]), "cert_sha256": hex.EncodeToString(cert.LeafSHA256[:]), "pubkey_sha256": hex.EncodeToString(cert.PubkeySHA256[:]), "issuer_der": cert.Info.TBS.Issuer.FullBytes, diff --git a/monitor/monitor.go b/monitor/monitor.go index 12726d8..b9b9912 100644 --- a/monitor/monitor.go +++ b/monitor/monitor.go @@ -28,7 +28,7 @@ import ( ) const ( - maxGetEntriesSize = 1000 + maxGetEntriesSize = 1000 monitorLogInterval = 5 * time.Minute ) diff --git a/monitor/process.go b/monitor/process.go index 3c1f931..7c76795 100644 --- a/monitor/process.go +++ b/monitor/process.go @@ -98,14 +98,14 @@ func processCertificate(ctx context.Context, config *Config, entry *logEntry, ce } cert := &discoveredCert{ - WatchItem: watchItem, - LogEntry: entry, - Info: certInfo, - Chain: chain, - TBSSHA256: sha256.Sum256(certInfo.TBS.Raw), - LeafSHA256: sha256.Sum256(chain[0]), - PubkeySHA256: sha256.Sum256(certInfo.TBS.PublicKey.FullBytes), - Identifiers: identifiers, + WatchItem: watchItem, + LogEntry: entry, + Info: certInfo, + Chain: chain, + TBSSHA256: sha256.Sum256(certInfo.TBS.Raw), + LeafSHA256: sha256.Sum256(chain[0]), + PubkeySHA256: sha256.Sum256(certInfo.TBS.PublicKey.FullBytes), + Identifiers: identifiers, } var notifiedPath string