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

◆ CreateTransform()

ICryptoTransform System.Security.Cryptography.DESCryptoServiceProvider.CreateTransform ( byte[] rgbKey,
byte[] rgbIV,
bool encrypting )
inlineprivate

Definition at line 51 of file DESCryptoServiceProvider.cs.

52 {
53 if (rgbKey == null)
54 {
55 throw new ArgumentNullException("rgbKey");
56 }
57 long num = (long)rgbKey.Length * 8L;
58 if (num > int.MaxValue || !((int)num).IsLegalSize(LegalKeySizes))
59 {
61 }
62 if (DES.IsWeakKey(rgbKey))
63 {
64 throw new CryptographicException(System.SR.Cryptography_InvalidKey_Weak, "DES");
65 }
66 if (DES.IsSemiWeakKey(rgbKey))
67 {
68 throw new CryptographicException(System.SR.Cryptography_InvalidKey_SemiWeak, "DES");
69 }
70 if (rgbIV == null)
71 {
72 if (Mode.UsesIv())
73 {
74 rgbIV = RandomNumberGenerator.GetBytes(8);
75 }
76 }
77 else if (rgbIV.Length < 8)
78 {
79 throw new CryptographicException(System.SR.Cryptography_InvalidIVSize);
80 }
81 Internal.Cryptography.BasicSymmetricCipher cipher = new BasicSymmetricCipherCsp(26113, Mode, BlockSize / 8, rgbKey, 0, addNoSaltFlag: false, rgbIV, encrypting, FeedbackSize, this.GetPaddingSize(Mode, FeedbackSize));
83 }
static UniversalCryptoTransform Create(PaddingMode paddingMode, BasicSymmetricCipher cipher, bool encrypting)
static string Cryptography_InvalidKey_SemiWeak
Definition SR.cs:94
static string Cryptography_InvalidKey_Weak
Definition SR.cs:96
static string Cryptography_InvalidKeySize
Definition SR.cs:92
static string Cryptography_InvalidIVSize
Definition SR.cs:102
Definition SR.cs:7

References System.Security.Cryptography.SymmetricAlgorithm.BlockSize, Internal.Cryptography.UniversalCryptoTransform.Create(), System.SR.Cryptography_InvalidIVSize, System.SR.Cryptography_InvalidKey_SemiWeak, System.SR.Cryptography_InvalidKey_Weak, System.SR.Cryptography_InvalidKeySize, System.Security.Cryptography.SymmetricAlgorithm.FeedbackSize, System.Security.Cryptography.RandomNumberGenerator.GetBytes(), System.Security.Cryptography.DES.IsSemiWeakKey(), System.Security.Cryptography.DES.IsWeakKey(), System.L, System.Security.Cryptography.SymmetricAlgorithm.LegalKeySizes, and System.Security.Cryptography.SymmetricAlgorithm.Padding.

Referenced by System.Security.Cryptography.DESCryptoServiceProvider.CreateDecryptor(), System.Security.Cryptography.DESCryptoServiceProvider.CreateDecryptor(), System.Security.Cryptography.DESCryptoServiceProvider.CreateEncryptor(), and System.Security.Cryptography.DESCryptoServiceProvider.CreateEncryptor().