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

feat: support xds certificate #1945

Merged
merged 18 commits into from
Sep 23, 2022
6 changes: 3 additions & 3 deletions xds/credentials/certgenerate/generate_cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ import (
"encoding/pem"
"errors"
"fmt"
"io/ioutil"
"math/big"
"os"
"strings"
"time"
)
Expand Down Expand Up @@ -242,12 +242,12 @@ func GenCertFromCSR(csr *x509.CertificateRequest, signingCert *x509.Certificate,
// signerCertFile: cert file name
// signerPrivFile: private key file name
func LoadSignerCredsFromFiles(signerCertFile string, signerPrivFile string) (*x509.Certificate, crypto.PrivateKey, error) {
signerCertBytes, err := os.ReadFile(signerCertFile)
signerCertBytes, err := ioutil.ReadFile(signerCertFile)
AlexStocks marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
return nil, nil, fmt.Errorf("certificate file reading failure (%v)", err)
}

signerPrivBytes, err := os.ReadFile(signerPrivFile)
signerPrivBytes, err := ioutil.ReadFile(signerPrivFile)
if err != nil {
return nil, nil, fmt.Errorf("private key file reading failure (%v)", err)
}
Expand Down
4 changes: 2 additions & 2 deletions xds/credentials/certgenerate/generate_csr.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
"crypto/x509/pkix"
"errors"
"fmt"
"os"
"io/ioutil"
"strings"
)

Expand Down Expand Up @@ -116,7 +116,7 @@ func AppendRootCerts(pemCert []byte, rootCertFile string) ([]byte, error) {
rootCerts := pemCert
if len(rootCertFile) > 0 {
log.Debugf("append root certificates from %v", rootCertFile)
certBytes, err := os.ReadFile(rootCertFile)
certBytes, err := ioutil.ReadFile(rootCertFile)
if err != nil {
return rootCerts, fmt.Errorf("failed to read root certificates (%v)", err)
}
Expand Down