diff --git a/AjaxPro/Security/DecryptTransformer.cs b/AjaxPro/Security/DecryptTransformer.cs index a4ea7bc..c7f62ca 100644 --- a/AjaxPro/Security/DecryptTransformer.cs +++ b/AjaxPro/Security/DecryptTransformer.cs @@ -59,6 +59,7 @@ internal ICryptoTransform GetCryptoServiceProvider(byte[] bytesKey) { switch(algorithmID) { +#if (UNSAFEENCYPTION) case EncryptionAlgorithm.Des: DES des = new DESCryptoServiceProvider(); des.Mode = CipherMode.CBC; @@ -70,7 +71,7 @@ internal ICryptoTransform GetCryptoServiceProvider(byte[] bytesKey) TripleDES des3 = new TripleDESCryptoServiceProvider(); des3.Mode = CipherMode.CBC; return des3.CreateDecryptor(bytesKey, initVec); - +#endif case EncryptionAlgorithm.Rc2: RC2 rc2 = new RC2CryptoServiceProvider(); rc2.Mode = CipherMode.CBC; diff --git a/AjaxPro/Security/EncryptTransformer.cs b/AjaxPro/Security/EncryptTransformer.cs index f4cdc45..a576f77 100644 --- a/AjaxPro/Security/EncryptTransformer.cs +++ b/AjaxPro/Security/EncryptTransformer.cs @@ -25,7 +25,7 @@ */ /* * MS 06-04-25 enums should have a zero value - * MS 24-10-10 changed to set DES encryption obsolete + * MS 24-10-10 changed to mark unsafe encrpytions to obsolete and support only with compile switch UNSAFEENCYPTION * * */ @@ -39,10 +39,10 @@ namespace AjaxPro.Cryptography /// public enum EncryptionAlgorithm { - [Obsolete("Use EncryptionAlgorithm.Aes instead.")] /// /// /// + [Obsolete("Use EncryptionAlgorithm.Aes instead.")] Des = 0, /// @@ -58,6 +58,7 @@ public enum EncryptionAlgorithm /// /// /// + [Obsolete("Use EncryptionAlgorithm.Aes instead.")] TripleDes, Aes }; @@ -89,6 +90,7 @@ internal ICryptoTransform GetCryptoServiceProvider(byte[] bytesKey) { switch (algorithmID) { +#if (UNSAFEENCYPTION) case EncryptionAlgorithm.Des: DES des = new DESCryptoServiceProvider(); des.Mode = CipherMode.CBC; @@ -136,7 +138,7 @@ internal ICryptoTransform GetCryptoServiceProvider(byte[] bytesKey) des3.IV = initVec; } return des3.CreateEncryptor(); - +#endif case EncryptionAlgorithm.Rc2: RC2 rc2 = new RC2CryptoServiceProvider(); rc2.Mode = CipherMode.CBC;