LoginSignup
4
7

More than 5 years have passed since last update.

OpenSSLの暗号強度をSHA256で作ってみるぽよ

Last updated at Posted at 2016-12-01

2016年もあと僅か。
ここ2年ほどで騒がれていたSHA-1証明書が各ブラウザで利用ができなくなる2017年まであと僅かです。

alt

まだSHA-1運用をしている。。。
まあそんなことはないと思いますが、久々にSSLの作成手順を記載したいと思います。

秘密鍵作成

### 秘密鍵を作成します。
$ openssl genrsa -out priveteKey.key 2048 -sha256
### 作成された鍵を確認します。
$ openssl rsa -noout -text -in priveteKey.key  |fgrep Private-Key
Private-Key: (2048 bit)

コマンドの説明は以下の通りです。

項目 説明
2048 鍵長
des3 パスプレーズ入力

CSR作成

### CSR鍵を作成します。
$ sudo openssl req -new -key priveteKey.key -sha256 -out mofumofu-com.csr -subj "/C=JP/ST=Tokyo/L=Shinjyuku/O=Mofumofu Inc./OU=mofu division/CN=mofumofu.com/emailAddress=account@mofumofu.com"

### 作成した、CSRファイルをチェックします。
$ openssl req -text -noout -in mofumofu-com.csr |grep -A5 'Subject Public'

### 作成した、CRTファイルをチェックします。
$ openssl x509 -text -noout -in  mofumofu-com.crt |grep -A5 'Subject Public'

上記で鍵の作成は完了します。

nginxの設定の場合は以下のようにファイルをしてすると動くかと思います。

server {
  listen       443 ssl http2;
  server_name  mofumofu.com;

  ssl on;
  ssl_certificate /usr/local/nginx/conf/mofumofu-com.crt;
  ssl_certificate_key /usr/local/nginx/conf/priveteKey.key;

[snip]
}
$ nginx -v
nginx version: nginx/1.10.1

$ curl -I https://mofumofu.com
HTTP/1.1 200 OK

SSLの証明書購入はRapidSSLかな。。。

4
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
7