Last active
June 17, 2016 05:43
-
-
Save nojimage/8661202 to your computer and use it in GitHub Desktop.
OpenSSL 秘密鍵とCSRを一緒に生成するシェルスクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#Common Name (eg, your name or your server's hostname) | |
CN="ssl.example.com" | |
# Country Name (2 letter code) | |
C="JP" | |
# State or Province Name (full name) | |
ST="Fukuoka" | |
# Locality Name (eg, city) | |
L="Fukuoka" | |
# Organization Name (eg, company) | |
O="Example Company co,ltd." | |
# Organizational Unit Name (eg, section) | |
OU="Web" | |
csrfile=$CN.csr | |
pkeyfile=$CN.key | |
subject="/C=$C/ST=$ST/L=$L/O=$O/OU=$OU/CN=$CN" | |
if [ -f $pkeyfile ] ; then | |
echo "Error: Private Key already exists." | |
exit | |
fi | |
openssl req -new -sha256 -newkey rsa:2048 -nodes -out $csrfile -keyout $pkeyfile -subj "$subject" | |
# CHECK modules | |
openssl req -in $csrfile -text | |
openssl rsa -in $pkeyfile -text | |
#cat $pkeyfile $csrfile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
SHA2(sha256) 対応