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

◆ CreateTransform()

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

Definition at line 72 of file RC2CryptoServiceProvider.cs.

73 {
74 long num = (long)rgbKey.Length * 8L;
75 if (num > int.MaxValue || !((int)num).IsLegalSize(LegalKeySizes))
76 {
78 }
79 if (rgbIV == null)
80 {
81 if (Mode.UsesIv())
82 {
83 rgbIV = RandomNumberGenerator.GetBytes(8);
84 }
85 }
86 else if (rgbIV.Length < 8)
87 {
88 throw new CryptographicException(System.SR.Cryptography_InvalidIVSize);
89 }
90 int effectiveKeyLength = (int)((EffectiveKeySizeValue == 0) ? num : EffectiveKeySize);
91 Internal.Cryptography.BasicSymmetricCipher cipher = new BasicSymmetricCipherCsp(26114, Mode, BlockSize / 8, rgbKey, effectiveKeyLength, !UseSalt, rgbIV, encrypting, 0, 0);
93 }
static UniversalCryptoTransform Create(PaddingMode paddingMode, BasicSymmetricCipher cipher, bool encrypting)
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_InvalidKeySize, System.Security.Cryptography.RC2CryptoServiceProvider.EffectiveKeySize, System.Security.Cryptography.RC2.EffectiveKeySizeValue, System.Security.Cryptography.RandomNumberGenerator.GetBytes(), System.L, System.Security.Cryptography.SymmetricAlgorithm.LegalKeySizes, System.Security.Cryptography.SymmetricAlgorithm.Padding, and System.Security.Cryptography.RC2CryptoServiceProvider.UseSalt.

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