chore: pkg imported more than once (#10048)

This commit is contained in:
guangwu 2023-06-12 02:49:47 +08:00 committed by GitHub
parent 05e5956545
commit 114ae77fb7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 33 deletions

View file

@ -20,7 +20,6 @@ import (
"bytes"
"crypto"
"crypto/rand"
cryptorand "crypto/rand"
"crypto/rsa"
"crypto/tls"
"crypto/x509"
@ -336,7 +335,7 @@ const (
// newPrivateKey creates an RSA private key
func newPrivateKey() (*rsa.PrivateKey, error) {
return rsa.GenerateKey(cryptorand.Reader, rsaKeySize)
return rsa.GenerateKey(rand.Reader, rsaKeySize)
}
// newSignedCert creates a signed certificate using the given CA certificate and key
@ -365,7 +364,7 @@ func newSignedCert(cfg certutil.Config, key crypto.Signer, caCert *x509.Certific
KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature,
ExtKeyUsage: cfg.Usages,
}
certDERBytes, err := x509.CreateCertificate(cryptorand.Reader, &certTmpl, caCert, key.Public(), caKey)
certDERBytes, err := x509.CreateCertificate(rand.Reader, &certTmpl, caCert, key.Public(), caKey)
if err != nil {
return nil, err
}