public void V1MasterPasswordIsUniqueTest() { string key1 = PasswordFunctions.CalculateMasterPasswordKey(MASTERPASSWORD); string key2 = PasswordFunctions.CalculateMasterPasswordKey(MASTERPASSWORD); Assert.AreEqual(key1, key2, "generated master password key v1 doesn't equals."); }
public void V1PasswordsUniqueEncryptionTest() { string key = PasswordFunctions.CalculateMasterPasswordKey(MASTERPASSWORD); string encryptedPassword = PasswordFunctions.EncryptPassword(USERPASSWORD, key); string encryptedPassword2 = PasswordFunctions.EncryptPassword(USERPASSWORD, key); Assert.AreEqual(encryptedPassword, encryptedPassword2, "password encryption v1 doesn't generate identical encrypted bytes"); }
private static string CheckEncryptDecryptPasswordV1(string password, string masterPassword) { string masterKey = PasswordFunctions.CalculateMasterPasswordKey(masterPassword); string encryptedPassword = PasswordFunctions.EncryptPassword(password, masterKey); string decryptedPassword = PasswordFunctions.DecryptPassword(encryptedPassword, masterKey); Assert.AreEqual(password, decryptedPassword, "Unable to decrypt V1 password"); return(encryptedPassword); }
public void V1PasswordsEncryptDecryptTest() { PasswordsEncryptDecryptCheck(CheckEncryptDecryptPasswordV1); string masterKey = PasswordFunctions.CalculateMasterPasswordKey(MASTERPASSWORD); string decryptedPassword = PasswordFunctions.DecryptPassword(string.Empty, masterKey); Assert.AreEqual(string.Empty, decryptedPassword, "Decryption of empty stored password failed"); }
private void AssignFieldsByOldMasterPassword(string masterPassword) { this.oldKey = PasswordFunctions.CalculateMasterPasswordKey(masterPassword); this.storedMasterPassword = PasswordFunctions2.CalculateStoredMasterPasswordKey(masterPassword); this.newKey = PasswordFunctions2.CalculateMasterPasswordKey(masterPassword, this.storedMasterPassword); }