diff options
author | Timothy Redaelli | 2015-08-05 18:42:12 +0200 |
---|---|---|
committer | Timothy Redaelli | 2015-08-05 18:54:51 +0200 |
commit | b6a90f9b2c4fc58d25d85bcf7f97a344609a1eef (patch) | |
tree | 2c264c827bb39a6b9109052624546a909ad61be0 | |
download | aur-b6a90f9b2c4fc58d25d85bcf7f97a344609a1eef.tar.gz |
Initial commit
-rw-r--r-- | .SRCINFO | 28 | ||||
-rw-r--r-- | 0001-Add-support-for-Twofish-in-KeePass2-code.patch | 124 | ||||
-rw-r--r-- | 0002-Add-Algorithm-label-ComboBox-in-Database-settings-fo.patch | 186 | ||||
-rw-r--r-- | PKGBUILD | 49 | ||||
-rw-r--r-- | keepassx2.install | 13 |
5 files changed, 400 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..fc496df59570 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,28 @@ +pkgbase = keepassx2-twofish + pkgdesc = Cross Platform Password Manager (with unofficial patches for Twofish) + pkgver = beta1 + pkgrel = 1 + url = https://www.keepassx.org/dev/ + install = keepassx2.install + arch = i686 + arch = x86_64 + license = GPL2 + license = GPL3 + makedepends = intltool + makedepends = cmake + depends = shared-mime-info + depends = libxtst + depends = qt4 + conflicts = keepassx + conflicts = keepassx2-git + conflicts = keepassx2 + options = !emptydirs + source = https://www.keepassx.org/dev/attachments/download/100/keepassx-2.0-beta1.tar.gz + source = 0001-Add-support-for-Twofish-in-KeePass2-code.patch + source = 0002-Add-Algorithm-label-ComboBox-in-Database-settings-fo.patch + sha256sums = bce1933c48fd33ef8043dd526d769fd9c454d1b63464c82a35e1f7a8689acbf2 + sha256sums = 901d4dff35f9e21c77cbd0dfe962ca00873c85cb1566bcccfd6492cada94220f + sha256sums = 99a52bb7f2b9b0c00690a5243d74c09667cc2d6f7580ecfc45b6fd4961a7dfb6 + +pkgname = keepassx2-twofish + diff --git a/0001-Add-support-for-Twofish-in-KeePass2-code.patch b/0001-Add-support-for-Twofish-in-KeePass2-code.patch new file mode 100644 index 000000000000..604290e31bfd --- /dev/null +++ b/0001-Add-support-for-Twofish-in-KeePass2-code.patch @@ -0,0 +1,124 @@ +From c259ce3d6ae1476a8ad8b6093fc7c81efc24173e Mon Sep 17 00:00:00 2001 +From: Timothy Redaelli <timothy.redaelli@gmail.com> +Date: Tue, 4 Aug 2015 15:18:41 +0200 +Subject: [PATCH 1/2] Add support for Twofish in KeePass2 code + +--- + src/format/KeePass2.h | 1 + + src/format/KeePass2Reader.cpp | 25 ++++++++++++++++--------- + src/format/KeePass2Writer.cpp | 21 ++++++++++++++------- + 3 files changed, 31 insertions(+), 16 deletions(-) + +diff --git a/src/format/KeePass2.h b/src/format/KeePass2.h +index b49ae4f6..91ee4829 100644 +--- a/src/format/KeePass2.h ++++ b/src/format/KeePass2.h +@@ -33,6 +33,7 @@ namespace KeePass2 + const QSysInfo::Endian BYTEORDER = QSysInfo::LittleEndian; + + const Uuid CIPHER_AES = Uuid(QByteArray::fromHex("31c1f2e6bf714350be5805216afc5aff")); ++ const Uuid CIPHER_TWOFISH = Uuid(QByteArray::fromHex("ad68f29f576f4bb9a36ad47af965346c")); + + const QByteArray INNER_STREAM_SALSA20_IV("\xE8\x30\x09\x4B\x97\x20\x5D\x2A"); + +diff --git a/src/format/KeePass2Reader.cpp b/src/format/KeePass2Reader.cpp +index 2a25001c..9b5a8684 100644 +--- a/src/format/KeePass2Reader.cpp ++++ b/src/format/KeePass2Reader.cpp +@@ -44,6 +44,7 @@ KeePass2Reader::KeePass2Reader() + + Database* KeePass2Reader::readDatabase(QIODevice* device, const CompositeKey& key) + { ++ QScopedPointer<SymmetricCipherStream> cipherStream; + QScopedPointer<Database> db(new Database()); + m_db = db.data(); + m_device = device; +@@ -110,25 +111,31 @@ Database* KeePass2Reader::readDatabase(QIODevice* device, const CompositeKey& ke + hash.addData(m_db->transformedMasterKey()); + QByteArray finalKey = hash.result(); + +- SymmetricCipherStream cipherStream(m_device, SymmetricCipher::Aes256, +- SymmetricCipher::Cbc, SymmetricCipher::Decrypt); +- if (!cipherStream.init(finalKey, m_encryptionIV)) { +- raiseError(cipherStream.errorString()); ++ if (m_db->cipher() == KeePass2::CIPHER_AES) { ++ cipherStream.reset(new SymmetricCipherStream(m_device, SymmetricCipher::Aes256, ++ SymmetricCipher::Cbc, SymmetricCipher::Decrypt)); ++ } ++ else { ++ cipherStream.reset(new SymmetricCipherStream(m_device, SymmetricCipher::Twofish, ++ SymmetricCipher::Cbc, SymmetricCipher::Decrypt)); ++ } ++ if (!cipherStream->init(finalKey, m_encryptionIV)) { ++ raiseError(cipherStream->errorString()); + return Q_NULLPTR; + } +- if (!cipherStream.open(QIODevice::ReadOnly)) { +- raiseError(cipherStream.errorString()); ++ if (!cipherStream->open(QIODevice::ReadOnly)) { ++ raiseError(cipherStream->errorString()); + return Q_NULLPTR; + } + +- QByteArray realStart = cipherStream.read(32); ++ QByteArray realStart = cipherStream->read(32); + + if (realStart != m_streamStartBytes) { + raiseError(tr("Wrong key or database file is corrupt.")); + return Q_NULLPTR; + } + +- HashedBlockStream hashedStream(&cipherStream); ++ HashedBlockStream hashedStream(cipherStream.data()); + if (!hashedStream.open(QIODevice::ReadOnly)) { + raiseError(hashedStream.errorString()); + return Q_NULLPTR; +@@ -312,7 +319,7 @@ void KeePass2Reader::setCipher(const QByteArray& data) + else { + Uuid uuid(data); + +- if (uuid != KeePass2::CIPHER_AES) { ++ if (uuid != KeePass2::CIPHER_AES && uuid != KeePass2::CIPHER_TWOFISH) { + raiseError("Unsupported cipher"); + } + else { +diff --git a/src/format/KeePass2Writer.cpp b/src/format/KeePass2Writer.cpp +index f233ac73..4a6ad713 100644 +--- a/src/format/KeePass2Writer.cpp ++++ b/src/format/KeePass2Writer.cpp +@@ -86,18 +86,25 @@ void KeePass2Writer::writeDatabase(QIODevice* device, Database* db) + m_device = device; + QByteArray headerHash = CryptoHash::hash(header.data(), CryptoHash::Sha256); + CHECK_RETURN(writeData(header.data())); ++ QScopedPointer<SymmetricCipherStream> cipherStream; + +- SymmetricCipherStream cipherStream(device, SymmetricCipher::Aes256, SymmetricCipher::Cbc, +- SymmetricCipher::Encrypt); +- cipherStream.init(finalKey, encryptionIV); +- if (!cipherStream.open(QIODevice::WriteOnly)) { +- raiseError(cipherStream.errorString()); ++ if (db->cipher() == KeePass2::CIPHER_AES) { ++ cipherStream.reset(new SymmetricCipherStream(device, SymmetricCipher::Aes256, ++ SymmetricCipher::Cbc, SymmetricCipher::Encrypt)); ++ } ++ else { ++ cipherStream.reset(new SymmetricCipherStream(device, SymmetricCipher::Twofish, ++ SymmetricCipher::Cbc, SymmetricCipher::Encrypt)); ++ } ++ cipherStream->init(finalKey, encryptionIV); ++ if (!cipherStream->open(QIODevice::WriteOnly)) { ++ raiseError(cipherStream->errorString()); + return; + } +- m_device = &cipherStream; ++ m_device = cipherStream.data(); + CHECK_RETURN(writeData(startBytes)); + +- HashedBlockStream hashedStream(&cipherStream); ++ HashedBlockStream hashedStream(cipherStream.data()); + if (!hashedStream.open(QIODevice::WriteOnly)) { + raiseError(hashedStream.errorString()); + return; +-- +2.5.0 + diff --git a/0002-Add-Algorithm-label-ComboBox-in-Database-settings-fo.patch b/0002-Add-Algorithm-label-ComboBox-in-Database-settings-fo.patch new file mode 100644 index 000000000000..d5524b43a7a2 --- /dev/null +++ b/0002-Add-Algorithm-label-ComboBox-in-Database-settings-fo.patch @@ -0,0 +1,186 @@ +From 2bd441b8ef1f78f5a8e9d3a2aa452f47608b3fab Mon Sep 17 00:00:00 2001 +From: Timothy Redaelli <timothy.redaelli@gmail.com> +Date: Wed, 5 Aug 2015 15:23:49 +0200 +Subject: [PATCH 2/2] Add Algorithm label / ComboBox in Database settings form + +--- + src/gui/DatabaseSettingsWidget.cpp | 13 ++++++ + src/gui/DatabaseSettingsWidget.ui | 89 +++++++++++++++++++++++--------------- + 2 files changed, 68 insertions(+), 34 deletions(-) + +diff --git a/src/gui/DatabaseSettingsWidget.cpp b/src/gui/DatabaseSettingsWidget.cpp +index 007c44a0..34c55b5c 100644 +--- a/src/gui/DatabaseSettingsWidget.cpp ++++ b/src/gui/DatabaseSettingsWidget.cpp +@@ -21,6 +21,7 @@ + #include "core/Database.h" + #include "core/Group.h" + #include "core/Metadata.h" ++#include "format/KeePass2.h" + #include "keys/CompositeKey.h" + + DatabaseSettingsWidget::DatabaseSettingsWidget(QWidget* parent) +@@ -53,6 +54,12 @@ void DatabaseSettingsWidget::load(Database* db) + m_ui->dbDescriptionEdit->setText(meta->description()); + m_ui->recycleBinEnabledCheckBox->setChecked(meta->recycleBinEnabled()); + m_ui->defaultUsernameEdit->setText(meta->defaultUserName()); ++ if (m_db->cipher() == KeePass2::CIPHER_AES) { ++ m_ui->AlgorithmComboBox->setCurrentIndex(0); ++ } ++ else { ++ m_ui->AlgorithmComboBox->setCurrentIndex(1); ++ } + m_ui->transformRoundsSpinBox->setValue(m_db->transformRounds()); + if (meta->historyMaxItems() > -1) { + m_ui->historyMaxItemsSpinBox->setValue(meta->historyMaxItems()); +@@ -82,6 +89,12 @@ void DatabaseSettingsWidget::save() + meta->setName(m_ui->dbNameEdit->text()); + meta->setDescription(m_ui->dbDescriptionEdit->text()); + meta->setDefaultUserName(m_ui->defaultUsernameEdit->text()); ++ if (m_ui->AlgorithmComboBox->currentIndex() == 0) { ++ m_db->setCipher(KeePass2::CIPHER_AES); ++ } ++ else { ++ m_db->setCipher(KeePass2::CIPHER_TWOFISH); ++ } + meta->setRecycleBinEnabled(m_ui->recycleBinEnabledCheckBox->isChecked()); + if (static_cast<quint64>(m_ui->transformRoundsSpinBox->value()) != m_db->transformRounds()) { + QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); +diff --git a/src/gui/DatabaseSettingsWidget.ui b/src/gui/DatabaseSettingsWidget.ui +index 5d1f3d9f..1c233bdd 100644 +--- a/src/gui/DatabaseSettingsWidget.ui ++++ b/src/gui/DatabaseSettingsWidget.ui +@@ -49,35 +49,7 @@ + <item row="2" column="1"> + <widget class="QLineEdit" name="dbDescriptionEdit"/> + </item> +- <item row="3" column="0"> +- <widget class="QLabel" name="transformRoundsLabel"> +- <property name="text"> +- <string>Transform rounds:</string> +- </property> +- </widget> +- </item> +- <item row="4" column="0"> +- <widget class="QLabel" name="defaultUsernameLabel"> +- <property name="text"> +- <string>Default username:</string> +- </property> +- </widget> +- </item> +- <item row="4" column="1"> +- <widget class="QLineEdit" name="defaultUsernameEdit"> +- <property name="enabled"> +- <bool>true</bool> +- </property> +- </widget> +- </item> +- <item row="5" column="0"> +- <widget class="QLabel" name="label"> +- <property name="text"> +- <string>Use recycle bin:</string> +- </property> +- </widget> +- </item> +- <item row="7" column="1"> ++ <item row="9" column="1"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QSpinBox" name="historyMaxSizeSpinBox"> +@@ -100,7 +72,7 @@ + </item> + </layout> + </item> +- <item row="6" column="1"> ++ <item row="8" column="1"> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QSpinBox" name="historyMaxItemsSpinBox"> +@@ -117,7 +89,7 @@ + </item> + </layout> + </item> +- <item row="3" column="1"> ++ <item row="5" column="1"> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QSpinBox" name="transformRoundsSpinBox"> +@@ -144,23 +116,72 @@ + </item> + </layout> + </item> +- <item row="6" column="0"> ++ <item row="8" column="0"> + <widget class="QCheckBox" name="historyMaxItemsCheckBox"> + <property name="text"> + <string>Max. history items:</string> + </property> + </widget> + </item> +- <item row="7" column="0"> ++ <item row="9" column="0"> + <widget class="QCheckBox" name="historyMaxSizeCheckBox"> + <property name="text"> + <string>Max. history size:</string> + </property> + </widget> + </item> +- <item row="5" column="1"> ++ <item row="5" column="0"> ++ <widget class="QLabel" name="transformRoundsLabel"> ++ <property name="text"> ++ <string>Transform rounds:</string> ++ </property> ++ </widget> ++ </item> ++ <item row="7" column="1"> + <widget class="QCheckBox" name="recycleBinEnabledCheckBox"/> + </item> ++ <item row="6" column="0"> ++ <widget class="QLabel" name="defaultUsernameLabel"> ++ <property name="text"> ++ <string>Default username:</string> ++ </property> ++ </widget> ++ </item> ++ <item row="7" column="0"> ++ <widget class="QLabel" name="label"> ++ <property name="text"> ++ <string>Use recycle bin:</string> ++ </property> ++ </widget> ++ </item> ++ <item row="6" column="1"> ++ <widget class="QLineEdit" name="defaultUsernameEdit"> ++ <property name="enabled"> ++ <bool>true</bool> ++ </property> ++ </widget> ++ </item> ++ <item row="4" column="0"> ++ <widget class="QLabel" name="AlgorithmLabel"> ++ <property name="text"> ++ <string>Algorithm:</string> ++ </property> ++ </widget> ++ </item> ++ <item row="4" column="1"> ++ <widget class="QComboBox" name="AlgorithmComboBox"> ++ <item> ++ <property name="text"> ++ <string>AES: 256 Bit (default)</string> ++ </property> ++ </item> ++ <item> ++ <property name="text"> ++ <string>Twofish: 256 Bit</string> ++ </property> ++ </item> ++ </widget> ++ </item> + </layout> + </item> + <item> +-- +2.5.0 + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..70cbdafc881d --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,49 @@ +# Maintainer: Timothy Redaelli <timothy.redaelli@gmail.com> +# Contributor: Michael Laß <bevan@bi-co.net> +# Contributor: Marat "Morion" Talipov <morion.self@gmail.com> + +pkgname=keepassx2-twofish +pkgver=beta1 +pkgrel=1 +pkgdesc="Cross Platform Password Manager (with unofficial patches for Twofish)" +arch=('i686' 'x86_64') +url="https://www.keepassx.org/dev/" +license=('GPL2' 'GPL3') +depends=('shared-mime-info' 'libxtst' 'qt4') +makedepends=('intltool' 'cmake') +conflicts=('keepassx' 'keepassx2-git' 'keepassx2') +options=(!emptydirs) +install=keepassx2.install +source=("https://www.keepassx.org/dev/attachments/download/100/keepassx-2.0-${pkgver}.tar.gz" + 0001-Add-support-for-Twofish-in-KeePass2-code.patch + 0002-Add-Algorithm-label-ComboBox-in-Database-settings-fo.patch) +sha256sums=('bce1933c48fd33ef8043dd526d769fd9c454d1b63464c82a35e1f7a8689acbf2' + '901d4dff35f9e21c77cbd0dfe962ca00873c85cb1566bcccfd6492cada94220f' + '99a52bb7f2b9b0c00690a5243d74c09667cc2d6f7580ecfc45b6fd4961a7dfb6') + +_cmake_keys="-DCMAKE_INSTALL_PREFIX=/usr + -DCMAKE_INSTALL_LIBDIR=/usr/lib + -DCMAKE_BUILD_TYPE=Release" + +prepare() { + cd "keepassx-2.0-$pkgver" + + patch -Np1 -i "$srcdir/0001-Add-support-for-Twofish-in-KeePass2-code.patch" + patch -Np1 -i "$srcdir/0002-Add-Algorithm-label-ComboBox-in-Database-settings-fo.patch" +} + +build() { + cd "keepassx-2.0-$pkgver" + + mkdir -p build + cd build + + cmake $_cmake_keys .. + make +} + +package() { + cd "keepassx-2.0-$pkgver/build" + + make DESTDIR="${pkgdir}" install +} diff --git a/keepassx2.install b/keepassx2.install new file mode 100644 index 000000000000..34ab919aaf96 --- /dev/null +++ b/keepassx2.install @@ -0,0 +1,13 @@ +post_install() { + update-desktop-database -q + update-mime-database usr/share/mime &> /dev/null + gtk-update-icon-cache -q -t -f usr/share/icons/hicolor +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} |