Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨Switch from rsa to ecdsa in tinyca #1674

Merged
merged 1 commit into from Sep 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 5 additions & 4 deletions pkg/internal/testing/certs/tinyca.go
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