feat(caddy): CLI command to list certificates stored in the Uncloud cluster storage for Caddy

This commit is contained in:
Pasha Sviderski committed 2026-10-01 14:19:53 +10:00
1 parent 70de7b1b8f
commit 9c21ae6b08
6 files changed
+327

No files matched your search

+12
View File
@@ -4,6 +4,7 @@ import (
"crypto/ed25519"
"crypto/rand"
"crypto/x509"
"encoding/hex"
"encoding/pem"
"math/big"
"testing"
@@ -45,6 +46,17 @@ func TestIssuedCertificateFromProto(t *testing.T) {
}
}
func TestIssuedCertificateFingerprint(t *testing.T) {
cert := IssuedCertificate{Chain: []*x509.Certificate{
{Raw: []byte("abc")},
{Raw: []byte("issuer")},
}}
want, err := hex.DecodeString("ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad")
require.NoError(t, err)
fingerprint := cert.Fingerprint()
assert.Equal(t, want, fingerprint[:])
}
func TestIssuedCertificateFromProto_InvalidCertificate(t *testing.T) {
valid := testCertificatePEM(t, 1)
invalidDER := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: []byte("invalid")})