예제 #1
0
 private static byte[] GetKeyfileBytes(byte[] passwordBytes)
 {
     if (!string.IsNullOrEmpty(Globals.KeyfilePath))
     {
         byte[] keyfileBytes = Keyfiles.ReadKeyfile(Globals.KeyfilePath);
         if (keyfileBytes != null)
         {
             MemoryEncryption.DecryptByteArray(ref passwordBytes);
             // Combine password and keyfile bytes
             passwordBytes = HashingAlgorithms.Blake2(passwordBytes, keyfileBytes);
             MemoryEncryption.EncryptByteArray(ref passwordBytes);
             Utilities.ZeroArray(keyfileBytes);
         }
     }
     return(passwordBytes);
 }
예제 #2
0
 private static byte[] KeyfileAsPassword()
 {
     // If only a keyfile was selected, use the keyfile bytes as the password
     byte[] passwordBytes = Keyfiles.ReadKeyfile(Globals.KeyfilePath);
     return(HashPasswordBytes(passwordBytes));
 }