Fix ECDSA certificate issuance with ACME issuer

Signed-off-by: James Munnelly <james@munnelly.eu>
This commit is contained in:
James Munnelly
2019-06-06 17:04:17 +01:00
parent 1205dc5ef8
commit e75bd2f3ef
3 changed files with 23 additions and 2 deletions
+2 -2
View File
@@ -294,12 +294,12 @@ func (a *Acme) getCertificatePrivateKey(ctx context.Context, crt *v1alpha1.Certi
log.V(4).Info("Generating new private key")
// generate a new private key.
rsaKey, err := pki.GenerateRSAPrivateKey(2048)
privateKey, err := pki.GeneratePrivateKeyForCertificate(crt)
if err != nil {
return nil, false, err
}
return rsaKey, true, nil
return privateKey, true, nil
}
func (a *Acme) createNewOrder(ctx context.Context, crt *v1alpha1.Certificate, template *v1alpha1.Order, key crypto.Signer) error {
@@ -24,6 +24,7 @@ go_library(
"//test/e2e/framework/matcher:go_default_library",
"//test/e2e/suite/issuers/acme/dnsproviders:go_default_library",
"//test/e2e/util:go_default_library",
"//test/unit/gen:go_default_library",
"//test/util/generate:go_default_library",
"//vendor/github.com/onsi/ginkgo:go_default_library",
"//vendor/github.com/onsi/gomega:go_default_library",
@@ -38,6 +38,7 @@ import (
"github.com/jetstack/cert-manager/test/e2e/framework/log"
. "github.com/jetstack/cert-manager/test/e2e/framework/matcher"
"github.com/jetstack/cert-manager/test/e2e/util"
"github.com/jetstack/cert-manager/test/unit/gen"
"github.com/jetstack/cert-manager/test/util/generate"
)
@@ -158,6 +159,25 @@ var _ = framework.CertManagerDescribe("ACME Certificate (HTTP01)", func() {
Expect(err).NotTo(HaveOccurred())
})
It("should obtain a signed ecdsa certificate with a single CN from the ACME server", func() {
certClient := f.CertManagerClientSet.CertmanagerV1alpha1().Certificates(f.Namespace.Name)
By("Creating a Certificate")
cert := gen.Certificate(certificateName,
gen.SetCertificateSecretName(certificateSecretName),
gen.SetCertificateIssuer(v1alpha1.ObjectReference{
Name: issuerName,
}),
gen.SetCertificateDNSNames(acmeIngressDomain),
gen.SetCertificateKeyAlgorithm(v1alpha1.ECDSAKeyAlgorithm),
)
_, err := certClient.Create(cert)
Expect(err).NotTo(HaveOccurred())
By("Verifying the Certificate is valid and of type ECDSA")
err = h.WaitCertificateIssuedValid(f.Namespace.Name, certificateName, time.Minute*5)
Expect(err).NotTo(HaveOccurred())
})
It("should obtain a signed certificate for a long domain using http01 validation", func() {
certClient := f.CertManagerClientSet.CertmanagerV1alpha1().Certificates(f.Namespace.Name)