You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//creates random password for encryptionpublicstringCreateRandomString(intlength,Stringstr){stringvalid= str;StringBuilderres=new StringBuilder();Randomrnd=new Random();while(0<length--){
res.Append(valid[rnd.Next(valid.Length)]);}return res.ToString();}
In this function:
Your are using
System.Random()
to generate random position index in thestr
string. The problem is that the default seed is generated byEnvironment.TickCount
(https://referencesource.microsoft.com/#mscorlib/system/random.cs) and it can be predictable as it's said in this article: https://utkusen.com/blog/destroying-the-encryption-of-hidden-tear-ransomware.html.Solution
Use
RNGCryptoServiceProvider
to generate the private key (https://dotnetcodr.com/2016/10/05/generate-truly-random-cryptographic-keys-using-a-random-number-generator-in-net/).The text was updated successfully, but these errors were encountered: