5

I am trying to script a solution to automatically submit Base64 CSRs to a Microsoft Certificate Services CA, but keep getting tripped up.

My understanding is that all I should need to specify is a Certificate Template & CSR File and it will spit out a Certificate.

The CSR is for

CN=myserver.ilo.domain.local, OU=ISS, O=Hewlett-Packard Company, L=Houston, ST=Texas, C=US

Which is a HP iLO3 device

certreq -Submit -attrib "CertificateTemplate:Webserver" infile.csr outfile.cer

Running this command however results in:

Certificate Request Processor: The data is invalid. 0x8007000d (WIN32: 13)

Using the web interface for MSCS http://certsvr/certsrv and going through the advanced settings (to set Web Server Certificate) allows me to submit a certificate Request just fine.

Does anyone know where I may be going wrong with certreq?

2

I now have a solution to what was going on, and rather simple.

It turned out that the CSR when being saved to a file was somehow being saved in Unicode Format rather than ANSI & as a result was inserting invalid data into the CSR request.

  • How did you change this – Sujit.Warrier Aug 8 '17 at 5:19
  • I was scripting using powershell, and needed to use -Encoding ascii with the out-file cmdlet – Ben Short Dec 11 '17 at 23:40

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.