Skip to content

Commit

Permalink
Merge pull request #1674 from amurant/master
Browse files Browse the repository at this point in the history
✨Switch from rsa to ecdsa in tinyca
  • Loading branch information
k8s-ci-robot committed Sep 27, 2021
2 parents 0cce21b + d159542 commit 76b74e8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/internal/testing/certs/tinyca.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ package certs

import (
"crypto"
"crypto/ecdsa"
"crypto/elliptic"
crand "crypto/rand"
"crypto/rsa"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
Expand All @@ -38,8 +39,8 @@ import (
)

var (
rsaKeySize = 2048 // a decent number, as of 2019
bigOne = big.NewInt(1)
ellipticCurve = elliptic.P256()
bigOne = big.NewInt(1)
)

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

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

0 comments on commit 76b74e8

Please sign in to comment.