PoShKeePass icon indicating copy to clipboard operation
PoShKeePass copied to clipboard

Can not open database with both KeyFile and MasterKey - The composite key is invalid

Open xanthar opened this issue 2 years ago • 3 comments

Hi.

I create the profile:

New-KeePassDatabaseConfiguration -DatabaseProfileName default -DatabasePath "<VALIDPATHTO.KDBX>" -KeyPath "<ValidPathTo.keyx>" -UseMasterKey

I then try to get entries:

Get-KeePassEntry -DatabaseProfileName default |select *
KeePass Password: **********

I get the following error:

Exception calling "Open" with "3" argument(s): "The composite key is invalid! Make sure the composite key is correct and try again." At C:\Program Files\WindowsPowerShell\Modules\poshkeepass\2.1.3.0\PoShKeePass.psm1:2664 char:9

  •     $null = $DatabaseObject.Open($IOInfo, $CompositeKey, $IStatus ...
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : InvalidCompositeKeyException

InvalidDatabaseConnectionException : The database is not open. At C:\Program Files\WindowsPowerShell\Modules\poshkeepass\2.1.3.0\PoShKeePass.psm1:2669 char:13

  •         Throw 'InvalidDatabaseConnectionException : The database  ...
    
  •         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : OperationStopped: (InvalidDatabase...se is not open.:String) [], RuntimeException
    • FullyQualifiedErrorId : InvalidDatabaseConnectionException : The database is not open.

I have tried without the -MasterKey switch. Also i am sure the paths to the files are correct and the password (Masterkey) entered is correct (Have checked, double and trippel checked in KeePass directly).

The only way i can get this to work is to remove the KeyFile completely from the database. But i would like this option for extra security measures since the database is used by administrator team.

What am i doing wrong here? As mentioned the KeyFile(.keyx), the .kdbx file and the masterkey has been verified directly with KeePass.

xanthar avatar Jan 03 '22 12:01 xanthar

I read this issue:https://github.com/PSKeePass/PoShKeePass/issues/191 and temporarily fixed it by also changing the KeyFile to version 1. But it would be great if this could be updated to work with V.2 keyfiles.

xanthar avatar Jan 03 '22 13:01 xanthar