0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【メモ】オレオレ証明書

Last updated at Posted at 2025-02-17

前書

いつもコマンドを忘れてしまうための備忘録。
mkcert使うのが一番楽だが、勝手にインストできないとき用)

  • Ubuntu 24.04.1 (wsl2)
  • OpenSSL 3.0.13 30 Jan 2024 (Library: OpenSSL 3.0.13 30 Jan 2024)

コマンド中のCN(CommonName)など適宜変更すること。

ルート認証局

認証局になる秘密鍵と証明書。

$ openssl req -x509 -newkey rsa:2048 -days 365 -nodes -keyout rootCA.key -out rootCA.crt -subj "/C=JP/ST=Tokyo/L=Minato/CN=local Root CA"

サーバ証明書と秘密鍵

まずは秘密鍵と著名要求(Certificate Signing Request)を作成。

$ openssl req -newkey rsa:2048 -nodes -keyout server.key -out server.csr -subj "/C=JP/ST=Tokyo/L=Minato/CN=localhost"

SAN(SubjectAltName)を設定するためのファイル用意。

[ext.txt]
subjectAltName=DNS:localhost,IP:0.0.0.0

作成した著名要求にルート証明書で著名。

$ openssl x509 -req -days 365 -in server.csr -CA rootCA.crt -CAkey rootCA.key -CAcreateserial -out server.crt -extfile ext.txt

末文

やっぱopensslはコマンドむずすぎる(多すぎる)、以上。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?