Skip to content

Commit

Permalink
fix MyEncryption
Browse files Browse the repository at this point in the history
fix MyEncryption
  • Loading branch information
lulianqi committed Feb 25, 2021
1 parent 44a5e45 commit d962b04
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions AutoTest/MyCommonHelper/EncryptionHelper/MyEncryption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ public static byte[] SymmetricDecrypt(byte[] CypherText, SymmetricAlgorithm key)
//StreamReader sr = new StreamReader(encStream);

// Read the stream as a string.
//byte[] buffer = new byte[CypherText.Length];
//encStream.Read(buffer, 0, buffer.Length);
byte[] buffer = ms.ToArray();

byte[] buffer = new byte[CypherText.Length];
encStream.Read(buffer, 0, buffer.Length);
//byte[] buffer = ms.ToArray();

// Close the streams.

Expand Down Expand Up @@ -128,6 +128,7 @@ public static byte[] SymmetricEncrypt(byte[] PlainText, byte[] yourKey, byte[] y
default:
throw new Exception("not support this encrypt type");
}
key.Key = yourKey;
key.Mode = yourCipherMode;
key.Padding = yourPaddingMode;
if (key.Mode != CipherMode.ECB)
Expand Down Expand Up @@ -157,6 +158,7 @@ public static byte[] SymmetricDecrypt(byte[] CypherText, byte[] yourKey, byte[]
default:
throw new Exception("not support this encrypt type");
}
key.Key = yourKey;
key.Mode = yourCipherMode;
key.Padding = yourPaddingMode;
if (key.Mode != CipherMode.ECB)
Expand Down

0 comments on commit d962b04

Please sign in to comment.