mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-12-16 00:44:17 -05:00
CLI: Add Import XML command (#3572)
The CLI now contains an "import" command that creates a new database from the specified XML export. The new database is in kdbx 4 format, and does not currently accept a keyfile in database creation. This change is required to create new databases from XML backups. Fixes #2458
This commit is contained in:
parent
82cfedfa43
commit
dbe15d32e5
14 changed files with 2127 additions and 1904 deletions
|
|
@ -71,7 +71,7 @@ int Create::execute(const QStringList& arguments)
|
|||
|
||||
auto key = QSharedPointer<CompositeKey>::create();
|
||||
|
||||
auto password = getPasswordFromStdin();
|
||||
auto password = Utils::getPasswordFromStdin();
|
||||
if (!password.isNull()) {
|
||||
key->addKey(password);
|
||||
}
|
||||
|
|
@ -107,28 +107,6 @@ int Create::execute(const QStringList& arguments)
|
|||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read optional password from stdin.
|
||||
*
|
||||
* @return Pointer to the PasswordKey or null if passwordkey is skipped
|
||||
* by user
|
||||
*/
|
||||
QSharedPointer<PasswordKey> Create::getPasswordFromStdin()
|
||||
{
|
||||
QSharedPointer<PasswordKey> passwordKey;
|
||||
QTextStream out(Utils::STDOUT, QIODevice::WriteOnly);
|
||||
|
||||
out << QObject::tr("Insert password to encrypt database (Press enter to leave blank): ");
|
||||
out.flush();
|
||||
QString password = Utils::getPassword();
|
||||
|
||||
if (!password.isEmpty()) {
|
||||
passwordKey = QSharedPointer<PasswordKey>(new PasswordKey(password));
|
||||
}
|
||||
|
||||
return passwordKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a key file from disk. When the path specified does not exist a
|
||||
* new file will be generated. No folders will be generated so the parent
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue