Skip to content

Commit

Permalink
add support for create cert with CSR data
Browse files Browse the repository at this point in the history
  • Loading branch information
fszlin committed Dec 19, 2016
1 parent ef48698 commit 1ade2b1
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/Certes/AcmeClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,10 @@ public async Task<AcmeResult<Challenge>> CompleteChallenge(Challenge authChallen
/// <summary>
/// Creates a new certificate.
/// </summary>
/// <param name="csrProvider">The certificate signing request (CSR) provider.</param>
/// <param name="csrBytes">The certificate signing request data.</param>
/// <returns>The certificate issued.</returns>
public async Task<AcmeCertificate> NewCertificate(ICertificationRequestBuilder csrProvider)
public async Task<AcmeCertificate> NewCertificate(byte[] csrBytes)
{
var csrBytes = csrProvider.Generate();

var payload = new Certificate
{
Csr = JwsConvert.ToBase64String(csrBytes),
Expand All @@ -252,7 +250,6 @@ public async Task<AcmeCertificate> NewCertificate(ICertificationRequestBuilder c
var cert = new AcmeCertificate
{
Raw = result.Raw,
Key = csrProvider.Export(),
Links = result.Links,
Location = result.Location,
ContentType = result.ContentType
Expand Down Expand Up @@ -284,6 +281,19 @@ public async Task<AcmeCertificate> NewCertificate(ICertificationRequestBuilder c
return cert;
}

/// <summary>
/// Creates a new certificate.
/// </summary>
/// <param name="csrProvider">The certificate signing request (CSR) provider.</param>
/// <returns>The certificate issued.</returns>
public async Task<AcmeCertificate> NewCertificate(ICertificationRequestBuilder csrProvider)
{
var csrBytes = csrProvider.Generate();
var cert = await NewCertificate(csrBytes);
cert.Key = csrProvider.Export();
return cert;
}

/// <summary>
/// Revokes the certificate.
/// </summary>
Expand Down

0 comments on commit 1ade2b1

Please sign in to comment.