Skip to content

Commit 76b74e8

Browse files
authored
Merge pull request #1674 from amurant/master
✨Switch from rsa to ecdsa in tinyca
2 parents 0cce21b + d159542 commit 76b74e8

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pkg/internal/testing/certs/tinyca.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ package certs
2424

2525
import (
2626
"crypto"
27+
"crypto/ecdsa"
28+
"crypto/elliptic"
2729
crand "crypto/rand"
28-
"crypto/rsa"
2930
"crypto/x509"
3031
"crypto/x509/pkix"
3132
"encoding/pem"
@@ -38,8 +39,8 @@ import (
3839
)
3940

4041
var (
41-
rsaKeySize = 2048 // a decent number, as of 2019
42-
bigOne = big.NewInt(1)
42+
ellipticCurve = elliptic.P256()
43+
bigOne = big.NewInt(1)
4344
)
4445

4546
// CertPair is a private key and certificate for use for client auth, as a CA, or serving.
@@ -86,7 +87,7 @@ type TinyCA struct {
8687
// newPrivateKey generates a new private key of a relatively sane size (see
8788
// rsaKeySize).
8889
func newPrivateKey() (crypto.Signer, error) {
89-
return rsa.GenerateKey(crand.Reader, rsaKeySize)
90+
return ecdsa.GenerateKey(ellipticCurve, crand.Reader)
9091
}
9192

9293
// NewTinyCA creates a new a tiny CA utility for provisioning serving certs and client certs FOR TESTING ONLY.

0 commit comments

Comments
 (0)