Skip to content

Commit

Permalink
use p256
Browse files Browse the repository at this point in the history
use p256
  • Loading branch information
jiuker committed Jul 17, 2024
1 parent c852a2d commit 1236533
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package main
import (
"bytes"
"crypto/ecdsa"
"crypto/elliptic"
crand "crypto/rand"
"crypto/rsa"
"crypto/x509"
Expand All @@ -37,8 +38,6 @@ import (
// https://golang.org/src/crypto/tls/generate_cert.go
func generateTLSCertKey(host string) ([]byte, []byte, error) {
validFor := 365 * 24 * time.Hour
rsaBits := 2048

if len(host) == 0 {
return nil, nil, fmt.Errorf("Missing host parameter")
}
Expand Down Expand Up @@ -72,11 +71,7 @@ func generateTLSCertKey(host string) ([]byte, []byte, error) {

var priv interface{}
var err error
priv, err = rsa.GenerateKey(crand.Reader, rsaBits)
if err != nil {
return nil, nil, fmt.Errorf("failed to generate private key: %w", err)
}

priv, err = ecdsa.GenerateKey(elliptic.P256(), crand.Reader)

Check failure on line 74 in tls.go

View workflow job for this annotation

GitHub Actions / Test on Go 1.22.x and ubuntu-latest

ineffectual assignment to err (ineffassign)
notBefore := time.Now()
notAfter := notBefore.Add(validFor)

Expand Down

0 comments on commit 1236533

Please sign in to comment.