aboutsummaryrefslogtreecommitdiff
path: root/pkg/storage
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus@rgdd.se>2025-01-03 15:52:34 +0100
committerRasmus Dahlberg <rasmus@rgdd.se>2025-01-03 15:52:34 +0100
commit3b1c39413ba0b478bac55fc50aa645e438e90907 (patch)
treeba639408a1d96918fff122288535a8368e4c255b /pkg/storage
parent0c63bdc9e910bc5f5ab6f59bbd06687c55b398dc (diff)
Store parsed DER certificates for matching entries
For convenience. For example, now one can debug issues like this: openssl x509 -inform DER -in /path/to/crt.der -text -noout
Diffstat (limited to 'pkg/storage')
-rw-r--r--pkg/storage/index/index.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/pkg/storage/index/index.go b/pkg/storage/index/index.go
index 36a9334..0056565 100644
--- a/pkg/storage/index/index.go
+++ b/pkg/storage/index/index.go
@@ -78,8 +78,11 @@ func (ix *Index) AddEntries(logID [sha256.Size]byte, entries []monitor.LogEntry)
if !ix.mem.addEntry(crtID, path) {
return nil // duplicate
}
-
- return ioutil.CommitJSON(path, entry)
+ if err := ioutil.CommitJSON(path, entry); err != nil {
+ return err
+ }
+ path = fmt.Sprintf("%s/%x-%d.der", ix.cfg.MatchDirectory, logID[:], entry.LeafIndex)
+ return ioutil.CommitData(path, crt.Raw)
}
for _, entry := range entries {