Skip to content

Commit aea6243

Browse files
committed
remove unneeded fingerprint generation
1 parent d714f9a commit aea6243

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

test/e2e/certificate_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ func TestCertificate(t *testing.T) {
2727
notBefore := time.Now()
2828
notAfter := notBefore.Add(365 * 24 * time.Hour)
2929
certPath, keyPath := path.Join(tmpDir, "cert.pem"), path.Join(tmpDir, "key.pem")
30-
fingerprint := ""
31-
err := generateCertificate(certPath, keyPath, &fingerprint, notBefore, notAfter)
30+
err := generateCertificate(certPath, keyPath, notBefore, notAfter)
3231
require.NoError(t, err)
3332

3433
certName := withSuffix("test-certificate-uploaded")

test/e2e/certificate_util.go

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,17 @@ package e2e
55
import (
66
"crypto/rand"
77
"crypto/rsa"
8-
"crypto/sha256"
98
"crypto/x509"
109
"crypto/x509/pkix"
1110
"encoding/pem"
12-
"fmt"
1311
"math/big"
1412
"os"
1513
"time"
1614
)
1715

1816
// Adapted from https://go.dev/src/crypto/tls/generate_cert.go
1917

20-
func generateCertificate(certFile, keyFile string, fingerprint *string, notBefore, notAfter time.Time) error {
18+
func generateCertificate(certFile, keyFile string, notBefore, notAfter time.Time) error {
2119

2220
priv, err := rsa.GenerateKey(rand.Reader, 2048)
2321
if err != nil {
@@ -52,15 +50,6 @@ func generateCertificate(certFile, keyFile string, fingerprint *string, notBefor
5250
return err
5351
}
5452

55-
shaSum := sha256.Sum256(derBytes)
56-
*fingerprint = ""
57-
for i, b := range shaSum {
58-
if i > 0 {
59-
*fingerprint += ":"
60-
}
61-
*fingerprint += fmt.Sprintf("%02X", b)
62-
}
63-
6453
certOut, err := os.Create(certFile)
6554
if err != nil {
6655
return err

0 commit comments

Comments
 (0)