オレオレSSL証明書
情報はググれば沢山でてくるので割愛。久々につくる機会があったので手順を自分用にメモ。
秘密鍵の作成
1
2
3
4
5
6
7
8
| $ openssl genrsa -aes256 -out ./server.key 2048
Generating RSA private key, 2048 bit long modulus
..............................................................+++
.......+++
unable to write 'random state'
e is 65537 (0x10001)
Enter pass phrase for ./server.key:
Verifying - Enter pass phrase for ./server.key:
|
CSRの作成
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
| $ openssl req -new -sha256 -key ./server.key -out ./server.csr
Enter pass phrase for ./server.key:
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:JP
State or Province Name (full name) [Some-State]:TOKYO
Locality Name (eg, city) []:MINATO-KU
Organization Name (eg, company) [Internet Widgits Pty Ltd]:COMPANY
Organizational Unit Name (eg, section) []:DEV
Common Name (e.g. server FQDN or YOUR name) []:*.local.com
Email Address []:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
|
CRT作成
1
| $ openssl x509 -in ./server.csr -days 3650 -req -signkey ./server.key > ./server.crt
|
パスワード解除
1
2
| $ cp ./server.key ./server.key.org
$ openssl rsa -in ./server.key.org -out ./server.key
|