mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-01-13 16:30:29 -05: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 "crypto/Crypto.h"
|
||||||
#include "format/KeePass2Reader.h"
|
#include "format/KeePass2Reader.h"
|
||||||
#include "keys/CompositeKey.h"
|
#include "keys/CompositeKey.h"
|
||||||
|
#include "keys/FileKey.h"
|
||||||
#include "keys/PasswordKey.h"
|
#include "keys/PasswordKey.h"
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
@ -32,16 +33,23 @@ int main(int argc, char **argv)
|
|||||||
QCoreApplication app(argc, argv);
|
QCoreApplication app(argc, argv);
|
||||||
|
|
||||||
if (app.arguments().size() != 3) {
|
if (app.arguments().size() != 3) {
|
||||||
qCritical("Usage: kdbx-extract <password> <kdbx file>");
|
qCritical("Usage: kdbx-extract <password/key file> <kdbx file>");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Crypto::init();
|
Crypto::init();
|
||||||
|
|
||||||
CompositeKey key;
|
CompositeKey key;
|
||||||
|
if (QFile::exists(app.arguments().at(1))) {
|
||||||
|
FileKey fileKey;
|
||||||
|
fileKey.load(app.arguments().at(1));
|
||||||
|
key.addKey(fileKey);
|
||||||
|
}
|
||||||
|
else {
|
||||||
PasswordKey password;
|
PasswordKey password;
|
||||||
password.setPassword(app.arguments().at(1));
|
password.setPassword(app.arguments().at(1));
|
||||||
key.addKey(password);
|
key.addKey(password);
|
||||||
|
}
|
||||||
|
|
||||||
QFile dbFile(app.arguments().at(2));
|
QFile dbFile(app.arguments().at(2));
|
||||||
if (!dbFile.exists()) {
|
if (!dbFile.exists()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user