Exemple #1
0
 public void UpdatePasswordByNewKeyMaterial(string newKeymaterial)
 {
     if (!string.IsNullOrEmpty(this.SecretKey))
     {
         this.Password = PasswordFunctions.EncryptPassword(this.SecretKey, newKeymaterial);
     }
 }
Exemple #2
0
 public void UpdatePasswordsByNewKeyMaterial(string newKeyMaterial)
 {
     this.EncryptedKeePassPassword = PasswordFunctions.EncryptPassword(this.KeePassPassword, newKeyMaterial);
     this.EncryptedDefaultPassword = PasswordFunctions.EncryptPassword(this.DefaultPassword, newKeyMaterial);
     this.EncryptedAmazonAccessKey = PasswordFunctions.EncryptPassword(this.AmazonAccessKey, newKeyMaterial);
     this.EncryptedAmazonSecretKey = PasswordFunctions.EncryptPassword(this.AmazonSecretKey, newKeyMaterial);
 }
Exemple #3
0
        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");
        }
Exemple #4
0
        private static bool TestDatabasePassword(string connectionStringToTest, string databasePassword)
        {
            string connectionString     = BuildConnectionString(connectionStringToTest);
            var    database             = new DataBase(connectionString);
            string databasePasswordHash = PasswordFunctions.EncryptPassword(databasePassword);
            bool   passwordIsValid      = databasePasswordHash == database.GetMasterPasswordHash();

            return(passwordIsValid);
        }
Exemple #5
0
        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);
        }
Exemple #6
0
 public void UpdatePasswordsByNewKeyMaterial(string newKeyMaterial)
 {
     this.EncryptedKeePassPassword = PasswordFunctions.EncryptPassword(this.KeePassPassword, newKeyMaterial);
     this.EncryptedDefaultPassword = PasswordFunctions.EncryptPassword(this.DefaultPassword, newKeyMaterial);
 }