]> Sergey Matveev's repositories - tofuproxy.git/blobdiff - x509.go
Use faster modern EdDSA-based certificates
[tofuproxy.git] / x509.go
diff --git a/x509.go b/x509.go
index 6c3923257759e4dd80846f6240400781afac59da..4dafb908383eb894ef68348c8804c77da4363756 100644 (file)
--- a/x509.go
+++ b/x509.go
@@ -20,8 +20,7 @@ package tofuproxy
 
 import (
        "crypto"
-       "crypto/ecdsa"
-       "crypto/elliptic"
+       "crypto/ed25519"
        "crypto/rand"
        "crypto/x509"
        "crypto/x509/pkix"
@@ -57,11 +56,10 @@ func newKeypair(
        caCert *x509.Certificate,
        caPrv crypto.PrivateKey,
 ) *Keypair {
-       prv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
+       pub, prv, err := ed25519.GenerateKey(rand.Reader)
        if err != nil {
                log.Fatalln(err)
        }
-       pub := prv.Public()
        notBefore := time.Now()
        notAfter := notBefore.Add(24 * time.Hour)
        Serial = Serial.Add(Serial, big.NewInt(1))