From ba9e649839f07da7c7021f9db8a71f4704f58b50 Mon Sep 17 00:00:00 2001 From: Patrick Zheng Date: Tue, 26 Jul 2022 13:26:19 +0800 Subject: [PATCH 1/6] fixed the hello-signing workflow with self-generated certificate chain Signed-off-by: Patrick Zheng --- cmd/notation/cert_gen.go | 84 ++++++++++++++++++++++++++++------------ 1 file changed, 60 insertions(+), 24 deletions(-) diff --git a/cmd/notation/cert_gen.go b/cmd/notation/cert_gen.go index d27c434cc..f95a72780 100644 --- a/cmd/notation/cert_gen.go +++ b/cmd/notation/cert_gen.go @@ -1,7 +1,6 @@ package main import ( - "crypto" "crypto/rand" "crypto/rsa" "crypto/x509" @@ -10,7 +9,6 @@ import ( "errors" "fmt" "math/big" - "net" "time" "github.com/notaryproject/notation/internal/osutil" @@ -37,12 +35,16 @@ func generateTestCert(ctx *cli.Context) error { return err } - // generate self-signed certificate - cert, certBytes, err := generateTestSelfSignedCert(key, hosts, ctx.Duration("expiry")) + // generate self-created certificate chain + rootCA, rootBytes, rootPrivKey, err := generateTestRootCert(hosts, ctx.Duration("expiry"), bits) if err != nil { return err } - fmt.Println("generated certificates expiring on", cert.NotAfter.Format(time.RFC3339)) + leafCA, leafBytes, err := generateTestLeafCert(rootCA, rootPrivKey, &key.PublicKey, hosts, ctx.Duration("expiry")) + if err != nil { + return err + } + fmt.Println("generated certificates expiring on", leafCA.NotAfter.Format(time.RFC3339)) // write private key keyPath := config.KeyPath(name) @@ -53,7 +55,7 @@ func generateTestCert(ctx *cli.Context) error { // write self-signed certificate certPath := config.CertificatePath(name) - if err := osutil.WriteFileWithPermission(certPath, certBytes, 0644, false); err != nil { + if err := osutil.WriteFileWithPermission(certPath, append(leafBytes, rootBytes...), 0644, false); err != nil { return fmt.Errorf("failed to write certificate file: %v", err) } fmt.Println("wrote certificate:", certPath) @@ -96,7 +98,7 @@ func generateTestCert(ctx *cli.Context) error { return nil } -func generateTestKey(bits int) (crypto.Signer, []byte, error) { +func generateTestKey(bits int) (*rsa.PrivateKey, []byte, error) { key, err := rsa.GenerateKey(rand.Reader, bits) if err != nil { return nil, nil, err @@ -109,39 +111,73 @@ func generateTestKey(bits int) (crypto.Signer, []byte, error) { return key, keyPEM, nil } -func generateTestSelfSignedCert(key crypto.Signer, hosts []string, expiry time.Duration) (*x509.Certificate, []byte, error) { +func generateCert(template, parent *x509.Certificate, publicKey *rsa.PublicKey, privateKey *rsa.PrivateKey) (*x509.Certificate, []byte, error) { + certBytes, err := x509.CreateCertificate(rand.Reader, template, parent, publicKey, privateKey) + if err != nil { + return nil, nil, fmt.Errorf("failed to create certificate: %v", err) + } + cert, err := x509.ParseCertificate(certBytes) + if err != nil { + return nil, nil, fmt.Errorf("generated invalid certificate: %v", err) + } + certPEM := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: certBytes}) + return cert, certPEM, nil +} + +// generateTestRootCert generates a self-signed root certificate +func generateTestRootCert(hosts []string, expiry time.Duration, bits int) (*x509.Certificate, []byte, *rsa.PrivateKey, error) { now := time.Now() serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128) serialNumber, err := rand.Int(rand.Reader, serialNumberLimit) if err != nil { - return nil, nil, fmt.Errorf("failed to generate serial number: %v", err) + return nil, nil, nil, fmt.Errorf("failed to generate root serial number: %v", err) } - template := x509.Certificate{ + rootTemplate := x509.Certificate{ SerialNumber: serialNumber, Subject: pkix.Name{ - CommonName: hosts[0], + CommonName: hosts[0] + "RootCA", }, NotBefore: now, NotAfter: now.Add(expiry), - KeyUsage: x509.KeyUsageDigitalSignature, + KeyUsage: x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign | x509.KeyUsageCRLSign, ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageCodeSigning}, BasicConstraintsValid: true, + IsCA: true, } - for _, host := range hosts { - if ip := net.ParseIP(host); ip != nil { - template.IPAddresses = append(template.IPAddresses, ip) - } else { - template.DNSNames = append(template.DNSNames, host) - } + priv, err := rsa.GenerateKey(rand.Reader, bits) + if err != nil { + return nil, nil, nil, fmt.Errorf("failed to generate root key: %v", err) } - certBytes, err := x509.CreateCertificate(rand.Reader, &template, &template, key.Public(), key) + rootCert, rootPEM, err := generateCert(&rootTemplate, &rootTemplate, &priv.PublicKey, priv) if err != nil { - return nil, nil, fmt.Errorf("failed to create certificate: %v", err) + return nil, nil, nil, fmt.Errorf("failed to generate root cert: %v", err) } - cert, err := x509.ParseCertificate(certBytes) + return rootCert, rootPEM, priv, nil +} + +// generateTestLeafCert generates the leaf certificate with rootCA as parent +func generateTestLeafCert(rootCA *x509.Certificate, rootKey *rsa.PrivateKey, publicKey *rsa.PublicKey, hosts []string, expiry time.Duration) (*x509.Certificate, []byte, error) { + now := time.Now() + serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128) + serialNumber, err := rand.Int(rand.Reader, serialNumberLimit) if err != nil { - return nil, nil, fmt.Errorf("generated invalid certificate: %v", err) + return nil, nil, fmt.Errorf("failed to generate leaf serial number: %v", err) } - certPEM := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: certBytes}) - return cert, certPEM, nil + leafTemplate := x509.Certificate{ + SerialNumber: serialNumber, + Subject: pkix.Name{ + CommonName: hosts[0] + "LeafCA", + }, + NotBefore: now, + NotAfter: now.Add(expiry), + KeyUsage: x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign | x509.KeyUsageCRLSign, + ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageCodeSigning}, + BasicConstraintsValid: true, + IsCA: true, + } + leafCert, leafPEM, err := generateCert(&leafTemplate, rootCA, publicKey, rootKey) + if err != nil { + return nil, nil, fmt.Errorf("failed to generate leaf cert: %v", err) + } + return leafCert, leafPEM, nil } From d8282ef98bb9bfeece198cd2d208dac37bb75f90 Mon Sep 17 00:00:00 2001 From: Patrick Zheng Date: Tue, 26 Jul 2022 16:19:21 +0800 Subject: [PATCH 2/6] edited Usage description of generate-test Signed-off-by: Patrick Zheng --- cmd/notation/cert.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/notation/cert.go b/cmd/notation/cert.go index fe92eaa1c..fb7017410 100644 --- a/cmd/notation/cert.go +++ b/cmd/notation/cert.go @@ -58,7 +58,7 @@ var ( certGenerateTestCommand = &cli.Command{ Name: "generate-test", - Usage: "Generates a test RSA key and a corresponding self-signed certificate", + Usage: "Generates a test RSA key and a corresponding self-generated certificate chain", ArgsUsage: " ...", Flags: []cli.Flag{ &cli.StringFlag{ From 35d0daadb9c4a08afe29c54e57278f15443e753e Mon Sep 17 00:00:00 2001 From: Patrick Zheng Date: Wed, 27 Jul 2022 12:12:39 +0800 Subject: [PATCH 3/6] updated to use func in testhelper Signed-off-by: Patrick Zheng --- cmd/notation/cert_gen.go | 81 ++++++++-------------------------------- 1 file changed, 15 insertions(+), 66 deletions(-) diff --git a/cmd/notation/cert_gen.go b/cmd/notation/cert_gen.go index f95a72780..c77458b65 100644 --- a/cmd/notation/cert_gen.go +++ b/cmd/notation/cert_gen.go @@ -4,13 +4,12 @@ import ( "crypto/rand" "crypto/rsa" "crypto/x509" - "crypto/x509/pkix" "encoding/pem" "errors" "fmt" - "math/big" "time" + "github.com/notaryproject/notation-core-go/testhelper" "github.com/notaryproject/notation/internal/osutil" "github.com/notaryproject/notation/pkg/config" "github.com/urfave/cli/v2" @@ -36,15 +35,15 @@ func generateTestCert(ctx *cli.Context) error { } // generate self-created certificate chain - rootCA, rootBytes, rootPrivKey, err := generateTestRootCert(hosts, ctx.Duration("expiry"), bits) + rsaRootCertTuple, rootBytes, err := generateTestRootCert(hosts, bits) if err != nil { return err } - leafCA, leafBytes, err := generateTestLeafCert(rootCA, rootPrivKey, &key.PublicKey, hosts, ctx.Duration("expiry")) + rsaLeafCertTuple, leafBytes, err := generateTestLeafCert(&rsaRootCertTuple, key, hosts) if err != nil { return err } - fmt.Println("generated certificates expiring on", leafCA.NotAfter.Format(time.RFC3339)) + fmt.Println("generated certificates expiring on", rsaLeafCertTuple.Cert.NotAfter.Format(time.RFC3339)) // write private key keyPath := config.KeyPath(name) @@ -111,73 +110,23 @@ func generateTestKey(bits int) (*rsa.PrivateKey, []byte, error) { return key, keyPEM, nil } -func generateCert(template, parent *x509.Certificate, publicKey *rsa.PublicKey, privateKey *rsa.PrivateKey) (*x509.Certificate, []byte, error) { - certBytes, err := x509.CreateCertificate(rand.Reader, template, parent, publicKey, privateKey) - if err != nil { - return nil, nil, fmt.Errorf("failed to create certificate: %v", err) - } - cert, err := x509.ParseCertificate(certBytes) - if err != nil { - return nil, nil, fmt.Errorf("generated invalid certificate: %v", err) - } - certPEM := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: certBytes}) - return cert, certPEM, nil +func generateCertPEM(rsaCertTuple *testhelper.RSACertTuple) []byte { + return pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: rsaCertTuple.Cert.Raw}) } // generateTestRootCert generates a self-signed root certificate -func generateTestRootCert(hosts []string, expiry time.Duration, bits int) (*x509.Certificate, []byte, *rsa.PrivateKey, error) { - now := time.Now() - serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128) - serialNumber, err := rand.Int(rand.Reader, serialNumberLimit) - if err != nil { - return nil, nil, nil, fmt.Errorf("failed to generate root serial number: %v", err) - } - rootTemplate := x509.Certificate{ - SerialNumber: serialNumber, - Subject: pkix.Name{ - CommonName: hosts[0] + "RootCA", - }, - NotBefore: now, - NotAfter: now.Add(expiry), - KeyUsage: x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign | x509.KeyUsageCRLSign, - ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageCodeSigning}, - BasicConstraintsValid: true, - IsCA: true, - } +func generateTestRootCert(hosts []string, bits int) (testhelper.RSACertTuple, []byte, error) { + fmt.Println("testing...") priv, err := rsa.GenerateKey(rand.Reader, bits) if err != nil { - return nil, nil, nil, fmt.Errorf("failed to generate root key: %v", err) + return testhelper.RSACertTuple{}, nil, fmt.Errorf("failed to generate root key: %v", err) } - rootCert, rootPEM, err := generateCert(&rootTemplate, &rootTemplate, &priv.PublicKey, priv) - if err != nil { - return nil, nil, nil, fmt.Errorf("failed to generate root cert: %v", err) - } - return rootCert, rootPEM, priv, nil + rsaRootCertTuple := testhelper.GetRSACertTupleWithPK(priv, hosts[0]+"RootCA", nil) + return rsaRootCertTuple, generateCertPEM(&rsaRootCertTuple), nil } -// generateTestLeafCert generates the leaf certificate with rootCA as parent -func generateTestLeafCert(rootCA *x509.Certificate, rootKey *rsa.PrivateKey, publicKey *rsa.PublicKey, hosts []string, expiry time.Duration) (*x509.Certificate, []byte, error) { - now := time.Now() - serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128) - serialNumber, err := rand.Int(rand.Reader, serialNumberLimit) - if err != nil { - return nil, nil, fmt.Errorf("failed to generate leaf serial number: %v", err) - } - leafTemplate := x509.Certificate{ - SerialNumber: serialNumber, - Subject: pkix.Name{ - CommonName: hosts[0] + "LeafCA", - }, - NotBefore: now, - NotAfter: now.Add(expiry), - KeyUsage: x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign | x509.KeyUsageCRLSign, - ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageCodeSigning}, - BasicConstraintsValid: true, - IsCA: true, - } - leafCert, leafPEM, err := generateCert(&leafTemplate, rootCA, publicKey, rootKey) - if err != nil { - return nil, nil, fmt.Errorf("failed to generate leaf cert: %v", err) - } - return leafCert, leafPEM, nil +// generateTestLeafCert generates the leaf certificate +func generateTestLeafCert(rsaRootCertTuple *testhelper.RSACertTuple, privateKey *rsa.PrivateKey, hosts []string) (testhelper.RSACertTuple, []byte, error) { + rsaLeafCertTuple := testhelper.GetRSACertTupleWithPK(privateKey, hosts[0]+"LeafCA", rsaRootCertTuple) + return rsaLeafCertTuple, generateCertPEM(&rsaLeafCertTuple), nil } From 573d3746d155ddc175f2a612cc95c3be6b9ee05d Mon Sep 17 00:00:00 2001 From: Patrick Zheng Date: Wed, 27 Jul 2022 12:56:17 +0800 Subject: [PATCH 4/6] rmv debugging log Signed-off-by: Patrick Zheng --- cmd/notation/cert_gen.go | 1 - 1 file changed, 1 deletion(-) diff --git a/cmd/notation/cert_gen.go b/cmd/notation/cert_gen.go index c77458b65..ffc687c42 100644 --- a/cmd/notation/cert_gen.go +++ b/cmd/notation/cert_gen.go @@ -116,7 +116,6 @@ func generateCertPEM(rsaCertTuple *testhelper.RSACertTuple) []byte { // generateTestRootCert generates a self-signed root certificate func generateTestRootCert(hosts []string, bits int) (testhelper.RSACertTuple, []byte, error) { - fmt.Println("testing...") priv, err := rsa.GenerateKey(rand.Reader, bits) if err != nil { return testhelper.RSACertTuple{}, nil, fmt.Errorf("failed to generate root key: %v", err) From 3b925529de5d32cb737087c12b9c9066edd6bc96 Mon Sep 17 00:00:00 2001 From: Patrick Zheng Date: Wed, 3 Aug 2022 10:42:23 +0800 Subject: [PATCH 5/6] updated dependencies to most current versions Signed-off-by: Patrick Zheng --- cmd/notation/pull.go | 4 +- go.mod | 10 ++-- go.sum | 125 ++++--------------------------------------- pkg/cache/pull.go | 2 +- 4 files changed, 18 insertions(+), 123 deletions(-) diff --git a/cmd/notation/pull.go b/cmd/notation/pull.go index 3dc7138a8..1c1027df3 100644 --- a/cmd/notation/pull.go +++ b/cmd/notation/pull.go @@ -74,7 +74,7 @@ func runPull(command *cobra.Command, opts *pullOpts) error { sigDigest := sigManifest.Blob.Digest if path != "" { outputPath := filepath.Join(path, sigDigest.Encoded()+config.SignatureExtension) - sig, err := sigRepo.Get(command.Context(), sigDigest) + sig, err := sigRepo.GetBlob(command.Context(), sigDigest) if err != nil { return fmt.Errorf("get signature failure: %v: %v", sigDigest, err) } @@ -102,7 +102,7 @@ func pullSignatureStrict(ctx context.Context, opts *pullOpts, sigRepo notationre return fmt.Errorf("invalid signature digest: %v", err) } - sig, err := sigRepo.Get(ctx, sigDigest) + sig, err := sigRepo.GetBlob(ctx, sigDigest) if err != nil { return fmt.Errorf("get signature failure: %v: %v", sigDigest, err) } diff --git a/go.mod b/go.mod index 9e18edeef..a003b368e 100644 --- a/go.mod +++ b/go.mod @@ -3,10 +3,10 @@ module github.com/notaryproject/notation go 1.18 require ( - github.com/distribution/distribution/v3 v3.0.0-20210804104954-38ab4c606ee3 + github.com/distribution/distribution/v3 v3.0.0-20220729163034-26163d82560f github.com/docker/docker-credential-helpers v0.6.4 - github.com/notaryproject/notation-core-go v0.0.0-20220712013708-3c4b3efa03c5 - github.com/notaryproject/notation-go v0.9.0-alpha.1.0.20220727090134-7af715044cfd + github.com/notaryproject/notation-core-go v0.0.0-20220728174113-1d963fd57141 + github.com/notaryproject/notation-go v0.9.0-alpha.1.0.20220802200409-6312370a3526 github.com/opencontainers/go-digest v1.0.0 github.com/spf13/cobra v1.5.0 github.com/spf13/pflag v1.0.5 @@ -19,6 +19,6 @@ require ( github.com/opencontainers/distribution-spec/specs-go v0.0.0-20220620172159-4ab4752c3b86 // indirect github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799 // indirect github.com/oras-project/artifacts-spec v1.0.0-rc.2 // indirect - golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect - golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect + golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect + golang.org/x/sys v0.0.0-20220731174439-a90be440212d // indirect ) diff --git a/go.sum b/go.sum index c6ae25817..e957c79e7 100644 --- a/go.sum +++ b/go.sum @@ -1,147 +1,42 @@ -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/go-autorest v10.8.1+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= -github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/aws/aws-sdk-go v1.34.9/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= -github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= -github.com/bshuster-repo/logrus-logstash-hook v1.0.0/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk= -github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd/go.mod h1:2oa8nejYd4cQ/b0hMIopN0lCRxU0bueqREvZLWFrtK8= -github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b/go.mod h1:obH5gd0BsqsP2LwDJ9aOkm/6J86V6lyAXCoQWGw3K50= -github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/danieljoos/wincred v1.1.0/go.mod h1:XYlo+eRTsVA9aHGp7NGjFkPla4m+DCL7hqDjlFjiygg= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0= -github.com/dgrijalva/jwt-go v0.0.0-20170104182250-a601269ab70c/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/distribution/distribution/v3 v3.0.0-20210804104954-38ab4c606ee3 h1:rEK0juuU5idazw//KzUcL3yYwUU3DIe2OnfJwjDBqno= -github.com/distribution/distribution/v3 v3.0.0-20210804104954-38ab4c606ee3/go.mod h1:gt38b7cvVKazi5XkHvINNytZXgTEntyhtyM3HQz46Nk= -github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= +github.com/distribution/distribution/v3 v3.0.0-20220729163034-26163d82560f h1:3NCYdjXycNd/Xn/iICZzmxkiDX1e1cjTHjbMAz+wRVk= +github.com/distribution/distribution/v3 v3.0.0-20220729163034-26163d82560f/go.mod h1:28YO/VJk9/64+sTGNuYaBjWxrXTPrj0C0XmgTIOjxX4= github.com/docker/docker-credential-helpers v0.6.4 h1:axCks+yV+2MR3/kZhAmy07yC56WZ2Pwu/fKWtKuZB0o= github.com/docker/docker-credential-helpers v0.6.4/go.mod h1:ofX3UI0Gz1TteYBjtgs07O36Pyasyp66D2uKT7H8W1c= -github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= -github.com/docker/go-metrics v0.0.1/go.mod h1:cG1hvH2utMXtqgqqYE9plW6lDxS3/5ayHzueweSI3Vw= -github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE= -github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/golang-jwt/jwt/v4 v4.4.2 h1:rcc4lwaZgFMCZ5jxF9ABolDcIHdBytAFgqFPbSJQAYs= github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/gomodule/redigo v1.8.2/go.mod h1:P9dn9mFrCBvWhGE1wpxx6fgq7BAeLBk+UUUzlpkBYO0= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= -github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/jmespath/go-jmespath v0.3.0/go.mod h1:9QtRXoHjLGCJ5IBSaohpXITPlowMeeYCZ7fLUTSywik= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/marstr/guid v1.1.0/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM= -github.com/notaryproject/notation-core-go v0.0.0-20220712013708-3c4b3efa03c5 h1:tQ+lwjnQb4gD/a3YBlS7GmTEccW1w9nWem5fB3mITcg= -github.com/notaryproject/notation-core-go v0.0.0-20220712013708-3c4b3efa03c5/go.mod h1:n+UjcUoYhvawO/JW5JfZerUUsGbHYTd4wH8ndGeeyas= +github.com/notaryproject/notation-core-go v0.0.0-20220728174113-1d963fd57141 h1:VtrElctZUBC9bJlvELU16v7BrElZm8lZYFY1F71rfRg= +github.com/notaryproject/notation-core-go v0.0.0-20220728174113-1d963fd57141/go.mod h1:n+UjcUoYhvawO/JW5JfZerUUsGbHYTd4wH8ndGeeyas= github.com/notaryproject/notation-go v0.9.0-alpha.1.0.20220727090134-7af715044cfd h1:hJ7afZAl7cOi75u/qfpEHhXpEbcZVBkICA7tWlEG94I= github.com/notaryproject/notation-go v0.9.0-alpha.1.0.20220727090134-7af715044cfd/go.mod h1:Rls6mRUjflVG0sVjVp6L9GpWFB/q0N3Aws7fI/Am0hc= +github.com/notaryproject/notation-go v0.9.0-alpha.1.0.20220802200409-6312370a3526 h1:fS+KCElDiaIE8fJLS/gB9vN6bkiNoh9GOEoAIrKgTWU= +github.com/notaryproject/notation-go v0.9.0-alpha.1.0.20220802200409-6312370a3526/go.mod h1:Rls6mRUjflVG0sVjVp6L9GpWFB/q0N3Aws7fI/Am0hc= github.com/opencontainers/distribution-spec/specs-go v0.0.0-20220620172159-4ab4752c3b86 h1:Oumw+lPnO8qNLTY2mrqPJZMoGExLi/0h/DdikoLTXVU= github.com/opencontainers/distribution-spec/specs-go v0.0.0-20220620172159-4ab4752c3b86/go.mod h1:aA4vdXRS8E1TG7pLZOz85InHi3BiPdErh8IpJN6E0x4= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= -github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799 h1:rc3tiVYb5z54aKaDfakKn0dDjIyPpTtszkjuMzyt7ec= github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/oras-project/artifacts-spec v1.0.0-rc.2 h1:9SMCNSxkJEHqWGDiMCuy6TXHgvjgwXGdXZZGXLKQvVE= github.com/oras-project/artifacts-spec v1.0.0-rc.2/go.mod h1:Xch2aLzSwtkhbFFN6LUzTfLtukYvMMdXJ4oZ8O7BOdc= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU= github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs= -github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA= -github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20200128174031-69ecbb4d6d5d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -google.golang.org/api v0.0.0-20160322025152-9bf6e6e569ff/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/cloud v0.0.0-20151119220103-975617b05ea8/go.mod h1:0H1ncTHf11KCFhTc/+EFRbzSCOZx+VUbRMk55Yv5MYk= -google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +golang.org/x/sys v0.0.0-20220731174439-a90be440212d h1:Sv5ogFZatcgIMMtBSTTAgMYsicp25MXBubjXNDKwm80= +golang.org/x/sys v0.0.0-20220731174439-a90be440212d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20141024133853-64131543e789/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= oras.land/oras-go/v2 v2.0.0-rc.1.0.20220727034506-eb13fdfeefa6 h1:fbJtzJbpZCtdaAvjPvjlTf8CGsUE1+mClxyh/MPne6I= diff --git a/pkg/cache/pull.go b/pkg/cache/pull.go index 783f40247..b02cfcfba 100644 --- a/pkg/cache/pull.go +++ b/pkg/cache/pull.go @@ -25,7 +25,7 @@ func PullSignature(ctx context.Context, sigRepo registry.SignatureRepository, ma } // fetch remote if not cached - sig, err := sigRepo.Get(ctx, sigDigest) + sig, err := sigRepo.GetBlob(ctx, sigDigest) if err != nil { return fmt.Errorf("get signature failure: %v: %v", sigDigest, err) } From 4ee46d6be7e0620f8dc043292dce7dc0b71dd782 Mon Sep 17 00:00:00 2001 From: Patrick Zheng Date: Thu, 4 Aug 2022 10:12:25 +0800 Subject: [PATCH 6/6] update per code review Signed-off-by: Patrick Zheng --- cmd/notation/cert_gen.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/notation/cert_gen.go b/cmd/notation/cert_gen.go index eb7b1d79b..cfb654cef 100644 --- a/cmd/notation/cert_gen.go +++ b/cmd/notation/cert_gen.go @@ -115,12 +115,12 @@ func generateTestRootCert(hosts []string, bits int) (testhelper.RSACertTuple, [] if err != nil { return testhelper.RSACertTuple{}, nil, fmt.Errorf("failed to generate root key: %v", err) } - rsaRootCertTuple := testhelper.GetRSACertTupleWithPK(priv, hosts[0]+"RootCA", nil) + rsaRootCertTuple := testhelper.GetRSACertTupleWithPK(priv, hosts[0]+" CA", nil) return rsaRootCertTuple, generateCertPEM(&rsaRootCertTuple), nil } // generateTestLeafCert generates the leaf certificate func generateTestLeafCert(rsaRootCertTuple *testhelper.RSACertTuple, privateKey *rsa.PrivateKey, hosts []string) (testhelper.RSACertTuple, []byte, error) { - rsaLeafCertTuple := testhelper.GetRSACertTupleWithPK(privateKey, hosts[0]+"LeafCA", rsaRootCertTuple) + rsaLeafCertTuple := testhelper.GetRSACertTupleWithPK(privateKey, hosts[0], rsaRootCertTuple) return rsaLeafCertTuple, generateCertPEM(&rsaLeafCertTuple), nil }