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?

More than 3 years have passed since last update.

Macでopensslの利用を試みましたが認証局の設置まで完遂できず、、

Posted at

opensslとは

OpenSSL
OpenSSL(オープン・エスエスエル)は、SSLプロトコル・TLSプロトコルの、オープンソースで開発・提供されるソフトウェアである。

Transport_Layer_Security
Transport Layer Security(トランスポート・レイヤー・セキュリティ、TLS)は、インターネットなどのコンピュータネットワークにおいてセキュリティを要求される通信を行うためのプロトコルである。主な機能として、通信相手の認証、通信内容の暗号化、改竄の検出を提供する。

OpenSSLのGitリポジトリは以下

OpenSSL Project Pages
Git Repository
https://github.com/openssl/openssl

opensslのインストール

brew install openssl
$ openssl version
OpenSSL 1.1.1c  28 May 2019

お試し利用

"testtest.key"という名前の秘密鍵を作成する

$ openssl genrsa -des3 2048 > testtest.key
Generating RSA private key, 2048 bit long modulus (2 primes)
..................................................+++++
............................................................................+++++
e is 65537 (0x010001)
Enter pass phrase:
Verifying - Enter pass phrase:

"testtest.key"をベースにした"testtest.csr"というCSRを作成する

$ openssl req -new -key testtest.key -sha256 -out testtest.csr
Enter pass phrase for www.proudit.jp.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.
-----

csrファイルの確認

$ openssl req -text -noout -in testtest.csr 
Certificate Request:
    Data:
        Version: 1 (0x0)
        Subject: C = JP, ST = ..., L = ..., O = ..., OU = ..., CN = ..., emailAddress = ...
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                RSA Public-Key: (2048 bit)
                Modulus:
                    ...
                Exponent: 65537 (0x10001)
        Attributes:
            unstructuredName         :...
            challengePassword        :...
    Signature Algorithm: sha256WithRSAEncryption
         ...

秘密鍵とは

秘密鍵
秘密鍵とは、公開鍵暗号で使用される一対の暗号鍵の組のうち、相手方に渡したり一般に公開せず、所有者が管理下に置いて秘匿する必要がある鍵。もう一方の鍵は公開して相手方が利用するもので「公開鍵」(public key)と呼ばれる。

CSRファイルとは

申込時に用意しなくてはいけないCSRファイルとは何でしょうか?
CSRとは、「Certificate Signing Request」 の頭文字を取ったもので、認証局に対し、SSLサーバ証明書への署名を申請する内容です。CSR には「公開鍵」とその所有者情報、及び申請者が対応する秘密鍵を持っていることを示すために申請者の署名が記載されています。
認証局は証明書にその所有者情報を署名することで、所有者の存在を証明しています。
SSL 通信ではサーバが公開鍵を提示し、これを用いて暗号化通信を開始します。SSLサーバ証明書は、「公開鍵」及びその対となる「秘密鍵」の所有者情報が記述されたものです。

プライベート認証局を作成

通信相手を認証するためのプライベート認証局を作成する
opensslインストール時に同時にインストールされるCA.shを実行するとよい

$ mkdir -p ~/openssl-test
$ cd ~/openssl-test
$ cp /usr/local/etc/openssl/misc/CA.sh .
$ ./CA.sh

詳細は以下を参考にさせて頂きます

OpenSSL で構築した認証局 (CA) でサーバ証明書を発行する方法
【Linux】CAサーバーを作成してオレオレ証明書認証のSSLサーバーを構築する!【shellscript】
プライベート認証局の証明書、サーバー証明書、クライアント証明書の作成方法について

opensslのアップデート

brew update
brew upgrade openssl

参考

OpenSSLを利用したCA認証局の構築
Ubuntu 18.04 LTS で OpenSSL を使ったプライベート認証局&証明書を作る
OpenSSL で SSL自己証明書を発行する手順
Webサーバ証明書インストール手順(Apache+OpenSSL)
オレオレ証明書をopensslで作る(詳細版)
[Mac OS X] OpenSSLバージョンの更新
OpenSSL
OpenSSL Project Pages
Git Repository
https://github.com/openssl/openssl
OpenSSL で構築した認証局 (CA) でサーバ証明書を発行する方法
【Linux】CAサーバーを作成してオレオレ証明書認証のSSLサーバーを構築する!【shellscript】
プライベート認証局の証明書、サーバー証明書、クライアント証明書の作成方法について

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?