mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-23 12:30:50 +01:00
CP-36392: Fixes to sonarqube score.
Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
parent
4f7ad4f0f0
commit
74bf6f3ba5
@ -63,20 +63,24 @@ namespace CommandLib
|
||||
|
||||
public class Export
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("csharpsquid",
|
||||
"S4790:Using weak hashing algorithms is security-sensitive",
|
||||
Justification = "Used only for checksum verification for backwards compatibility.")]
|
||||
private readonly SHA1 _sha1 = new SHA1CryptoServiceProvider();
|
||||
|
||||
private readonly XXHash64 _xxHash = new XXHash64();
|
||||
|
||||
public static bool verbose_debugging = false;
|
||||
|
||||
public static void debug(string x)
|
||||
private static void debug(string x)
|
||||
{
|
||||
if (verbose_debugging)
|
||||
Console.WriteLine(x);
|
||||
}
|
||||
|
||||
private readonly SHA1 sha = new SHA1CryptoServiceProvider();
|
||||
private XXHash64 xxhash = new XXHash64();
|
||||
|
||||
private string checksum_sha1(byte[] data)
|
||||
{
|
||||
byte[] result = sha.ComputeHash(data);
|
||||
byte[] result = _sha1.ComputeHash(data);
|
||||
return hex(result).ToLower();
|
||||
}
|
||||
|
||||
@ -97,8 +101,8 @@ namespace CommandLib
|
||||
|
||||
private string checksum_xxhash(byte[] data)
|
||||
{
|
||||
xxhash.Initialize();
|
||||
return hex(xxhash.ComputeHash(data));
|
||||
_xxHash.Initialize();
|
||||
return hex(_xxHash.ComputeHash(data));
|
||||
}
|
||||
|
||||
private static Hashtable parse_checksum_table(string checksum_xml)
|
||||
|
@ -150,6 +150,15 @@ namespace DotNetVnc
|
||||
|
||||
public readonly object updateMonitor = new object();
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("csharpsquid",
|
||||
"S5547:Cipher algorithms should be robust",
|
||||
Justification = "Needed by the server side.")]
|
||||
private DESCryptoServiceProvider des = new DESCryptoServiceProvider
|
||||
{
|
||||
Padding = PaddingMode.None,
|
||||
Mode = CipherMode.ECB
|
||||
};
|
||||
|
||||
public VNCStream(IVNCGraphicsClient client, Stream stream, bool startPaused)
|
||||
{
|
||||
this.client = client;
|
||||
@ -347,12 +356,6 @@ namespace DotNetVnc
|
||||
for (int i = 0; i < 8 && i < password.Length; ++i)
|
||||
keyBytes[i] = Reverse((byte)password[i]);
|
||||
|
||||
DESCryptoServiceProvider des = new DESCryptoServiceProvider
|
||||
{
|
||||
Padding = PaddingMode.None,
|
||||
Mode = CipherMode.ECB
|
||||
};
|
||||
|
||||
ICryptoTransform cipher = des.CreateEncryptor(keyBytes, null);
|
||||
|
||||
byte[] challenge = new byte[16];
|
||||
|
Loading…
Reference in New Issue
Block a user