Skip to content

Commit

Permalink
changed to mark unsafe encrpytions to obsolete and support only with …
Browse files Browse the repository at this point in the history
…compile switch UNSAFEENCYPTION
  • Loading branch information
michaelschwarz committed Oct 10, 2024
1 parent 8d3b71d commit cfbc40a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion AjaxPro/Security/DecryptTransformer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ internal ICryptoTransform GetCryptoServiceProvider(byte[] bytesKey)
{
switch(algorithmID)
{
#if (UNSAFEENCYPTION)
case EncryptionAlgorithm.Des:
DES des = new DESCryptoServiceProvider();
des.Mode = CipherMode.CBC;
Expand All @@ -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;
Expand Down
8 changes: 5 additions & 3 deletions AjaxPro/Security/EncryptTransformer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
*
*/
Expand All @@ -39,10 +39,10 @@ namespace AjaxPro.Cryptography
/// </summary>
public enum EncryptionAlgorithm
{
[Obsolete("Use EncryptionAlgorithm.Aes instead.")]
/// <summary>
///
/// </summary>
[Obsolete("Use EncryptionAlgorithm.Aes instead.")]
Des = 0,

/// <summary>
Expand All @@ -58,6 +58,7 @@ public enum EncryptionAlgorithm
/// <summary>
///
/// </summary>
[Obsolete("Use EncryptionAlgorithm.Aes instead.")]
TripleDes,
Aes
};
Expand Down Expand Up @@ -89,6 +90,7 @@ internal ICryptoTransform GetCryptoServiceProvider(byte[] bytesKey)
{
switch (algorithmID)
{
#if (UNSAFEENCYPTION)
case EncryptionAlgorithm.Des:
DES des = new DESCryptoServiceProvider();
des.Mode = CipherMode.CBC;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit cfbc40a

Please # to comment.