Changes per SRB. Using PKCS5 for encryption of MPC by DesktopPWD and MasterPWD
This commit is contained in:
@@ -9,13 +9,17 @@ namespace sscs.crypto
|
||||
{
|
||||
public class CASACrypto
|
||||
{
|
||||
internal static byte[] Generate16ByteKeyFromString(string TheString)
|
||||
|
||||
private const int SALTSIZE = 64;
|
||||
private const int ITERATION_COUNT = 1000;
|
||||
|
||||
internal static byte[] Generate16ByteKeyFromString(string sTheString)
|
||||
{
|
||||
byte[] baKey = new byte[16]; //return value
|
||||
try
|
||||
{
|
||||
Random rand = new Random(TheString.GetHashCode());
|
||||
rand.NextBytes(baKey);
|
||||
{
|
||||
Rfc2898DeriveBytes pkcs5 = new Rfc2898DeriveBytes(sTheString, SALTSIZE, ITERATION_COUNT);
|
||||
baKey = pkcs5.GetBytes(16);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
@@ -25,7 +29,7 @@ namespace sscs.crypto
|
||||
}
|
||||
return baKey;
|
||||
}
|
||||
|
||||
|
||||
internal static bool StoreKeySetUsingMasterPasscode(byte[] key,
|
||||
byte[] IV, byte[] baMasterPasscode, string fileName)
|
||||
{
|
||||
@@ -440,7 +444,6 @@ namespace sscs.crypto
|
||||
myRijndael.GenerateKey();
|
||||
baPasscode = myRijndael.Key;
|
||||
|
||||
|
||||
EncryptAndStoreMasterPasscodeUsingString(baPasscode,
|
||||
desktopPasswd,
|
||||
fileName);
|
||||
|
||||
Reference in New Issue
Block a user