From 11771469d13a736a182db12314579d5495822091 Mon Sep 17 00:00:00 2001 From: Rodolphe Breard Date: Mon, 10 Jun 2019 13:07:51 +0200 Subject: [PATCH] Fix the CSR --- acmed/src/acme_proto.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/acmed/src/acme_proto.rs b/acmed/src/acme_proto.rs index 4d9caa1..d0aeb2c 100644 --- a/acmed/src/acme_proto.rs +++ b/acmed/src/acme_proto.rs @@ -7,6 +7,7 @@ use crate::certificate::Certificate; use crate::storage; use acme_common::crypto::Csr; use acme_common::error::Error; +use serde_json::json; use std::fmt; mod account; @@ -179,7 +180,10 @@ pub fn request_certificate(cert: &Certificate, root_certs: &[String]) -> Result< // 11. Finalize the order by sending the CSR let (pub_key, priv_key) = certificate::get_key_pair(cert)?; let domains: Vec = cert.domains.iter().map(|e| e.dns.to_owned()).collect(); - let csr = Csr::new(&pub_key, &priv_key, domains.as_slice())?.to_der_base64()?; + let csr = json!({ + "csr": Csr::new(&pub_key, &priv_key, domains.as_slice())?.to_der_base64()?, + }); + let csr = csr.to_string(); let data_builder = set_data_builder!(account, csr.as_bytes(), order.finalize); let (order, nonce): (Order, String) = http::get_obj(cert, root_certs, &order.finalize, &data_builder, &nonce)?;