PasswordDeriveBytes.CryptDeriveKey(String, String, Int32, Byte[]) Yöntem
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
Nesneden bir şifreleme anahtarı türetir 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()
Parametreler
- algname
- String
Anahtarın türetildiği algoritma adı.
- alghashname
- String
Anahtarı türetmek için kullanılacak karma algoritma adı.
- keySize
- Int32
Türetilen anahtarın bit cinsinden boyutu.
- rgbIV
- Byte[]
Anahtarı türetmek için kullanılacak başlatma vektöru (IV).
Döndürülenler
Türetilmiş anahtar.
- Öznitelikler
Özel durumlar
Parametre keySize
yanlış.
-veya-
Şifreleme hizmeti sağlayıcısı (CSP) alınamıyor.
-veya-
algname
Parametresi geçerli bir algoritma adı değil.
-veya-
alghashname
parametresi geçerli bir karma algoritma adı değil.
Örnekler
Bu kod örneği, sınıfı için PasswordDeriveBytes sağlanan daha büyük bir örneğin parçasıdır.
// 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.
cryptoDESProvider->Key = passwordDeriveBytes->CryptDeriveKey
("TripleDES", "SHA1", 192, cryptoDESProvider->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);
' 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)
Açıklamalar
Bu işlev, Crypto API işlevi CryptDeriveKey() için bir sarmalayıcıdır ve Şifreleme API'sini kullanan uygulamalarla birlikte çalışabilirlik sunmayı amaçlar.
keySize
Parametre 0 bit olarak ayarlanırsa, belirtilen algoritma için varsayılan anahtar boyutu kullanılır.