mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Support key files in kdbx-extract.
This commit is contained in:
parent
007a901dba
commit
2f5d110149
@ -25,6 +25,7 @@
|
||||
#include "crypto/Crypto.h"
|
||||
#include "format/KeePass2Reader.h"
|
||||
#include "keys/CompositeKey.h"
|
||||
#include "keys/FileKey.h"
|
||||
#include "keys/PasswordKey.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
@ -32,16 +33,23 @@ int main(int argc, char **argv)
|
||||
QCoreApplication app(argc, argv);
|
||||
|
||||
if (app.arguments().size() != 3) {
|
||||
qCritical("Usage: kdbx-extract <password> <kdbx file>");
|
||||
qCritical("Usage: kdbx-extract <password/key file> <kdbx file>");
|
||||
return 1;
|
||||
}
|
||||
|
||||
Crypto::init();
|
||||
|
||||
CompositeKey key;
|
||||
if (QFile::exists(app.arguments().at(1))) {
|
||||
FileKey fileKey;
|
||||
fileKey.load(app.arguments().at(1));
|
||||
key.addKey(fileKey);
|
||||
}
|
||||
else {
|
||||
PasswordKey password;
|
||||
password.setPassword(app.arguments().at(1));
|
||||
key.addKey(password);
|
||||
}
|
||||
|
||||
QFile dbFile(app.arguments().at(2));
|
||||
if (!dbFile.exists()) {
|
||||
|
Loading…
Reference in New Issue
Block a user