Exemplo n.º 1
0
        public void V2MasterPasswordValidationTest()
        {
            string stored  = PasswordFunctions2.CalculateStoredMasterPasswordKey(MASTERPASSWORD);
            string stored2 = PasswordFunctions2.CalculateStoredMasterPasswordKey(MASTERPASSWORD);

            Assert.AreNotEqual(stored, stored2);

            bool isValid = PasswordFunctions2.MasterPasswordIsValid(MASTERPASSWORD, stored);

            Assert.IsTrue(isValid, "Unable to validate encrypted master password version 2");
        }
Exemplo n.º 2
0
        private void Configure(string connectionString, string oldPassword, string newPassword)
        {
            // persistence doesn't have to be fully configured, we need only the persistence passwords part
            this.persistenceSecurity = new SqlPersistenceSecurity();
            this.persistenceSecurity.UpdateDatabaseKey(connectionString, oldPassword);

            if (!string.IsNullOrEmpty(newPassword))
            {
                this.newStoredKey = PasswordFunctions2.CalculateStoredMasterPasswordKey(newPassword);
            }
            this.newKeyMaterial = PasswordFunctions2.CalculateMasterPasswordKey(newPassword, this.newStoredKey);
        }
Exemplo n.º 3
0
        internal void UpdateMasterPassword(string newPassword)
        {
            string storedMasterPassword = PasswordFunctions2.CalculateStoredMasterPasswordKey(newPassword);
            string newMasterKey         = PasswordFunctions2.CalculateMasterPasswordKey(newPassword, storedMasterPassword);

            // start of not secured transaction. Old key is still present,
            // but passwords are already encrypted by new Key
            this.persistence.UpdatePasswordsByNewMasterPassword(newMasterKey);
            settings.UpdateConfigurationPasswords(newMasterKey, storedMasterPassword);
            // finish transaction, the passwords now reflect the new key
            this.KeyMaterial = newMasterKey;
        }
Exemplo n.º 4
0
 private void AssignFieldsByOldMasterPassword(string masterPassword)
 {
     this.oldKey = PasswordFunctions.CalculateMasterPasswordKey(masterPassword);
     this.storedMasterPassword = PasswordFunctions2.CalculateStoredMasterPasswordKey(masterPassword);
     this.newKey = PasswordFunctions2.CalculateMasterPasswordKey(masterPassword, this.storedMasterPassword);
 }
Exemplo n.º 5
0
        private static string CalculateNewMasterPasswordKey(string password)
        {
            string storedKey = PasswordFunctions2.CalculateStoredMasterPasswordKey(password);

            return(PasswordFunctions2.CalculateMasterPasswordKey(password, storedKey));
        }