Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating CSR with OpenSSL hangs

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:

enter image description here

Just hands there, doesn't ask about country code, etc..

like image 951
katit Avatar asked Sep 19 '13 22:09

katit


1 Answers

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.

like image 119
Zuhayer Tahir Avatar answered Oct 05 '22 07:10

Zuhayer Tahir