mirror of
https://github.com/chris2511/xca.git
synced 2026-09-12 19:51:05 +05:00
reactivate functionality to change database password
- remove CRTL+X shortcuts from menu - change DB pass not via button, but via file-menu.
This commit is contained in:
parent
44e17ae9da
commit
42da9ac574
@ -31,14 +31,12 @@ unsigned char *pki_evp::curve_flags = NULL;
|
||||
|
||||
void pki_evp::erasePasswd()
|
||||
{
|
||||
for (int i=0; i<MAX_PASS_LENGTH; i++)
|
||||
passwd[i] = 0;
|
||||
memset(passwd, 0, MAX_PASS_LENGTH);
|
||||
}
|
||||
|
||||
void pki_evp::eraseOldPasswd()
|
||||
{
|
||||
for (int i=0; i<MAX_PASS_LENGTH; i++)
|
||||
oldpasswd[i] = 0;
|
||||
memset(oldpasswd, 0, MAX_PASS_LENGTH);
|
||||
}
|
||||
|
||||
void pki_evp::setPasswd(const char *pass)
|
||||
@ -562,6 +560,13 @@ void pki_evp::encryptKey(const char *password)
|
||||
return;
|
||||
}
|
||||
|
||||
void pki_evp::set_evp_key(EVP_PKEY *pkey)
|
||||
{
|
||||
if (key)
|
||||
free(key);
|
||||
key = pkey;
|
||||
}
|
||||
|
||||
void pki_evp::bogusEncryptKey()
|
||||
{
|
||||
ownPass = ptBogus;
|
||||
|
||||
@ -50,6 +50,7 @@ class pki_evp: public pki_key
|
||||
void setOwnPass(enum passType);
|
||||
pki_evp(const QString name = "", int type = EVP_PKEY_RSA);
|
||||
pki_evp(EVP_PKEY *pkey);
|
||||
void set_evp_key(EVP_PKEY *pkey);
|
||||
void encryptKey(const char *password = NULL);
|
||||
void bogusEncryptKey();
|
||||
EVP_PKEY *decryptKey() const;
|
||||
|
||||
326
ui/MainWindow.ui
326
ui/MainWindow.ui
@ -1,7 +1,8 @@
|
||||
<ui version="4.0" >
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow" >
|
||||
<property name="geometry" >
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
@ -9,109 +10,102 @@
|
||||
<height>511</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget" >
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<layout class="QVBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<property name="margin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabView" >
|
||||
<property name="currentIndex" >
|
||||
<widget class="QTabWidget" name="tabView">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="RSATab" >
|
||||
<attribute name="title" >
|
||||
<widget class="QWidget" name="RSATab">
|
||||
<attribute name="title">
|
||||
<string>Private Keys</string>
|
||||
</attribute>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<property name="margin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="XcaTreeView" name="keyView" />
|
||||
<widget class="XcaTreeView" name="keyView"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="keyButtons" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
|
||||
<widget class="QFrame" name="keyButtons">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="BNnewKey" >
|
||||
<property name="text" >
|
||||
<widget class="QPushButton" name="BNnewKey">
|
||||
<property name="text">
|
||||
<string>&New Key</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BNexportKey" >
|
||||
<property name="text" >
|
||||
<widget class="QPushButton" name="BNexportKey">
|
||||
<property name="text">
|
||||
<string>&Export</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BNimportKey" >
|
||||
<property name="text" >
|
||||
<widget class="QPushButton" name="BNimportKey">
|
||||
<property name="text">
|
||||
<string>&Import</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BNimportPFX" >
|
||||
<property name="text" >
|
||||
<widget class="QPushButton" name="BNimportPFX">
|
||||
<property name="text">
|
||||
<string>Import PFX (PKCS#12)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BNdetailsKey" >
|
||||
<property name="text" >
|
||||
<widget class="QPushButton" name="BNdetailsKey">
|
||||
<property name="text">
|
||||
<string>&Show Details</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BNdeleteKey" >
|
||||
<property name="text" >
|
||||
<widget class="QPushButton" name="BNdeleteKey">
|
||||
<property name="text">
|
||||
<string>&Delete</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BNchangePass" >
|
||||
<property name="text" >
|
||||
<string>Change password</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
@ -120,14 +114,14 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="bigKey" >
|
||||
<property name="minimumSize" >
|
||||
<widget class="QLabel" name="bigKey">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>94</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="scaledContents" >
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
@ -137,85 +131,85 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="CertTab" >
|
||||
<attribute name="title" >
|
||||
<widget class="QWidget" name="CertTab">
|
||||
<attribute name="title">
|
||||
<string>Certificate signing requests</string>
|
||||
</attribute>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<property name="margin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="XcaTreeView" name="reqView" />
|
||||
<widget class="XcaTreeView" name="reqView"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="reqButtons" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
|
||||
<widget class="QFrame" name="reqButtons">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<layout class="QVBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<property name="margin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BNnewReq" >
|
||||
<property name="text" >
|
||||
<widget class="QPushButton" name="BNnewReq">
|
||||
<property name="text">
|
||||
<string>&New Request</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BNexportReq" >
|
||||
<property name="text" >
|
||||
<widget class="QPushButton" name="BNexportReq">
|
||||
<property name="text">
|
||||
<string>&Export</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BNimportReq" >
|
||||
<property name="text" >
|
||||
<widget class="QPushButton" name="BNimportReq">
|
||||
<property name="text">
|
||||
<string>&Import</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BNdetailsReq" >
|
||||
<property name="text" >
|
||||
<widget class="QPushButton" name="BNdetailsReq">
|
||||
<property name="text">
|
||||
<string>&Show Details</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BNdeleteReq" >
|
||||
<property name="text" >
|
||||
<widget class="QPushButton" name="BNdeleteReq">
|
||||
<property name="text">
|
||||
<string>&Delete</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
@ -224,14 +218,14 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="bigCsr" >
|
||||
<property name="minimumSize" >
|
||||
<widget class="QLabel" name="bigCsr">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>94</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="scaledContents" >
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
@ -241,100 +235,100 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="ReqTab" >
|
||||
<attribute name="title" >
|
||||
<widget class="QWidget" name="ReqTab">
|
||||
<attribute name="title">
|
||||
<string>Certificates</string>
|
||||
</attribute>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<property name="margin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="CertTreeView" name="certView" />
|
||||
<widget class="CertTreeView" name="certView"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="certButtons" >
|
||||
<property name="frameShape" >
|
||||
<widget class="QFrame" name="certButtons">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<layout class="QVBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<property name="margin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BNnewCert" >
|
||||
<property name="text" >
|
||||
<widget class="QPushButton" name="BNnewCert">
|
||||
<property name="text">
|
||||
<string>&New Certificate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BNexportCert" >
|
||||
<property name="text" >
|
||||
<widget class="QPushButton" name="BNexportCert">
|
||||
<property name="text">
|
||||
<string>&Export</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BNimportCert" >
|
||||
<property name="text" >
|
||||
<widget class="QPushButton" name="BNimportCert">
|
||||
<property name="text">
|
||||
<string>&Import</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BNdetailsCert" >
|
||||
<property name="text" >
|
||||
<widget class="QPushButton" name="BNdetailsCert">
|
||||
<property name="text">
|
||||
<string>&Show Details</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BNdeleteCert" >
|
||||
<property name="text" >
|
||||
<widget class="QPushButton" name="BNdeleteCert">
|
||||
<property name="text">
|
||||
<string>&Delete</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BNimportPKCS12" >
|
||||
<property name="text" >
|
||||
<widget class="QPushButton" name="BNimportPKCS12">
|
||||
<property name="text">
|
||||
<string>Import &PKCS#12</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BNimportPKCS7" >
|
||||
<property name="text" >
|
||||
<widget class="QPushButton" name="BNimportPKCS7">
|
||||
<property name="text">
|
||||
<string>Import P&KCS#7</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BNviewState" >
|
||||
<property name="text" >
|
||||
<widget class="QPushButton" name="BNviewState">
|
||||
<property name="text">
|
||||
<string>Plain View</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
@ -343,14 +337,14 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="bigCert" >
|
||||
<property name="minimumSize" >
|
||||
<widget class="QLabel" name="bigCert">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>94</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="scaledContents" >
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
@ -360,83 +354,83 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="CATab" >
|
||||
<attribute name="title" >
|
||||
<widget class="QWidget" name="CATab">
|
||||
<attribute name="title">
|
||||
<string>Templates</string>
|
||||
</attribute>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<property name="margin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="XcaTreeView" name="tempView" >
|
||||
<property name="alternatingRowColors" >
|
||||
<widget class="XcaTreeView" name="tempView">
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="tempButtons" >
|
||||
<property name="frameShape" >
|
||||
<widget class="QFrame" name="tempButtons">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<layout class="QVBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<property name="margin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BNnewTemp" >
|
||||
<property name="text" >
|
||||
<widget class="QPushButton" name="BNnewTemp">
|
||||
<property name="text">
|
||||
<string>&New template</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BNchangeTemp" >
|
||||
<property name="text" >
|
||||
<widget class="QPushButton" name="BNchangeTemp">
|
||||
<property name="text">
|
||||
<string>Ch&ange Template</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BNdeleteTemp" >
|
||||
<property name="text" >
|
||||
<widget class="QPushButton" name="BNdeleteTemp">
|
||||
<property name="text">
|
||||
<string>&Delete</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BNimportTemp" >
|
||||
<property name="text" >
|
||||
<widget class="QPushButton" name="BNimportTemp">
|
||||
<property name="text">
|
||||
<string>&Import</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BNexportTemp" >
|
||||
<property name="text" >
|
||||
<widget class="QPushButton" name="BNexportTemp">
|
||||
<property name="text">
|
||||
<string>&Export</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
@ -445,14 +439,14 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="bigTemp" >
|
||||
<property name="minimumSize" >
|
||||
<widget class="QLabel" name="bigTemp">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>94</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="scaledContents" >
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
@ -462,72 +456,72 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="unnamed" >
|
||||
<attribute name="title" >
|
||||
<widget class="QWidget" name="unnamed">
|
||||
<attribute name="title">
|
||||
<string>Revocation lists</string>
|
||||
</attribute>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<property name="margin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="XcaTreeView" name="crlView" />
|
||||
<widget class="XcaTreeView" name="crlView"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="crlButtons" >
|
||||
<property name="frameShape" >
|
||||
<widget class="QFrame" name="crlButtons">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<layout class="QVBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<property name="margin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BNexportCrl" >
|
||||
<property name="text" >
|
||||
<widget class="QPushButton" name="BNexportCrl">
|
||||
<property name="text">
|
||||
<string>&Export</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BNimportCrl" >
|
||||
<property name="text" >
|
||||
<widget class="QPushButton" name="BNimportCrl">
|
||||
<property name="text">
|
||||
<string>&Import</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BNdetailsCrl" >
|
||||
<property name="text" >
|
||||
<widget class="QPushButton" name="BNdetailsCrl">
|
||||
<property name="text">
|
||||
<string>&Show Details</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BNdeleteCrl" >
|
||||
<property name="text" >
|
||||
<widget class="QPushButton" name="BNdeleteCrl">
|
||||
<property name="text">
|
||||
<string>&Delete</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
@ -536,14 +530,14 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="bigRev" >
|
||||
<property name="minimumSize" >
|
||||
<widget class="QLabel" name="bigRev">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>94</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="scaledContents" >
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
|
||||
@ -25,22 +25,22 @@ void MainWindow::init_menu()
|
||||
QMenu *file, *help, *import;
|
||||
|
||||
file = menuBar()->addMenu(tr("&File"));
|
||||
file->addAction(tr("New &DataBase"), this,
|
||||
SLOT(new_database()), Qt::CTRL+Qt::Key_N );
|
||||
file->addAction(tr("Open &DataBase"), this,
|
||||
SLOT(load_database()), Qt::CTRL+Qt::Key_L );
|
||||
file->addAction(tr("&New DataBase"), this, SLOT(new_database()));
|
||||
file->addAction(tr("&Open DataBase"), this, SLOT(load_database()));
|
||||
acList += file->addAction(tr("&Close DataBase"), this,
|
||||
SLOT(close_database()), Qt::CTRL+Qt::Key_C );
|
||||
SLOT(close_database()));
|
||||
acList += file->addAction(tr("&Dump DataBase"), this,
|
||||
SLOT(dump_database()), Qt::CTRL+Qt::Key_D );
|
||||
SLOT(dump_database()));
|
||||
acList += file->addAction(tr("C&hange DataBase password"), this,
|
||||
SLOT(changeDbPass()));
|
||||
acList += file->addAction(tr("&Import old db_dump"), this,
|
||||
SLOT(import_dbdump()), Qt::CTRL+Qt::Key_I );
|
||||
SLOT(import_dbdump()));
|
||||
acList += file->addAction(tr("&Undelete items"), this,
|
||||
SLOT(undelete()), Qt::CTRL+Qt::Key_U );
|
||||
SLOT(undelete()));
|
||||
file->addSeparator();
|
||||
acList += file->addAction(tr("Options"), this, SLOT(setOptions()) );
|
||||
acList += file->addAction(tr("Options"), this, SLOT(setOptions()));
|
||||
file->addSeparator();
|
||||
file->addAction(tr("E&xit"), qApp, SLOT(quit()), Qt::ALT+Qt::Key_F4 );
|
||||
file->addAction(tr("Exit"), qApp, SLOT(quit()), Qt::ALT+Qt::Key_F4);
|
||||
|
||||
import = menuBar()->addMenu(tr("I&mport"));
|
||||
import->addAction(tr("Keys"), this,
|
||||
|
||||
@ -162,9 +162,6 @@ MainWindow::MainWindow(QWidget *parent )
|
||||
|
||||
init_curves();
|
||||
|
||||
// FIXME: Change pass isn't functional yet.
|
||||
BNchangePass->setDisabled(true);
|
||||
|
||||
#ifdef MDEBUG
|
||||
CRYPTO_malloc_debug_init();
|
||||
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
|
||||
@ -450,6 +447,113 @@ QString makeSalt(void)
|
||||
return QString(saltbuf);
|
||||
}
|
||||
|
||||
void MainWindow::changeDbPass()
|
||||
{
|
||||
|
||||
char pass[MAX_PASS_LENGTH];
|
||||
int keylen;
|
||||
|
||||
pass_info p(tr("New Password"), tr("Please enter the new password "
|
||||
"to encrypt your private keys in the database-file"),
|
||||
this);
|
||||
|
||||
keylen = passWrite(pass, MAX_PASS_LENGTH-1, 0, &p);
|
||||
if (keylen < 0)
|
||||
return;
|
||||
memset(pass +keylen, 0, MAX_PASS_LENGTH -keylen);
|
||||
|
||||
QString tempn = dbfile + "{new}";
|
||||
try {
|
||||
if (!QFile::copy(dbfile, tempn))
|
||||
throw errorEx("Could not create temporary file: " +
|
||||
tempn);
|
||||
QString passhash = updateDbPassword(tempn, pass);
|
||||
|
||||
QFile new_file(tempn);
|
||||
db mydb(dbfile);
|
||||
mydb.mv(new_file);
|
||||
close_database();
|
||||
pki_evp::passHash = passhash;
|
||||
memcpy(pki_evp::passwd, pass, MAX_PASS_LENGTH);
|
||||
init_database();
|
||||
} catch (errorEx &ex) {
|
||||
QFile::remove(tempn);
|
||||
Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
QString MainWindow::updateDbPassword(QString newdb, char *pass)
|
||||
{
|
||||
db mydb(newdb);
|
||||
|
||||
QString salt = makeSalt();
|
||||
QString passhash = pki_evp::sha512passwd(pass, salt);
|
||||
mydb.set((const unsigned char *)CCHAR(passhash),
|
||||
passhash.length()+1, 1, setting, "pwhash");
|
||||
|
||||
QList<pki_evp*> klist;
|
||||
mydb.first();
|
||||
while (mydb.find(asym_key, QString()) == 0) {
|
||||
QString s;
|
||||
pki_evp *key;
|
||||
unsigned char *p;
|
||||
db_header_t head;
|
||||
|
||||
p = mydb.load(&head);
|
||||
if (!p) {
|
||||
printf("Load was empty !\n");
|
||||
goto next;
|
||||
}
|
||||
key = new pki_evp();
|
||||
if (key->getVersion() < head.version) {
|
||||
printf("Item[%s]: Version %d "
|
||||
"> known version: %d -> ignored\n",
|
||||
head.name, head.version,
|
||||
key->getVersion()
|
||||
);
|
||||
free(p);
|
||||
delete key;
|
||||
goto next;
|
||||
}
|
||||
key->setIntName(QString::fromUtf8(head.name));
|
||||
|
||||
try {
|
||||
key->fromData(p, &head);
|
||||
}
|
||||
catch (errorEx &err) {
|
||||
err.appendString(key->getIntName());
|
||||
Error(err);
|
||||
delete key;
|
||||
key = NULL;
|
||||
}
|
||||
free(p);
|
||||
if (key && key->getOwnPass() == pki_key::ptCommon &&
|
||||
!key->isPubKey())
|
||||
{
|
||||
EVP_PKEY *evp = key->decryptKey();
|
||||
key->set_evp_key(evp);
|
||||
key->encryptKey(pass);
|
||||
klist << key;
|
||||
} else if (key)
|
||||
delete key;
|
||||
next:
|
||||
if (mydb.next())
|
||||
break;
|
||||
}
|
||||
for (int i=0; i< klist.count(); i++) {
|
||||
int size;
|
||||
unsigned char *p;
|
||||
pki_evp *key = klist[i];
|
||||
p = key->toData(&size);
|
||||
check_oom(p);
|
||||
mydb.set(p, size, key->getVersion(),
|
||||
key->getType(), key->getIntName());
|
||||
OPENSSL_free(p);
|
||||
delete key;
|
||||
}
|
||||
return passhash;
|
||||
}
|
||||
|
||||
int MainWindow::initPass()
|
||||
{
|
||||
db mydb(dbfile);
|
||||
|
||||
@ -78,6 +78,7 @@ class MainWindow: public QMainWindow, public Ui::MainWindow
|
||||
void setPath(QString path);
|
||||
bool mkDir(QString dir);
|
||||
void setItemEnabled(bool enable);
|
||||
QString updateDbPassword(QString newdb, char *pass);
|
||||
|
||||
public slots:
|
||||
void init_database();
|
||||
@ -93,6 +94,7 @@ class MainWindow: public QMainWindow, public Ui::MainWindow
|
||||
void undelete();
|
||||
void loadPem();
|
||||
void pastePem();
|
||||
void changeDbPass();
|
||||
|
||||
private slots:
|
||||
void setOptions();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user