diff options
author | ubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2012-09-16 22:25:44 +0000 |
---|---|---|
committer | ubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2012-09-16 22:25:44 +0000 |
commit | 703dda5b86fa845c02e34be399628c1e04f321b4 (patch) | |
tree | 3766e02e4722a69c835a52548bbeb4f563830fe0 | |
parent | merge mac-build-branch with trunk (diff) | |
download | gpg4usb-703dda5b86fa845c02e34be399628c1e04f321b4.tar.gz gpg4usb-703dda5b86fa845c02e34be399628c1e04f321b4.zip |
keygen fix
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@958 34ebc366-c3a9-4b3c-9f84-69acf7962910
-rw-r--r-- | keygendialog.cpp | 3 | ||||
-rw-r--r-- | kgpg/transactions/kgpggeneratekey.cpp | 19 | ||||
-rw-r--r-- | kgpg/transactions/kgpggeneratekey.h | 4 |
3 files changed, 20 insertions, 6 deletions
diff --git a/keygendialog.cpp b/keygendialog.cpp index 0778b0c..75116c6 100644 --- a/keygendialog.cpp +++ b/keygendialog.cpp @@ -167,7 +167,8 @@ void KeyGenDialog::keyGenAccept() KgpgCore::ALGO_RSA_RSA, keySizeSpinBox->cleanText().toInt(), 0, - 'd'); + 'd', + passwordEdit->text()); genkey->start(); diff --git a/kgpg/transactions/kgpggeneratekey.cpp b/kgpg/transactions/kgpggeneratekey.cpp index d95f1e0..52fc1a2 100644 --- a/kgpg/transactions/kgpggeneratekey.cpp +++ b/kgpg/transactions/kgpggeneratekey.cpp @@ -22,7 +22,7 @@ KGpgGenerateKey::KGpgGenerateKey(QObject *parent, const QString &name, const QString &email, const QString &comment, const KgpgCore::KgpgKeyAlgo &algorithm, const uint size, const unsigned int expire, - const char expireunit) + const char expireunit, const QString &password) : KGpgTransaction(parent) { addArgument(QLatin1String( "--status-fd=1" )); @@ -37,6 +37,7 @@ KGpgGenerateKey::KGpgGenerateKey(QObject *parent, const QString &name, const QSt setAlgorithm(algorithm); setSize(size); setExpire(expire, expireunit); + setPassword(password); getProcess()->setOutputChannelMode(KProcess::SeparateChannels); } @@ -103,10 +104,14 @@ KGpgGenerateKey::postStart() keymessage.append(QByteArray::number(m_expire)); keymessage.append(m_expireunit); } + + keymessage.append("\nPassphrase: "); - write(keymessage, false); + keymessage.append(m_password.toUtf8()); + write(keymessage, true); + write("%commit"); - QString passdlgmessage; + /*QString passdlgmessage; if (!m_email.isEmpty()) { passdlgmessage = QObject::tr("<p><b>Enter passphrase for %1 <%2></b>:<br />Passphrase should include non alphanumeric characters and random sequences.</p>").arg(m_name).arg(m_email); } else { @@ -114,7 +119,7 @@ KGpgGenerateKey::postStart() } QApplication::restoreOverrideCursor(); - askNewPassphrase(passdlgmessage); + askNewPassphrase(passdlgmessage);*/ } bool @@ -261,6 +266,12 @@ KGpgGenerateKey::setExpire(const unsigned int expire, const char expireunit) m_expireunit = expireunit; } +void +KGpgGenerateKey::setPassword(const QString &password) +{ + m_password = password; +} + QString KGpgGenerateKey::getFingerprint() const { diff --git a/kgpg/transactions/kgpggeneratekey.h b/kgpg/transactions/kgpggeneratekey.h index 3649d8f..fef0004 100644 --- a/kgpg/transactions/kgpggeneratekey.h +++ b/kgpg/transactions/kgpggeneratekey.h @@ -47,7 +47,7 @@ public: */ KGpgGenerateKey(QObject *parent, const QString &name, const QString &email, const QString &comment, const KgpgCore::KgpgKeyAlgo &algorithm, const uint size, const unsigned int expire = 0, - const char expireunit = 'd'); + const char expireunit = 'd', const QString &password = ""); virtual ~KGpgGenerateKey(); void setName(const QString &name); @@ -57,6 +57,7 @@ public: void setComment(const QString &comment); void setAlgorithm(const KgpgCore::KgpgKeyAlgo &algorithm); void setSize(const unsigned int size); + void setPassword(const QString &password); /** * @brief set expire date for key * @param expire defines the key expiry time together with \em expireunit, 0 for unlimited key lifetime @@ -87,6 +88,7 @@ private: QString m_name; QString m_email; QString m_comment; + QString m_password; KgpgCore::KgpgKeyAlgo m_algorithm; unsigned int m_size; unsigned int m_expire; |