diff options
author | Rasmus Dahlberg <rgdd@glasklarteknik.se> | 2025-01-04 16:32:00 +0100 |
---|---|---|
committer | Rasmus Dahlberg <rgdd@glasklarteknik.se> | 2025-01-04 16:32:58 +0100 |
commit | 791450281e72cb69dbf640cbd4094d422706b72c (patch) | |
tree | 53fe4073bc0eee7b83956bfeb68b4e04ec8a3f02 | |
parent | 76a113a3319a421b5a1226300dd4a4b5cce500bf (diff) |
Commit parsed certificate as ASCII instead of DER
Because openssl wasn't able to parse DER precertificates. And now the
user can just view the file rather than fiddling with openssl.
-rw-r--r-- | docs/metrics.md | 2 | ||||
-rw-r--r-- | pkg/storage/index/index.go | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/docs/metrics.md b/docs/metrics.md index 6fa12c1..1dea0ef 100644 --- a/docs/metrics.md +++ b/docs/metrics.md @@ -43,7 +43,7 @@ silentct_certificate_alert{stored_at="/path/to/state/crt_found/<log-hex-id>-<log ``` `stored_at` is where the log entry is stored on the monitor's local file system. -For convenience, the parsed log-entry certificate is also available as `.der`. +For convenience, the parsed log-entry certificate is also available as `.ascii`. ## `"silentct_error_counter"` diff --git a/pkg/storage/index/index.go b/pkg/storage/index/index.go index bf94711..95eb04a 100644 --- a/pkg/storage/index/index.go +++ b/pkg/storage/index/index.go @@ -8,6 +8,7 @@ import ( "fmt" "time" + "github.com/google/certificate-transparency-go/x509util" "rgdd.se/silentct/internal/ioutil" "rgdd.se/silentct/internal/monitor" "rgdd.se/silentct/pkg/crtutil" @@ -81,8 +82,8 @@ func (ix *Index) AddEntries(logID [sha256.Size]byte, entries []monitor.LogEntry) 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) + path = fmt.Sprintf("%s/%x-%d.ascii", ix.cfg.MatchDirectory, logID[:], entry.LeafIndex) + return ioutil.CommitData(path, []byte(x509util.CertificateToString(&crt))) } for _, entry := range entries { |