「マイクロソフト系技術情報 Wiki」は、「Open棟梁Project」,「OSSコンソーシアム .NET開発基盤部会」によって運営されています。
目次 †
概要 †
- SSL/TLSプロトコルのOSS。
- C言語で開発されているため、クロスプラットフォーム。
証明書操作 †
証明書生成から、色々な証明書操作が可能。
各種証明書操作 †
- 証明書署名要求(*.csr)の生成
証明書署名要求(CSR: Certificate Signing Request)
- 証明書の生成(*.crt, *.cer)の生成
- 証明書(CRT: CERTIFICATE)
- *.crt: Unix or Linux
- *.cer: Windows
- *.pfxから単離
- 証明書(*.cer or *.pem)
- 公開鍵(*.key or *.pem)
バイナリ形式ファイルをpem化できる。
デバッグ †
- 中身をダンプできるので、これを使ってデバッグできる。
- これにより、X509Certificate、X509Certificate2等の問題を切り分けられる。
暗号化ライブラリ †
ユーティリティに暗号化ライブラリを含む。
C言語 †
#include <openssl/evp.h>
#include <openssl/aes.h>
各言語 †
- Ruby
OpenSSL::Cipherクラスなど。
詳細 †
証明書操作(RSA) †
基本 †
in, outを拡張子付きで明示することで制御した方がイイ。
- 入出力フォーマット
- -inform DER|PEM|NET
入力ファイルの書式(拡張子から自動判別する)
- -outform DER|PEM|NET
出力ファイルの書式(拡張子から自動判別する)
- 入出力ファイル
デフォルトは、標準出力
- -in filename
入力する証明書のファイル名を指定。
- -out filename
出力する証明書のファイル名を指定。
- 出力方式
- -text
テキスト形式で出力
- -noout
出力しない
*.pfxの生成 †
- 証明書署名要求(CSR: Certificate Signing Request)の生成
最低限、「Common Name(CN)」さえ入力されていれば、通る。
>openssl req -new -key private-key.pem > csr.csr
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]:.
State or Province Name (full name) [Some-State]:.
Locality Name (eg, city) []:.
Organization Name (eg, company) [Internet Widgits Pty Ltd]:.
Organizational Unit Name (eg, section) []:.
Common Name (e.g. server FQDN or YOUR name) []:x
Email Address []:.
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:.
An optional company name []:.
*.cer に変換 †
'*.pfxから、公開鍵 or 証明書を出力
*.pem に変換 †
暗号化ライブラリ (.NET) †
.NET Standardでは、OpenSSLベースのプロバイダも提供され始めている
(.NET Platform Extensions?の 2.1以上で使用できる模様)。
プロバイダ †
以下のプロバイダがOpenSsl?ベースのプロバイダとして提供されいている。
https://github.com/dotnet/corefx/tree/master/src/System.Security.Cryptography.OpenSsl/src/System/Security/Cryptography
- RSAOpenSsl?
- DSAOpenSsl?
- ECDiffieHellmanOpenSsl?
- ECDsaOpenSsl?
ネイティブ実装 †
NuGetで検索すると以下のようなLinuxディストリビューション毎のネイティブ実装がある事を確認できる。
https://www.nuget.org/packages?q=runtime.native.System.Security.Cryptography.OpenSsl
# | 名前空間 |
プラットフォーム | ・・・ |
1 | runtime.debian.8-x64.runtime.native | .System.Security.Cryptography.OpenSsl? |
2 | runtime.opensuse.42.1-x64.runtime.native | .System.Security.Cryptography.OpenSsl? |
3 | runtime.rhel.7-x64.runtime.native | .System.Security.Cryptography.OpenSsl? |
4 | runtime.fedora.24-x64.runtime.native | .System.Security.Cryptography.OpenSsl? |
5 | runtime.opensuse.13.2-x64.runtime.native | .System.Security.Cryptography.OpenSsl? |
6 | runtime.ubuntu.14.04-x64.runtime.native | .System.Security.Cryptography.OpenSsl? |
7 | runtime.fedora.23-x64.runtime.native | .System.Security.Cryptography.OpenSsl? |
8 | runtime.osx.10.10-x64.runtime.native | .System.Security.Cryptography.OpenSsl? |
9 | runtime.ubuntu.16.04-x64.runtime.native | .System.Security.Cryptography.OpenSsl? |
10 | runtime.ubuntu.16.10-x64.runtime.native | .System.Security.Cryptography.OpenSsl? |
11 | runtime.opensuse.42.3-x64.runtime.native | .System.Security.Cryptography.OpenSsl? |
12 | runtime.fedora.28-x64.runtime.native | .System.Security.Cryptography.OpenSsl? |
13 | runtime.ubuntu.18.04-x64.runtime.native | .System.Security.Cryptography.OpenSsl? |
14 | runtime.debian.9-x64.runtime.native | .System.Security.Cryptography.OpenSsl? |
15 | runtime.fedora.27-x64.runtime.native | .System.Security.Cryptography.OpenSsl? |
その他の証明書 †
DSA証明書 †
手順 †
ECDSA証明書 †
prime256v1 でCSR を作成する。
(現時点では、prime256v1, secp384r1, secp521r1が各環境で使い物になるレベルらしい)
手順 †
SSLサーバ証明書 †
SSLクライアント証明書 †
参考 †
証明書操作 †
基本操作 †
DSA証明書生成 †
ECDSA証明書生成 †
@IT †
Qiita †
Stack Overflow †
その他 †
- SSL サーバ証明書:DigiCert?(デジサート)
galife †
Tags: :セキュリティ, :暗号化, :証明書, :.NET Core, :.NET Standard