Skip to content

Instantly share code, notes, and snippets.

Last active May 2, 2024 14:26
Show Gist options
  • Save turtlepod/e94928cddbfc46cfbaf8c3e5856577d0 to your computer and use it in GitHub Desktop.
Save turtlepod/e94928cddbfc46cfbaf8c3e5856577d0 to your computer and use it in GitHub Desktop.
@echo off
set /p domain="Enter Domain: "
set OPENSSL_CONF=../conf/openssl.cnf
if not exist .\%domain% mkdir .\%domain%
..\bin\openssl req -config cert.conf -new -sha256 -newkey rsa:2048 -nodes -keyout %domain%\server.key -x509 -days 3650 -out %domain%\server.crt
echo -----
echo The certificate was provided.
Copy link

thank you! ;)

Copy link

hi, it failed,

it says "The system cannot find the path specified."

but it created the folder successfully

Copy link

@abgrxenda I was having the same problem. It was running the batch file inside the system32 directory and creating the new directory there. To fix this, I added the following to the top of the batch file (right under @echo off):
cd %~dp0

Copy link

ali80 commented Apr 11, 2020

It just worked, yes!

Copy link

Though everything was exactly same still I am receiving following error on latest firefox

Secure Connection Failed

An error occurred during a connection to SSL received a record that exceeded the maximum permissible length.


The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.
Please contact the website owners to inform them of this problem.

Copy link

av8er71 commented Aug 2, 2020

Dude! Thank you so much! I was searching everywhere for a fix for this. I couldn't create a key with openSSL using git bash and was losing my mind. This literally took me 5 minutes. You rock!

Copy link

airways commented Aug 2, 2020

Posted a revision for the current version of XAMPP:

Copy link

I have forked a new revision with a piece of code that avoids replacing the source cert.conf file when creating a new certificate.

Copy link

aamir7hassan commented Apr 27, 2021

Please set your path at line 3. set OPENSSL_CONF=../conf/openssl.cnf according to your directory.

I just updated my path and it worked best.

Copy link

anil3a commented Jun 15, 2021

I fixed my issue by fixing two paths of openssl for my Xampp with PHP 7.4 at C:/xampp with this file located at C:/xampp/cert/make-cert.bat

set OPENSSL_CONF=../apache/conf/openssl.cnf
..\apache\bin\openssl req -config cert.conf -new -sha256 -newkey rsa:2048 -nodes -keyout %domain%\server.key -x509 -days 365 -out %domain%\server.crt

Copy link

Hello everyone, here is the solution for your problem:

What has been changed? Two paths have been changed (for more information see the gist).
I published this solution 4 months ago on my github, but forgot to send it here, which is why I am sending this message so late.

Copy link

where cert.conf came from ?

Copy link

cert.conf is created in this article which the script is based on:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment