PasswordDeriveBytes.CryptDeriveKey(String, String, Int32, Byte[]) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
PasswordDeriveBytes オブジェクトから暗号化キーを派生させます。
public:
cli::array <System::Byte> ^ CryptDeriveKey(System::String ^ algname, System::String ^ alghashname, int keySize, cli::array <System::Byte> ^ rgbIV);
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public byte[] CryptDeriveKey(string? algname, string? alghashname, int keySize, byte[] rgbIV);
public byte[] CryptDeriveKey(string algname, string alghashname, int keySize, byte[] rgbIV);
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
member this.CryptDeriveKey : string * string * int * byte[] -> byte[]
member this.CryptDeriveKey : string * string * int * byte[] -> byte[]
Public Function CryptDeriveKey (algname As String, alghashname As String, keySize As Integer, rgbIV As Byte()) As Byte()
パラメーター
- algname
- String
キーを派生させるアルゴリズム名。
- alghashname
- String
キーの派生に使用するハッシュ アルゴリズム名。
- keySize
- Int32
派生するキーのサイズ (ビット単位)。
- rgbIV
- Byte[]
キーの派生に使用する初期化ベクトル (IV)。
返品
派生キー。
- 属性
例外
keySize パラメーターが正しくありません。
-又は-
暗号化サービス プロバイダー (CSP) を取得できません。
-又は-
algname パラメーターが有効なアルゴリズム名ではありません。
-又は-
alghashname パラメーターが有効なハッシュ アルゴリズム名ではありません。
例
このコード例は、 PasswordDeriveBytes クラスに提供されるより大きな例の一部です。
// Create the key and set it to the Key property
// of the TripleDESCryptoServiceProvider object.
// This example uses the SHA1 algorithm.
// Due to collision problems with SHA1, Microsoft recommends SHA256 or better.
tdes.Key = pdb.CryptDeriveKey("TripleDES", "SHA1", 192, tdes.IV);
' Create the key and set it to the Key property
' of the TripleDESCryptoServiceProvider object.
' This example uses the SHA1 algorithm.
' Due to collision problems with SHA1, Microsoft recommends SHA256 or better.
tdes.Key = pdb.CryptDeriveKey("TripleDES", "SHA1", 192, tdes.IV)
注釈
この関数は、Crypto API 関数 CryptDeriveKey() のラッパーであり、Crypto API を使用してアプリケーションとの相互運用性を提供することを目的としています。
keySize パラメーターが 0 ビットに設定されている場合は、指定したアルゴリズムの既定のキー サイズが使用されます。