feat: crl support, metrics

This commit is contained in:
Florian Bauer
2025-01-21 08:33:49 +01:00
parent f0332b21b2
commit 8844427927
9 changed files with 207 additions and 46 deletions

View File

@@ -4,11 +4,8 @@ import (
"crypto"
"crypto/tls"
"crypto/x509"
"encoding/pem"
"fmt"
"math/big"
"net/http"
"os"
"time"
"golang.org/x/crypto/ocsp"
@@ -29,21 +26,8 @@ func NewCrlSource(caCertificate *x509.Certificate, responderKeyPair tls.Certific
}
}
func (source *CrlSource) LoadCrlFromFile(path string) error {
crlContent, openCrlError := os.ReadFile(path)
if openCrlError != nil {
return openCrlError
}
block, rest := pem.Decode(crlContent)
if len(rest) > 0 {
return fmt.Errorf("failed to decode crl")
}
crl, parseCrlError := x509.ParseRevocationList(block.Bytes)
if parseCrlError != nil {
return parseCrlError
}
func (source *CrlSource) UseCrl(crl *x509.RevocationList) {
source.crl = crl
return nil
}
func (source *CrlSource) Response(request *ocsp.Request) ([]byte, http.Header, error) {