mirror of
https://github.com/luckfox-eng29/kvm.git
synced 2026-01-18 03:28:19 +01:00
feat(websecure): add support for ed25519 certificates (#513)
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user