feat(websecure): add support for ed25519 certificates (#513)

This commit is contained in:
Aveline
2025-05-25 11:09:58 +02:00
committed by GitHub
parent 2ec061b3a8
commit a28676cd94
2 changed files with 61 additions and 1 deletions

View File

@@ -2,6 +2,7 @@ package websecure
import (
"crypto/ecdsa"
"crypto/ed25519"
"crypto/rand"
"crypto/rsa"
"crypto/tls"
@@ -37,11 +38,15 @@ func keyToFile(cert *tls.Certificate, filename string) error {
if e != nil {
return fmt.Errorf("failed to marshal EC private key: %v", e)
}
keyBlock = pem.Block{
Type: "EC PRIVATE KEY",
Bytes: b,
}
case ed25519.PrivateKey:
keyBlock = pem.Block{
Type: "ED25519 PRIVATE KEY",
Bytes: k,
}
default:
return fmt.Errorf("unknown private key type: %T", k)
}