PasswordDeriveBytes.CryptDeriveKey(String, String, Int32, Byte[]) 메서드

정의

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(초기화 벡터)입니다.

반환

Byte[]

파생된 키입니다.

특성

예외

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.
 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)

설명

이 함수를 CryptDeriveKey() Crypto API 함수에 대 한 래퍼인 하며 Crypto API를 사용 하 여 애플리케이션과 상호 운용성을 제공 됩니다.

매개 변수가 keySize 0비트로 설정된 경우 지정된 알고리즘의 기본 키 크기가 사용됩니다.

적용 대상

추가 정보