]> Sergey Matveev's repositories - tofuproxy.git/blobdiff - cmd/certgen/main.go
Use faster modern EdDSA-based certificates
[tofuproxy.git] / cmd / certgen / main.go
index 1db79de5e7a0d525b91247c529ddcaa37ad7fb5c..e9a5cb1367c75f93e12a5a191b69489d309d56a9 100644 (file)
@@ -1,6 +1,7 @@
 /*
-tofuproxy -- HTTP proxy with TLS certificates management
-Copyright (C) 2021 Sergey Matveev <stargrave@stargrave.org>
+tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
+             manager, WARC/geminispace browser
+Copyright (C) 2021-2023 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -18,8 +19,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 package main
 
 import (
-       "crypto/ecdsa"
-       "crypto/elliptic"
+       "crypto/ed25519"
        "crypto/rand"
        "crypto/x509"
        "crypto/x509/pkix"
@@ -37,11 +37,10 @@ func main() {
        flag.Parse()
        log.SetFlags(log.Lshortfile)
 
-       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(365 * 24 * time.Hour)