mirror of
https://github.com/greenshot/greenshot
synced 2025-07-15 01:23:47 -07:00
Fixed password encryption issue
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1796 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
e3570f70eb
commit
05f9fb930e
1 changed files with 11 additions and 5 deletions
|
@ -15,8 +15,8 @@ namespace GreenshotPlugin.Core {
|
|||
/// <param name="ClearText">the string to call upon</param>
|
||||
/// <returns>an encryped string in base64 form</returns>
|
||||
public static string Encrypt(this string ClearText) {
|
||||
byte[] clearTextBytes = Encoding.UTF8.GetBytes(ClearText);
|
||||
|
||||
byte[] clearTextBytes = Encoding.ASCII.GetBytes(ClearText);
|
||||
string returnValue = null;
|
||||
SymmetricAlgorithm rijn = SymmetricAlgorithm.Create();
|
||||
|
||||
using (MemoryStream ms = new MemoryStream()) {
|
||||
|
@ -25,8 +25,11 @@ namespace GreenshotPlugin.Core {
|
|||
CryptoStream cs = new CryptoStream(ms, rijn.CreateEncryptor(key, rgbIV), CryptoStreamMode.Write);
|
||||
|
||||
cs.Write(clearTextBytes, 0, clearTextBytes.Length);
|
||||
return Convert.ToBase64String(ms.ToArray());
|
||||
|
||||
cs.Close();
|
||||
returnValue = Convert.ToBase64String(ms.ToArray());
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -36,7 +39,7 @@ namespace GreenshotPlugin.Core {
|
|||
/// <returns>Decrypeted text</returns>
|
||||
public static string Decrypt(this string EncryptedText) {
|
||||
byte[] encryptedTextBytes = Convert.FromBase64String(EncryptedText);
|
||||
|
||||
string returnValue = null;
|
||||
using (MemoryStream ms = new MemoryStream()) {
|
||||
SymmetricAlgorithm rijn = SymmetricAlgorithm.Create();
|
||||
|
||||
|
@ -49,8 +52,11 @@ namespace GreenshotPlugin.Core {
|
|||
|
||||
cs.Write(encryptedTextBytes, 0, encryptedTextBytes.Length);
|
||||
|
||||
return Encoding.UTF8.GetString(ms.ToArray());
|
||||
cs.Close();
|
||||
returnValue = Encoding.ASCII.GetString(ms.ToArray());
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue