use ed25519 instead of RSA in tests and examples (#5050)

Also adds a golangci-lint depguard rules that forbids
importing crypto/rsa.
This commit is contained in:
Marten Seemann
2025-04-20 11:55:08 +08:00
committed by GitHub
parent 03e9359e38
commit d35b5ac187
6 changed files with 127 additions and 31 deletions

View File

@@ -2,8 +2,8 @@ package handshake
import (
"context"
"crypto/ed25519"
"crypto/rand"
"crypto/rsa"
"crypto/tls"
"crypto/x509"
"errors"
@@ -30,7 +30,7 @@ var (
)
func init() {
priv, err := rsa.GenerateKey(rand.Reader, 1024)
_, priv, err := ed25519.GenerateKey(rand.Reader)
if err != nil {
log.Fatal(err)
}
@@ -39,7 +39,7 @@ func init() {
log.Fatal(err)
}
privClient, err := rsa.GenerateKey(rand.Reader, 1024)
_, privClient, err := ed25519.GenerateKey(rand.Reader)
if err != nil {
log.Fatal(err)
}