.NETの署名・暗号化アルゴリズム
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
]
開始行:
「[[マイクロソフト系技術情報 Wiki>http://techinfoofmicros...
-戻る
--[[.NET開発]]
--[[暗号化アルゴリズム]]
* 目次 [#ba3e104c]
#contents
*概要 [#i831ac3c]
[[暗号化アルゴリズム]]は、一通り揃っている。
-乱数生成~
RNGCryptoServiceProvider
-パスワードからのキー生成~
Rfc2898DeriveBytes
-ハッシュ
--暗号ハッシュ([[様々な用途>https://ja.wikipedia.org/wik...
--キー付きハッシュ([[署名・検証>https://ja.wikipedia.org...
-暗号(暗号化・復号化、署名・検証に利用可能)
--秘密鍵・暗号化
---Aes
---DES
---RC2
---Rijndael
---TripleDES
--公開鍵・暗号化
---RSA
---DSA
---ECDsa
--ハイブリッド・暗号化(キー交換)
---RSA
---ECDiffieHellman
-署名(署名・検証に利用可能)
--RSA
--DSA
--ECDsa
-認証
--データの整合性 (MAC)
---HMAC MD5
---HMAC RIPEMD160
---HMAC SHA256
---HMAC SHA384
---HMAC SHA512
---MAC TripleDES
--データのプライバシー(AEAD)~
については自作が必要。
---3DES-CBC
---AES-CBC
---AES-CTR
---AES-CCM
---AES-GCM ★
---AES-GMAC
*.NET Frameworkの暗号化Providerの列挙 [#da2f4388]
**乱数生成、キー生成 [#feec3024]
***乱数生成 [#z6a6e8e6]
-RNGCryptoServiceProviderを使用して、暗号乱数を生成する。
-Membership.GeneratePasswordも下位でRNGCryptoServiceProvi...
-参考
--RNGCryptoServiceProvider クラス (System.Security.Crypto...
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
--GeneratePassword Method~
http://aspnet.4guysfromrolla.com/demos/GeneratePassword.a...
---This demo illustrates how to use the code for ASP.NET ...
--- I 'borrowed' this code from the 2.0 .NET Framework us...
***キー生成 [#ta70b091]
-Rfc2898DeriveBytesを使用して、パスワード ベースのキーを...
-主に、
--キー付きハッシュ(KeyedHashAlgorithm)
--秘密鍵暗号方式(SymmetricAlgorithm)
>のキーを生成する(パスワードをそのまま使用しない)。
-参考
--Rfc2898DeriveBytes クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
**[[ハッシュ化>暗号化アルゴリズム#y6cc34ab]] [#de661712]
***暗号ハッシュ(HashAlgorithm) [#l1894cde]
-HashAlgorithm.Createというファクトリを使用して、~
HashAlgorithm型で扱えば、あまり差異が無く使える。
-[[Managed、CAPI(CSP)、CNG実装>#fde2f12c]]が揃っている。
-HashAlgorithm クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
--MD5 クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
--RIPEMD160 クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
--SHA1 クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
--SHA256 クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
--SHA384 クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
--SHA512 クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
***キー付きハッシュ(KeyedHashAlgorithm) [#x4fe1902]
-KeyedHashAlgorithm.Createというファクトリを使用して、~
KeyedHashAlgorithm型で扱えば、あまり差異が無く使える。~
(ただし、Key指定する場合、個別のコンストラクタを使用する...
-[[Managed実装のみで、CAPI(CSP)、CNG実装は無い>#fde2f12c]...
-KeyedHashAlgorithm クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
--HMAC クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
--MACTripleDES クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
**[[秘密鍵・暗号化>暗号化アルゴリズム#u680ecb7]]方式 [#r4...
***SymmetricAlgorithm [#n8b6a137]
-[[Managed、CAPI(CSP)、CNG実装>#fde2f12c]]の統一性が無い。~
基本、CAPI(CSP)に、CNG・Managed実装が混入しているイメージ。
-SymmetricAlgorithm クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
--Aes クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
--DES クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
--RC2 クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
--Rijndael クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
--TripleDES クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
**[[公開鍵・暗号化>暗号化アルゴリズム#tfda0d72]]方式 [#q0...
***AsymmetricAlgorithm [#id81129e]
- AsymmetricAlgorithmの内、暗号化・復号化が可能な公開鍵暗...
RSAのみ(他のアルゴリズムは、キー交換や署名のみサポート)。
-AsymmetricAlgorithm クラス (System.Security.Cryptography)~
https://docs.microsoft.com/en-us/dotnet/api/system.securi...
--RSA クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
**[[ハイブリッド・暗号化(キー交換)>暗号化アルゴリズム#z...
***AsymmetricKeyExchange [#u0fcff3a]
非対称キー交換フォーマッタ(Formatter)、デフォーマッタ(...
プロバイダをラップして、手続きだけを提供するクラス。
-AsymmetricKeyExchangeFormatter クラス (System.Security.C...
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
--RSAOAEPKeyExchangeFormatter クラス (System.Security.Cry...
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
--RSAPKCS1KeyExchangeFormatter クラス (System.Security.Cr...
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
-AsymmetricKeyExchangeDeformatter クラス (System.Security...
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
--RSAOAEPKeyExchangeDeformatter クラス (System.Security.C...
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
--RSAPKCS1KeyExchangeDeformatter クラス (System.Security....
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
***ECDiffieHellman [#udf3d4f3]
-ECDiffieHellman クラス (System.Security.Cryptography)~
https://docs.microsoft.com/en-us/dotnet/api/system.securi...
--https://docs.microsoft.com/en-us/dotnet/api/system.secu...
--https://docs.microsoft.com/ja-jp/dotnet/api/system.secu...
**署名・検証 [#lf5eb161]
[[デジタル署名>暗号化アルゴリズム#leddd7f0]]
***AsymmetricAlgorithm [#lbe3d6d2]
-RSAだけは、署名・検証だけでなく、暗号化・復号化にも利用...
-[[Managed、CAPI(CSP)、CNG実装>#fde2f12c]]が一通り提供さ...
新しいアルゴリズムは、CNGと[[OpenSSL]]の二択になって行く...
-AsymmetricAlgorithm クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
--RSA クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
--DSA クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
--ECDsa クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
***AsymmetricSignatureFormatter [#ta0f34c9]
-非対称署名フォーマッタ、デフォーマッタ~
プロバイダをラップして、手続きだけを提供するクラス。
--AsymmetricSignatureFormatter クラス (System.Security.Cr...
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---RSAPKCS1SignatureFormatter クラス (System.Security.Cry...
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---DSASignatureFormatter クラス (System.Security.Cryptogr...
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
--AsymmetricSignatureDeformatter クラス (System.Security....
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---RSAPKCS1SignatureDeformatter クラス (System.Security.C...
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---DSASignatureDeformatter クラス (System.Security.Crypto...
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
**追加可能なプロバイダ [#w62a67fc]
***Security.Cryptography [#dc18d317]
昨今(、クロスドメイン認証周りの需要でか)、[[日進月歩で...
***Security.Cryptography.XML [#hb08dcb9]
[[XML署名・暗号]]
*[[.NET Standard]]の暗号化Providerの列挙 [#db4c9ea1]
**.NET Frameworkからの移植 [#i773c894]
-予想外に、[[CSPやCNGのプロバイダ>#fde2f12c]]も移植されて...
-...が、一部含まれないものがある(特にCNG系実装に多い)。
-これら[[CNGのプロバイダの移植>#fde2f12c]]が、今後どう進...
**[[追加のプロバイダ>#u5d4c9e0]] [#b6180c03]
*Managed、CAPI(CSP)、CNG実装とは? [#fde2f12c]
-Managedで終わる名称のProviderは、.NET実装と思われる。
-CryptoServiceProvider (CSP) で終わる名称のProviderは、~
「CryptoAPI Cryptographic Service Providers (CSP ≒ CAPI) ...
-Cryptography Next Generation (CNG) で終わる名称のProvide...
CNG Cryptographic Algorithm Providers実装と思われる。
-Understanding Cryptographic Providers | Microsoft Docs~
https://docs.microsoft.com/ja-jp/windows/desktop/SecCertE...
**CAPI (CSP) [#n13961a2]
-CryptoAPI Cryptographic Service Providers | Microsoft Do...
https://docs.microsoft.com/ja-jp/windows/desktop/SecCertE...
-Cryptographic API - Wikipedia~
https://ja.wikipedia.org/wiki/Cryptographic_API
**CNG [#if785c4b]
-CNG系の暗号化プロバイダの秘密鍵、暗号化操作は、~
CNG キー分離サービスは、分離 LSA プロセスでホストされてい...
CC (Common Criteria)国際標準規格の要求に従ってキープロセ...
-分離 LSA プロセス
--仮想化ベースのセキュリティを使って保護され、OSの他の部...
--CNGプロバイダを使用するプロセスは、[[RPC]]を使って分離 ...
***アルゴリズム [#z76e4427]
-MD5
-Sha1
-Sha256
-Sha384
-Sha512
-Rsa
-ECDsa
--ECDsaP256
--ECDsaP384
--ECDsaP521
-ECDiffieHellman
--ECDiffieHellmanP256
--ECDiffieHellmanP384
--ECDiffieHellmanP521
***参考 [#jf513bd9]
-Cryptography Next Generation~
https://technet.microsoft.com/en-us/library/532ac164-da33...
-CNGとは (Cryptography Next Generation) シーエヌジー: - ...
http://www.sophia-it.com/content/Cryptography+Next+Genera...
-CNG Key Isolation: Windows 7 不要なサービスを無効&停止!~
http://windows7service.spinse.net/category/10277691-1.html
-How to use RSA in .NET: RSACryptoServiceProvider vs. RSA...
https://dusted.codes/how-to-use-rsa-in-dotnet-rsacryptose...
--RSACryptoServiceProviderは独自のキー操作に結びついてい...
--RSACngのキーはCngKeyクラスによって管理され、コンストラ...
-Microsoft Docs
--Algorithm
---CNG Cryptographic Algorithm Providers~
https://docs.microsoft.com/ja-jp/windows/desktop/SecCertE...
---CngAlgorithm クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
--Key
---CNG Key Storage Providers~
https://docs.microsoft.com/ja-jp/windows/desktop/SecCertE...
---CngKey クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
*[[Managed、CSP、CNG>#fde2f12c]]、OpenSSLの選択肢 [#ub3ba...
-.NET Framework の暗号モデル | Microsoft Docs~
https://docs.microsoft.com/ja-jp/dotnet/standard/security...
には、以下のようにある。
***最適な実装を選択可能 [#f3be9d35]
-マネージ実装~
.NET Framework をサポートするすべてのプラットフォームで利...
ただし、マネージ実装はFIPSに認定されておらず、ラッパー ク...
-CAPI 実装~
CSPラッパー。以前のOSで使用可能だが、開発中止となっている。
-CNG 実装~
CNGラッパー。まさに最新の実装であり、新しい開発が行われる。
***.NET Core、Linux [#s0c207f4]
-選択と言うより、~
プラットフォームによって限定的になるもよう。
-例えば、X.509 を使用した際に取得できるRSAプロバイダが、
--.NET FrameworkではRSACsp
--.NET Core on WindowsではRSACng
--.NET Core on Linuxでは、RSAOpenSsl
>になることなどを観測した。
-この辺りは、プラットフォーム依存が強いので、~
クロスプラットフォーム対応は難しい部分がありそう。
-ただし、バージョンが上がるにつれて、~
[[着実に実装の移行・追加が進んでいることを確認できた。>#u...
***性能 [#h1bd7d6f]
-Measuring the performance of AES implementations in .Net...
(AesManaged vs AesCryptoServiceProvider) - CodeProject~
https://www.codeproject.com/Tips/844795/Measuring-the-per...
*参考 [#mf5f8a70]
-Programming .NET Security - O'Reilly Media~
http://shop.oreilly.com/product/9780596004422.do
-Visual Studio C#でファイルを暗号化してみる~
https://qiita.com/hibara/items/c9096376b1d7b5c8e2ae
-How to use RSA in .NET:~
RSACryptoServiceProvider vs. RSACng and good practise pat...
https://dusted.codes/how-to-use-rsa-in-dotnet-rsacryptose...
**ライブラリ [#u5d4c9e0]
***[[OpenSSL]] [#lddc9143]
***[[BouncyCastle]] [#tc1ee636]
***libsodium [#wc22e484]
-C言語で開発された、クロスプラットフォームの暗号化ライブ...
-PHPでは、PECLで提供されていたがコアに標準的に組み込まれ...
-nuget.org
--https://www.nuget.org/packages/libsodium/
--https://www.nuget.org/packages/libsodium-net/
***[[Open 棟梁>https://opentouryo.osscons.jp/index.php?%E...
***参考 [#j0ade641]
-暗号ライブラリの比較 - Wikipedia~
https://ja.wikipedia.org/wiki/%E6%9A%97%E5%8F%B7%E3%83%A9...
**DOBON.NET: VB.NET, C#, 無料ソフトウェア... [#j2316c2c]
http://dobon.net/index.html
-文字列、暗号化: .NET Tips: C#, VB.NET~
http://dobon.net/vb/dotnet/string/index.html
***暗号ハッシュ [#bbfd012a]
-MD5やSHA1などでハッシュ値を計算する: .NET Tips: C#, VB.N...
http://dobon.net/vb/dotnet/string/md5.html
-ファイルのMD5やSHA1などでハッシュ値を計算する: .NET Tips...
http://dobon.net/vb/dotnet/string/filemd5.html
***秘密鍵暗号方式 [#geb60fa1]
-パスワードで文字列を暗号化する: .NET Tips: C#, VB.NET~
http://dobon.net/vb/dotnet/string/encryptstring.html
-パスワードでファイルを暗号化する: .NET Tips: C#, VB.NET~
http://dobon.net/vb/dotnet/string/encryptfile.html
***公開鍵暗号方式 [#icf617f4]
-公開鍵暗号方法で暗号化する: .NET Tips: C#, VB.NET~
http://dobon.net/vb/dotnet/string/rsaencryption.html
***署名・検証 [#f3bcf75f]
-デジタル署名を作成、検証する: .NET Tips: C#, VB.NET~
http://dobon.net/vb/dotnet/string/digitalsignature.html
***乱数生成、キー生成 [#gb1f54a6]
-乱数を生成する: .NET Tips: C#, VB.NET~
http://dobon.net/vb/dotnet/programing/random.html
-パスワードのようなランダムな文字列を生成する: .NET Tips:...
http://dobon.net/vb/dotnet/string/generatepassword.html
**OSSコンソーシアム [#x205de1f]
***開発基盤部会 Wiki [#o286d0de]
-[[高度午前 - 技術要素 - セキュリティ - 暗号・認証>https:...
-[[SC:対策技術 - 暗号>https://dotnetdevelopmentinfrastru...
***開発基盤部会 Blog [#ua0d9526]
-.NETの暗号ライブラリが進化している件について。~
https://www.osscons.jp/jo0xhcron-537
-JWS (ES256)、JWE (RSAES-OAEP and AES GCM)の実装が完了し...
https://www.osscons.jp/joirtdyb5-537/
----
Tags: [[:.NET開発]], [[:セキュリティ]], [[:暗号化]], [[:...
終了行:
「[[マイクロソフト系技術情報 Wiki>http://techinfoofmicros...
-戻る
--[[.NET開発]]
--[[暗号化アルゴリズム]]
* 目次 [#ba3e104c]
#contents
*概要 [#i831ac3c]
[[暗号化アルゴリズム]]は、一通り揃っている。
-乱数生成~
RNGCryptoServiceProvider
-パスワードからのキー生成~
Rfc2898DeriveBytes
-ハッシュ
--暗号ハッシュ([[様々な用途>https://ja.wikipedia.org/wik...
--キー付きハッシュ([[署名・検証>https://ja.wikipedia.org...
-暗号(暗号化・復号化、署名・検証に利用可能)
--秘密鍵・暗号化
---Aes
---DES
---RC2
---Rijndael
---TripleDES
--公開鍵・暗号化
---RSA
---DSA
---ECDsa
--ハイブリッド・暗号化(キー交換)
---RSA
---ECDiffieHellman
-署名(署名・検証に利用可能)
--RSA
--DSA
--ECDsa
-認証
--データの整合性 (MAC)
---HMAC MD5
---HMAC RIPEMD160
---HMAC SHA256
---HMAC SHA384
---HMAC SHA512
---MAC TripleDES
--データのプライバシー(AEAD)~
については自作が必要。
---3DES-CBC
---AES-CBC
---AES-CTR
---AES-CCM
---AES-GCM ★
---AES-GMAC
*.NET Frameworkの暗号化Providerの列挙 [#da2f4388]
**乱数生成、キー生成 [#feec3024]
***乱数生成 [#z6a6e8e6]
-RNGCryptoServiceProviderを使用して、暗号乱数を生成する。
-Membership.GeneratePasswordも下位でRNGCryptoServiceProvi...
-参考
--RNGCryptoServiceProvider クラス (System.Security.Crypto...
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
--GeneratePassword Method~
http://aspnet.4guysfromrolla.com/demos/GeneratePassword.a...
---This demo illustrates how to use the code for ASP.NET ...
--- I 'borrowed' this code from the 2.0 .NET Framework us...
***キー生成 [#ta70b091]
-Rfc2898DeriveBytesを使用して、パスワード ベースのキーを...
-主に、
--キー付きハッシュ(KeyedHashAlgorithm)
--秘密鍵暗号方式(SymmetricAlgorithm)
>のキーを生成する(パスワードをそのまま使用しない)。
-参考
--Rfc2898DeriveBytes クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
**[[ハッシュ化>暗号化アルゴリズム#y6cc34ab]] [#de661712]
***暗号ハッシュ(HashAlgorithm) [#l1894cde]
-HashAlgorithm.Createというファクトリを使用して、~
HashAlgorithm型で扱えば、あまり差異が無く使える。
-[[Managed、CAPI(CSP)、CNG実装>#fde2f12c]]が揃っている。
-HashAlgorithm クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
--MD5 クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
--RIPEMD160 クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
--SHA1 クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
--SHA256 クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
--SHA384 クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
--SHA512 クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
***キー付きハッシュ(KeyedHashAlgorithm) [#x4fe1902]
-KeyedHashAlgorithm.Createというファクトリを使用して、~
KeyedHashAlgorithm型で扱えば、あまり差異が無く使える。~
(ただし、Key指定する場合、個別のコンストラクタを使用する...
-[[Managed実装のみで、CAPI(CSP)、CNG実装は無い>#fde2f12c]...
-KeyedHashAlgorithm クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
--HMAC クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
--MACTripleDES クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
**[[秘密鍵・暗号化>暗号化アルゴリズム#u680ecb7]]方式 [#r4...
***SymmetricAlgorithm [#n8b6a137]
-[[Managed、CAPI(CSP)、CNG実装>#fde2f12c]]の統一性が無い。~
基本、CAPI(CSP)に、CNG・Managed実装が混入しているイメージ。
-SymmetricAlgorithm クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
--Aes クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
--DES クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
--RC2 クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
--Rijndael クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
--TripleDES クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
**[[公開鍵・暗号化>暗号化アルゴリズム#tfda0d72]]方式 [#q0...
***AsymmetricAlgorithm [#id81129e]
- AsymmetricAlgorithmの内、暗号化・復号化が可能な公開鍵暗...
RSAのみ(他のアルゴリズムは、キー交換や署名のみサポート)。
-AsymmetricAlgorithm クラス (System.Security.Cryptography)~
https://docs.microsoft.com/en-us/dotnet/api/system.securi...
--RSA クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
**[[ハイブリッド・暗号化(キー交換)>暗号化アルゴリズム#z...
***AsymmetricKeyExchange [#u0fcff3a]
非対称キー交換フォーマッタ(Formatter)、デフォーマッタ(...
プロバイダをラップして、手続きだけを提供するクラス。
-AsymmetricKeyExchangeFormatter クラス (System.Security.C...
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
--RSAOAEPKeyExchangeFormatter クラス (System.Security.Cry...
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
--RSAPKCS1KeyExchangeFormatter クラス (System.Security.Cr...
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
-AsymmetricKeyExchangeDeformatter クラス (System.Security...
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
--RSAOAEPKeyExchangeDeformatter クラス (System.Security.C...
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
--RSAPKCS1KeyExchangeDeformatter クラス (System.Security....
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
***ECDiffieHellman [#udf3d4f3]
-ECDiffieHellman クラス (System.Security.Cryptography)~
https://docs.microsoft.com/en-us/dotnet/api/system.securi...
--https://docs.microsoft.com/en-us/dotnet/api/system.secu...
--https://docs.microsoft.com/ja-jp/dotnet/api/system.secu...
**署名・検証 [#lf5eb161]
[[デジタル署名>暗号化アルゴリズム#leddd7f0]]
***AsymmetricAlgorithm [#lbe3d6d2]
-RSAだけは、署名・検証だけでなく、暗号化・復号化にも利用...
-[[Managed、CAPI(CSP)、CNG実装>#fde2f12c]]が一通り提供さ...
新しいアルゴリズムは、CNGと[[OpenSSL]]の二択になって行く...
-AsymmetricAlgorithm クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
--RSA クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
--DSA クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
--ECDsa クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
---https://docs.microsoft.com/ja-jp/dotnet/api/system.sec...
***AsymmetricSignatureFormatter [#ta0f34c9]
-非対称署名フォーマッタ、デフォーマッタ~
プロバイダをラップして、手続きだけを提供するクラス。
--AsymmetricSignatureFormatter クラス (System.Security.Cr...
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---RSAPKCS1SignatureFormatter クラス (System.Security.Cry...
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---DSASignatureFormatter クラス (System.Security.Cryptogr...
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
--AsymmetricSignatureDeformatter クラス (System.Security....
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---RSAPKCS1SignatureDeformatter クラス (System.Security.C...
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
---DSASignatureDeformatter クラス (System.Security.Crypto...
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
**追加可能なプロバイダ [#w62a67fc]
***Security.Cryptography [#dc18d317]
昨今(、クロスドメイン認証周りの需要でか)、[[日進月歩で...
***Security.Cryptography.XML [#hb08dcb9]
[[XML署名・暗号]]
*[[.NET Standard]]の暗号化Providerの列挙 [#db4c9ea1]
**.NET Frameworkからの移植 [#i773c894]
-予想外に、[[CSPやCNGのプロバイダ>#fde2f12c]]も移植されて...
-...が、一部含まれないものがある(特にCNG系実装に多い)。
-これら[[CNGのプロバイダの移植>#fde2f12c]]が、今後どう進...
**[[追加のプロバイダ>#u5d4c9e0]] [#b6180c03]
*Managed、CAPI(CSP)、CNG実装とは? [#fde2f12c]
-Managedで終わる名称のProviderは、.NET実装と思われる。
-CryptoServiceProvider (CSP) で終わる名称のProviderは、~
「CryptoAPI Cryptographic Service Providers (CSP ≒ CAPI) ...
-Cryptography Next Generation (CNG) で終わる名称のProvide...
CNG Cryptographic Algorithm Providers実装と思われる。
-Understanding Cryptographic Providers | Microsoft Docs~
https://docs.microsoft.com/ja-jp/windows/desktop/SecCertE...
**CAPI (CSP) [#n13961a2]
-CryptoAPI Cryptographic Service Providers | Microsoft Do...
https://docs.microsoft.com/ja-jp/windows/desktop/SecCertE...
-Cryptographic API - Wikipedia~
https://ja.wikipedia.org/wiki/Cryptographic_API
**CNG [#if785c4b]
-CNG系の暗号化プロバイダの秘密鍵、暗号化操作は、~
CNG キー分離サービスは、分離 LSA プロセスでホストされてい...
CC (Common Criteria)国際標準規格の要求に従ってキープロセ...
-分離 LSA プロセス
--仮想化ベースのセキュリティを使って保護され、OSの他の部...
--CNGプロバイダを使用するプロセスは、[[RPC]]を使って分離 ...
***アルゴリズム [#z76e4427]
-MD5
-Sha1
-Sha256
-Sha384
-Sha512
-Rsa
-ECDsa
--ECDsaP256
--ECDsaP384
--ECDsaP521
-ECDiffieHellman
--ECDiffieHellmanP256
--ECDiffieHellmanP384
--ECDiffieHellmanP521
***参考 [#jf513bd9]
-Cryptography Next Generation~
https://technet.microsoft.com/en-us/library/532ac164-da33...
-CNGとは (Cryptography Next Generation) シーエヌジー: - ...
http://www.sophia-it.com/content/Cryptography+Next+Genera...
-CNG Key Isolation: Windows 7 不要なサービスを無効&停止!~
http://windows7service.spinse.net/category/10277691-1.html
-How to use RSA in .NET: RSACryptoServiceProvider vs. RSA...
https://dusted.codes/how-to-use-rsa-in-dotnet-rsacryptose...
--RSACryptoServiceProviderは独自のキー操作に結びついてい...
--RSACngのキーはCngKeyクラスによって管理され、コンストラ...
-Microsoft Docs
--Algorithm
---CNG Cryptographic Algorithm Providers~
https://docs.microsoft.com/ja-jp/windows/desktop/SecCertE...
---CngAlgorithm クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
--Key
---CNG Key Storage Providers~
https://docs.microsoft.com/ja-jp/windows/desktop/SecCertE...
---CngKey クラス (System.Security.Cryptography)~
https://docs.microsoft.com/ja-jp/dotnet/api/system.securi...
*[[Managed、CSP、CNG>#fde2f12c]]、OpenSSLの選択肢 [#ub3ba...
-.NET Framework の暗号モデル | Microsoft Docs~
https://docs.microsoft.com/ja-jp/dotnet/standard/security...
には、以下のようにある。
***最適な実装を選択可能 [#f3be9d35]
-マネージ実装~
.NET Framework をサポートするすべてのプラットフォームで利...
ただし、マネージ実装はFIPSに認定されておらず、ラッパー ク...
-CAPI 実装~
CSPラッパー。以前のOSで使用可能だが、開発中止となっている。
-CNG 実装~
CNGラッパー。まさに最新の実装であり、新しい開発が行われる。
***.NET Core、Linux [#s0c207f4]
-選択と言うより、~
プラットフォームによって限定的になるもよう。
-例えば、X.509 を使用した際に取得できるRSAプロバイダが、
--.NET FrameworkではRSACsp
--.NET Core on WindowsではRSACng
--.NET Core on Linuxでは、RSAOpenSsl
>になることなどを観測した。
-この辺りは、プラットフォーム依存が強いので、~
クロスプラットフォーム対応は難しい部分がありそう。
-ただし、バージョンが上がるにつれて、~
[[着実に実装の移行・追加が進んでいることを確認できた。>#u...
***性能 [#h1bd7d6f]
-Measuring the performance of AES implementations in .Net...
(AesManaged vs AesCryptoServiceProvider) - CodeProject~
https://www.codeproject.com/Tips/844795/Measuring-the-per...
*参考 [#mf5f8a70]
-Programming .NET Security - O'Reilly Media~
http://shop.oreilly.com/product/9780596004422.do
-Visual Studio C#でファイルを暗号化してみる~
https://qiita.com/hibara/items/c9096376b1d7b5c8e2ae
-How to use RSA in .NET:~
RSACryptoServiceProvider vs. RSACng and good practise pat...
https://dusted.codes/how-to-use-rsa-in-dotnet-rsacryptose...
**ライブラリ [#u5d4c9e0]
***[[OpenSSL]] [#lddc9143]
***[[BouncyCastle]] [#tc1ee636]
***libsodium [#wc22e484]
-C言語で開発された、クロスプラットフォームの暗号化ライブ...
-PHPでは、PECLで提供されていたがコアに標準的に組み込まれ...
-nuget.org
--https://www.nuget.org/packages/libsodium/
--https://www.nuget.org/packages/libsodium-net/
***[[Open 棟梁>https://opentouryo.osscons.jp/index.php?%E...
***参考 [#j0ade641]
-暗号ライブラリの比較 - Wikipedia~
https://ja.wikipedia.org/wiki/%E6%9A%97%E5%8F%B7%E3%83%A9...
**DOBON.NET: VB.NET, C#, 無料ソフトウェア... [#j2316c2c]
http://dobon.net/index.html
-文字列、暗号化: .NET Tips: C#, VB.NET~
http://dobon.net/vb/dotnet/string/index.html
***暗号ハッシュ [#bbfd012a]
-MD5やSHA1などでハッシュ値を計算する: .NET Tips: C#, VB.N...
http://dobon.net/vb/dotnet/string/md5.html
-ファイルのMD5やSHA1などでハッシュ値を計算する: .NET Tips...
http://dobon.net/vb/dotnet/string/filemd5.html
***秘密鍵暗号方式 [#geb60fa1]
-パスワードで文字列を暗号化する: .NET Tips: C#, VB.NET~
http://dobon.net/vb/dotnet/string/encryptstring.html
-パスワードでファイルを暗号化する: .NET Tips: C#, VB.NET~
http://dobon.net/vb/dotnet/string/encryptfile.html
***公開鍵暗号方式 [#icf617f4]
-公開鍵暗号方法で暗号化する: .NET Tips: C#, VB.NET~
http://dobon.net/vb/dotnet/string/rsaencryption.html
***署名・検証 [#f3bcf75f]
-デジタル署名を作成、検証する: .NET Tips: C#, VB.NET~
http://dobon.net/vb/dotnet/string/digitalsignature.html
***乱数生成、キー生成 [#gb1f54a6]
-乱数を生成する: .NET Tips: C#, VB.NET~
http://dobon.net/vb/dotnet/programing/random.html
-パスワードのようなランダムな文字列を生成する: .NET Tips:...
http://dobon.net/vb/dotnet/string/generatepassword.html
**OSSコンソーシアム [#x205de1f]
***開発基盤部会 Wiki [#o286d0de]
-[[高度午前 - 技術要素 - セキュリティ - 暗号・認証>https:...
-[[SC:対策技術 - 暗号>https://dotnetdevelopmentinfrastru...
***開発基盤部会 Blog [#ua0d9526]
-.NETの暗号ライブラリが進化している件について。~
https://www.osscons.jp/jo0xhcron-537
-JWS (ES256)、JWE (RSAES-OAEP and AES GCM)の実装が完了し...
https://www.osscons.jp/joirtdyb5-537/
----
Tags: [[:.NET開発]], [[:セキュリティ]], [[:暗号化]], [[:...
ページ名: