0

So I am creating some simple html pages for a school project using Apache, localhost, on windows10. I generated the key and csr and am trying to configure it to localhost by using cnf file called extfile.cnf
the file reads "subjectAltName=DNS:localhost,IP:127.0.0.1"

The command I am using in windows powershell is 'C:\ssl> openssl x509 -req -sha256 -days 365 -in cert.csr -CA ca.pem -CAkey ca-key.pem -out cert.pem -extfile extfile.cnf -CAcreateserial'

I am following an instructional video and everything has been fine until this point and im getting an error that says "x509: Error on line 1 of config file "extfile.cnf"" so there is something wrong and I have tried editing the file several ways and cannot get it to work. the video I am following is here: https://youtu.be/VH4gXcvkmOY I am using windows powershell and have tried in administrator but same result. The relevant part of the video starts at 12 min 40 sec.

any suggestions??

1 Answers1

0

I am using windows powershell ...

Powershell by default outputs to UTF-16, which is not what OpenSSL expects for the input file format. A comment on the video you reference also says this:

James Brasington 1 month ago
Had to convert the file extfile.cnf from UTF-16 to UTF-8 in notpad++ but other than that worked great

A search for the error message you get also leads to this post with a similar error - although the OP here posted the full error message and not just a part of it. This is always recommended. The solution here also was:

For future reference...I found the issue. The extfile.cnf needs to be encoded to UTF-8

See also Changing PowerShell's default output encoding to UTF-8

Steffen Ullrich
  • 114,247
  • 10
  • 131
  • 172