PasswordDeriveBytes.CryptDeriveKey(String, String, Int32, Byte[]) Metodo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Deriva una chiave di crittografia dall'oggetto 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()
Parametri
- algname
- String
Nome dell'algoritmo per il quale derivare la chiave.
- alghashname
- String
Nome dell'algoritmo hash da usare per derivare la chiave.
- keySize
- Int32
Dimensione in bit della chiave da derivare.
- rgbIV
- Byte[]
Vettore di inizializzazione da usare per derivare la chiave.
Restituisce
Chiave derivata.
- Attributi
Eccezioni
Il parametro keySize
non è corretto.
-oppure-
Non è possibile acquisire il provider del servizio di crittografia (CSP).
-oppure-
Il parametro algname
non corrisponde a un nome di algoritmo valido.
-oppure-
Il parametro alghashname
non corrisponde a un nome di algoritmo hash valido.
Esempio
Questo esempio di codice fa parte di un esempio più grande fornito per la PasswordDeriveBytes classe.
// 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)
Commenti
Questa funzione è un wrapper per la funzione Crypto API CryptDeriveKey() ed è destinata a offrire l'interoperabilità con le applicazioni usando l'API Crypto.
Se il keySize
parametro è impostato su 0 bit, viene usata la dimensione predefinita della chiave per l'algoritmo specificato.
Si applica a
Vedi anche
Commenti e suggerimenti
https://aka.ms/ContentUserFeedback.
Presto disponibile: Nel corso del 2024 verranno gradualmente disattivati i problemi di GitHub come meccanismo di feedback per il contenuto e ciò verrà sostituito con un nuovo sistema di feedback. Per altre informazioni, vedereInvia e visualizza il feedback per