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

◆ ValidatePbeParameters() [2/2]

static void System.Security.Cryptography.PasswordBasedEncryption.ValidatePbeParameters ( PbeParameters pbeParameters,
ReadOnlySpan< char > password,
ReadOnlySpan< byte > passwordBytes )
inlinestaticpackage

Definition at line 17 of file PasswordBasedEncryption.cs.

18 {
19 PbeEncryptionAlgorithm encryptionAlgorithm = pbeParameters.EncryptionAlgorithm;
20 switch (encryptionAlgorithm)
21 {
22 case PbeEncryptionAlgorithm.Aes128Cbc:
23 case PbeEncryptionAlgorithm.Aes192Cbc:
24 case PbeEncryptionAlgorithm.Aes256Cbc:
25 break;
26 case PbeEncryptionAlgorithm.TripleDes3KeyPkcs12:
27 if (pbeParameters.HashAlgorithm != HashAlgorithmName.SHA1)
28 {
29 throw new CryptographicException(System.SR.Cryptography_UnknownHashAlgorithm, pbeParameters.HashAlgorithm.Name);
30 }
31 if (passwordBytes.Length > 0 && password.Length == 0)
32 {
33 throw AlgorithmKdfRequiresChars(encryptionAlgorithm.ToString());
34 }
35 break;
36 default:
37 throw new CryptographicException(System.SR.Cryptography_UnknownAlgorithmIdentifier, encryptionAlgorithm.ToString());
38 }
39 }
static string Cryptography_UnknownAlgorithmIdentifier
Definition SR.cs:150
static string Cryptography_UnknownHashAlgorithm
Definition SR.cs:152
Definition SR.cs:7
static CryptographicException AlgorithmKdfRequiresChars(string algId)

References System.Security.Cryptography.PasswordBasedEncryption.AlgorithmKdfRequiresChars(), System.SR.Cryptography_UnknownAlgorithmIdentifier, System.SR.Cryptography_UnknownHashAlgorithm, System.Security.Cryptography.PbeParameters.EncryptionAlgorithm, System.Security.Cryptography.PbeParameters.HashAlgorithm, System.ReadOnlySpan< T >.Length, System.Security.Cryptography.HashAlgorithmName.Name, and System.Security.Cryptography.HashAlgorithmName.SHA1.