mirror of
https://github.com/chris2511/xca.git
synced 2026-09-12 19:51:05 +05:00
Close #459: pass private key password
The password provided on the command line will be used
as automatic input of the first password dialog.
The database will be opened without requiring a password.
This results in the following bevavior:
- crl-gen works with:
o database password
o private password
o PIN
- keygen works with database password
This commit is contained in:
parent
ed074537f7
commit
387c238d73
@ -15,10 +15,16 @@
|
||||
#include <QMessageBox>
|
||||
|
||||
PwDialogUI_i *PwDialogCore::pwdialog;
|
||||
Passwd PwDialogCore::cmdline_passwd;
|
||||
|
||||
enum open_result PwDialogCore::execute(pass_info *p, Passwd *passwd,
|
||||
bool write, bool abort)
|
||||
{
|
||||
if (!cmdline_passwd.isEmpty()) {
|
||||
*passwd = cmdline_passwd;
|
||||
cmdline_passwd.cleanse();
|
||||
return pw_ok;
|
||||
}
|
||||
if (pwdialog)
|
||||
return pwdialog->execute(p, passwd, write, abort);
|
||||
#if !defined(Q_OS_WIN32)
|
||||
|
||||
@ -26,6 +26,7 @@ class PwDialogCore
|
||||
static PwDialogUI_i *pwdialog;
|
||||
|
||||
public:
|
||||
static Passwd cmdline_passwd;
|
||||
static enum open_result execute(pass_info *p, Passwd *passwd,
|
||||
bool write = false, bool abort = false);
|
||||
static int pwCallback(char *buf, int size, int rwflag, void *userdata);
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#include "pki_base.h"
|
||||
#include "arguments.h"
|
||||
#include "pki_export.h"
|
||||
#include "PwDialogCore.h"
|
||||
#include "db_x509.h"
|
||||
#if defined(Q_OS_WIN32)
|
||||
//For the segfault handler
|
||||
@ -292,14 +293,14 @@ static pki_multi *cmdline_items;
|
||||
static void read_cmdline(int argc, char *argv[], bool console_only)
|
||||
{
|
||||
arguments cmd_opts(argc, argv);
|
||||
pki_evp::passwd = acquire_password(cmd_opts["password"]);
|
||||
PwDialogCore::cmdline_passwd = acquire_password(cmd_opts["password"]);
|
||||
Passwd sqlpw = acquire_password(cmd_opts["sqlpass"]);
|
||||
|
||||
if (cmd_opts.has("verbose")) {
|
||||
QString all = cmd_opts["verbose"];
|
||||
debug_info::set_debug(all.isEmpty() ? QString("all") : all);
|
||||
}
|
||||
if (!cmd_opts.has("password") && console_only)
|
||||
if (console_only)
|
||||
database_model::open_without_password = true;
|
||||
|
||||
if (cmd_opts.has("database"))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user