Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xanthar opened this issue Jan 3, 2022 · 3 comments

Comments

@xanthar
Copy link

xanthar commented Jan 3, 2022

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
Copy link
Author

xanthar commented Jan 3, 2022

I read this issue:#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.

@bjoernwendt
Copy link

You have to set Paramater -UseMasterKey in the command for create the Profile
The Documentation is not correct for Profile with MasterKey.
New-KeePassDatabaseConfiguration -DatabaseProfileName 'KeyFileDB' -DatabasePath "Database.kdbx" -KeyPath "Database.keyx" -UseMasterKey

For Read use: ($psw = ps secure string)
use:Get-KeePassEntry -KeePassEntryGroupPath 'Database/default' -AsPlainText -DatabaseProfileName KeyFileDB -MasterKey $psw
This only works with key Version 1.

@Lucian1000
Copy link

Hi guys

any updates on this one? We are currently facing the same problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants