我正在尝试为 WINDOWS 创建批处理文件以自动创建自签名证书。按照本教程: http ://www.xenocafe.com/tutorials/linux/centos/openssl/self_signed_certificates/index.php
我写了以下脚本:
@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
想法是获取没有密码的私钥和公钥进行分发。我在管理员权限下运行 CMD 提示符,这是我得到的:
只是手,不问国家代码等。