Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
DESCryptoServiceProvider.cs
Go to the documentation of this file.
3
5
6[Obsolete("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
7[EditorBrowsable(EditorBrowsableState.Never)]
8public sealed class DESCryptoServiceProvider : DES
9{
11 {
13 }
14
15 public override void GenerateKey()
16 {
17 byte[] array = new byte[8];
20 {
22 }
24 }
25
26 public override void GenerateIV()
27 {
29 }
30
32 {
33 return CreateTransform(Key, IV, encrypting: false);
34 }
35
36 public override ICryptoTransform CreateDecryptor(byte[] rgbKey, byte[]? rgbIV)
37 {
38 return CreateTransform(rgbKey, rgbIV?.CloneByteArray(), encrypting: false);
39 }
40
42 {
43 return CreateTransform(Key, IV, encrypting: true);
44 }
45
46 public override ICryptoTransform CreateEncryptor(byte[] rgbKey, byte[]? rgbIV)
47 {
48 return CreateTransform(rgbKey, rgbIV?.CloneByteArray(), encrypting: true);
49 }
50
51 private ICryptoTransform CreateTransform(byte[] rgbKey, byte[] rgbIV, bool encrypting)
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 {
65 }
66 if (DES.IsSemiWeakKey(rgbKey))
67 {
69 }
70 if (rgbIV == null)
71 {
72 if (Mode.UsesIv())
73 {
75 }
76 }
77 else if (rgbIV.Length < 8)
78 {
80 }
81 Internal.Cryptography.BasicSymmetricCipher cipher = new BasicSymmetricCipherCsp(26113, Mode, BlockSize / 8, rgbKey, 0, addNoSaltFlag: false, rgbIV, encrypting, FeedbackSize, this.GetPaddingSize(Mode, FeedbackSize));
83 }
84}
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
override ICryptoTransform CreateEncryptor(byte[] rgbKey, byte[]? rgbIV)
ICryptoTransform CreateTransform(byte[] rgbKey, byte[] rgbIV, bool encrypting)
override ICryptoTransform CreateDecryptor(byte[] rgbKey, byte[]? rgbIV)
override byte[] Key
Definition DES.cs:24
static bool IsWeakKey(byte[] rgbKey)
Definition DES.cs:77
static bool IsSemiWeakKey(byte[] rgbKey)
Definition DES.cs:92