mirror of
https://github.com/chris2511/xca.git
synced 2026-09-13 18:46:25 +05:00
- support pkcs#11 library selection by file dialog - don't prompt for pin if CKF_PROTECTED_AUTHENTICATION_PATH untested, because of ENODEV on my desk
85 lines
1.7 KiB
C++
85 lines
1.7 KiB
C++
/* vi: set sw=4 ts=4:
|
|
*
|
|
* Copyright (C) 2001 - 2007 Christian Hohnstaedt.
|
|
*
|
|
* All rights reserved.
|
|
*/
|
|
|
|
#include "Options.h"
|
|
#include <openssl/objects.h>
|
|
|
|
Options::Options(QWidget *parent)
|
|
:QDialog(parent)
|
|
{
|
|
QStringList dnl;
|
|
if (!MainWindow::mandatory_dn.isEmpty())
|
|
dnl = MainWindow::mandatory_dn.split(",");
|
|
|
|
NIDlist dn_nid = *MainWindow::dn_nid;
|
|
setWindowTitle(tr(XCA_TITLE));
|
|
setupUi(this);
|
|
|
|
for (int i=0; i < dn_nid.count(); i++)
|
|
extDNobj->addItem(OBJ_nid2ln(dn_nid[i]));
|
|
|
|
for (int i=0; i < dnl.count(); i++) {
|
|
int nid;
|
|
nid = OBJ_sn2nid(CCHAR(dnl[i]));
|
|
extDNlist->insertItem(0, OBJ_nid2ln(nid));
|
|
}
|
|
string_opts << "default" << "nombstr" << "pkix" << "utf8only";
|
|
QStringList s;
|
|
s << tr("automatic detection (default)")
|
|
<< tr("No BMP strings: only printable and T61")
|
|
<< tr("PKIX recommendation in RFC2459")
|
|
<< tr("UTF8 strings only (RFC2459)");
|
|
mbstring->addItems(s);
|
|
}
|
|
|
|
void Options::on_extDNadd_clicked()
|
|
{
|
|
extDNlist->addItem(extDNobj->currentText());
|
|
}
|
|
void Options::on_extDNdel_clicked()
|
|
{
|
|
extDNlist->takeItem(extDNlist->currentRow());
|
|
}
|
|
|
|
QString Options::getDnString()
|
|
{
|
|
QStringList dn;
|
|
for (int j=0; j<extDNlist->count(); j++) {
|
|
int nid;
|
|
nid = OBJ_ln2nid(CCHAR(extDNlist->item(j)->text()));
|
|
dn << QString(OBJ_nid2sn(nid));
|
|
}
|
|
return dn.join(",");
|
|
}
|
|
|
|
void Options::setStringOpt(const QString string_opt)
|
|
{
|
|
int index = string_opts.indexOf(string_opt);
|
|
if (index < 0)
|
|
index = 0;
|
|
mbstring->setCurrentIndex(index);
|
|
}
|
|
|
|
QString Options::getStringOpt()
|
|
{
|
|
return string_opts[mbstring->currentIndex()];
|
|
}
|
|
|
|
void Options::on_fileButton_clicked(void)
|
|
{
|
|
load_pkcs11 l;
|
|
QString fname;
|
|
|
|
fname = QFileDialog::getOpenFileName(this, l.caption,
|
|
pkcs11path->text(), l.filter);
|
|
|
|
if (fname.isEmpty())
|
|
return;
|
|
pkcs11path->setText(fname);
|
|
}
|
|
|