Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ CryptDeriveKey()

byte[] System.Security.Cryptography.PasswordDeriveBytes.CryptDeriveKey ( string? algname,
string? alghashname,
int keySize,
byte[] rgbIV )
inline

Definition at line 306 of file PasswordDeriveBytes.cs.

307 {
308 if (keySize < 0)
309 {
310 throw new CryptographicException(System.SR.Cryptography_InvalidKeySize);
311 }
312 int num = CapiHelper.NameOrOidToHashAlgId(alghashname, OidGroup.HashAlgorithm);
313 if (num == 0)
314 {
315 throw new CryptographicException(System.SR.Cryptography_PasswordDerivedBytes_InvalidAlgorithm);
316 }
317 int num2 = CapiHelper.NameOrOidToHashAlgId(algname, OidGroup.All);
318 if (num2 == 0)
319 {
320 throw new CryptographicException(System.SR.Cryptography_PasswordDerivedBytes_InvalidAlgorithm);
321 }
322 if (rgbIV == null)
323 {
324 throw new CryptographicException(System.SR.Cryptography_PasswordDerivedBytes_InvalidIV);
325 }
326 byte[] pbKey = null;
327 CapiHelper.DeriveKey(ProvHandle, num2, num, _password, _password.Length, keySize << 16, rgbIV, rgbIV.Length, ref pbKey);
328 return pbKey;
329 }
static int NameOrOidToHashAlgId(string nameOrOid, OidGroup oidGroup)
static void DeriveKey(SafeProvHandle hProv, int algid, int algidHash, byte[] password, int cbPassword, int dwFlags, byte[] IV_Out, int cbIV_In, [NotNull] ref byte[] pbKey)
static string Cryptography_PasswordDerivedBytes_InvalidAlgorithm
Definition SR.cs:56
static string Cryptography_InvalidKeySize
Definition SR.cs:92
static string Cryptography_PasswordDerivedBytes_InvalidIV
Definition SR.cs:58
Definition SR.cs:7

References System.Security.Cryptography.PasswordDeriveBytes._password, System.SR.Cryptography_InvalidKeySize, System.SR.Cryptography_PasswordDerivedBytes_InvalidAlgorithm, System.SR.Cryptography_PasswordDerivedBytes_InvalidIV, Internal.NativeCrypto.CapiHelper.DeriveKey(), Internal.NativeCrypto.CapiHelper.NameOrOidToHashAlgId(), and System.Security.Cryptography.PasswordDeriveBytes.ProvHandle.