ca.crt restore endpoint

This commit is contained in:
Mikaël Cluseau
2026-07-17 13:24:41 +02:00
parent 88f97496be
commit 4d1deeb773
4 changed files with 94 additions and 18 deletions
+7 -2
View File
@@ -2,13 +2,14 @@ package main
import (
"crypto/ed25519"
"crypto/x509"
"encoding/json"
"encoding/pem"
"errors"
"os"
"path/filepath"
"time"
"github.com/cloudflare/cfssl/certinfo"
"github.com/cloudflare/cfssl/config"
"github.com/cloudflare/cfssl/helpers/derhelpers"
"github.com/cloudflare/cfssl/log"
@@ -61,7 +62,11 @@ func loadSecretData(config *config.Config) (sd *SecretData, err error) {
}
func checkCertUsable(certPEM []byte) error {
cert, err := certinfo.ParseCertificatePEM(certPEM)
block, _ := pem.Decode(certPEM)
if block == nil {
return errors.New("no PEM block found")
}
cert, err := x509.ParseCertificate(block.Bytes)
if err != nil {
return err
}