I'm trying to create batch file for WINDOWS to automate creation of self-signed certificate. Following this tutorial: http://www.xenocafe.com/tutorials/linux/centos/openssl/self_signed_certificates/index.php
I wrote following script:
@echo off
REM This script takes name passed in and generates private and public keys using OpenSSL
REM First parameter expects name
IF "%1"=="" GOTO EXIT
ECHO Generating PRIVATE key ------------------------------
openssl genrsa -des3 -out %1.key 1024
ECHO Creating certificate sign request (CSR) -------------
openssl req -key %1.key -out %1.csr
ECHO Signing CSR 100 years -------------------------------
openssl x509 -req -days 36500 -in %1.csr -signkey %1.key -out %1.crt
ECHO Create a kopy of password-protected key -------------
cp %1.key %1.key.secure
ECHO Remove password from private key --------------------
openssl rsa -in %1.key.secure -out %1.key
Idea is to get private key with no password and public key for distribution. I run CMD prompt under admin rights and here is what I get:
Just hands there, doesn't ask about country code, etc..
I had the same issue, 6 months ago, using GitBash
in Windows 7, After hours of search this solved my issue:
winpty openssl genrsa -out ../private.pem -aes256 4096
Let me know if it helps anyone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With