From 062a9852e5c5e970927b558d5f8f68997c57a162 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Thu, 24 Dec 2020 15:20:13 +0100 Subject: [PATCH 1/8] Fix small warning --- app/src/main/AndroidManifest.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 716adef98..fafd57592 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -17,7 +17,8 @@ + android:name="android.permission.QUERY_ALL_PACKAGES" + tools:ignore="QueryAllPackagesPermission" /> Date: Mon, 28 Dec 2020 21:11:20 +0100 Subject: [PATCH 2/8] Upgrade to 2.9.8 --- CHANGELOG | 3 +++ app/build.gradle | 4 ++-- fastlane/metadata/android/en-US/changelogs/52.txt | 1 + fastlane/metadata/android/fr-FR/changelogs/52.txt | 1 + 4 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 fastlane/metadata/android/en-US/changelogs/52.txt create mode 100644 fastlane/metadata/android/fr-FR/changelogs/52.txt diff --git a/CHANGELOG b/CHANGELOG index f47e7d1b5..9ea00e7e9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +KeePassDX(2.9.8) + * + KeePassDX(2.9.7) * Fix small bugs * Remove write permission since Android 10 diff --git a/app/build.gradle b/app/build.gradle index 76c017e92..9355b6966 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -12,8 +12,8 @@ android { applicationId "com.kunzisoft.keepass" minSdkVersion 14 targetSdkVersion 30 - versionCode = 51 - versionName = "2.9.7" + versionCode = 52 + versionName = "2.9.8" multiDexEnabled true testApplicationId = "com.kunzisoft.keepass.tests" diff --git a/fastlane/metadata/android/en-US/changelogs/52.txt b/fastlane/metadata/android/en-US/changelogs/52.txt new file mode 100644 index 000000000..42780ecb1 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/52.txt @@ -0,0 +1 @@ + * \ No newline at end of file diff --git a/fastlane/metadata/android/fr-FR/changelogs/52.txt b/fastlane/metadata/android/fr-FR/changelogs/52.txt new file mode 100644 index 000000000..42780ecb1 --- /dev/null +++ b/fastlane/metadata/android/fr-FR/changelogs/52.txt @@ -0,0 +1 @@ + * \ No newline at end of file From 3e8ae3e2e3bec378efcd551ebe7fbce223f4fc81 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Wed, 30 Dec 2020 17:23:17 +0100 Subject: [PATCH 3/8] Upgrade KeePassDX Pro description --- fastlane/pro/metadata/android/en-US/full_description.txt | 2 +- fastlane/pro/metadata/android/fr-FR/full_description.txt | 2 +- fastlane/pro/metadata/android/ja-JP/full_description.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fastlane/pro/metadata/android/en-US/full_description.txt b/fastlane/pro/metadata/android/en-US/full_description.txt index 144c9e3c7..9ecd13423 100644 --- a/fastlane/pro/metadata/android/en-US/full_description.txt +++ b/fastlane/pro/metadata/android/en-US/full_description.txt @@ -1,7 +1,7 @@ Multi-format KeePass password manager, the app allows saving and using passwords, keys and digital identities in a secure way, by integrating the Android design standards. This pro version is under development, buying it encourages faster development, better service, and you contribute to the creation of open source softwares without advertising. -Currently, the application has the same features as the free version with the themes unlocked but is intended to integrate the elements of connection and synchronization facilitated for sites and services commonly used. +Currently, the application has the same features as the free version with the themes unlocked but is intended to integrate elements related to non-free sites and services commonly used. Features - Create database files / entries and groups. diff --git a/fastlane/pro/metadata/android/fr-FR/full_description.txt b/fastlane/pro/metadata/android/fr-FR/full_description.txt index 2969463ba..5342ba8db 100644 --- a/fastlane/pro/metadata/android/fr-FR/full_description.txt +++ b/fastlane/pro/metadata/android/fr-FR/full_description.txt @@ -1,7 +1,7 @@ Gestionnaire de mots de passe KeePass multiformats, l'application permet d'enregistrer et d'utiliser des mots de passe, des clés et des identités numériques de manière sécurisée, en intégrant les normes de conception Android. Cette version pro est en cours de développement, en l'achetant vous encouragez un développement plus rapide, un meilleur service et vous contribuez à la création de logiciels open source sans publicité. -Actuellement, l'application possède les mêmes fonctionnalités que la version gratuite avec les thèmes débloqués mais est destinée à intégrer les éléments de connexion et de synchronisation facilités pour les sites et services couramment utilisés. +Actuellement, l'application possède les mêmes fonctionnalités que la version gratuite avec les thèmes débloqués mais est destinée à intégrer des éléments liés à des sites et services non gratuits couramment utilisés. Fonctionnalités - Création de bases de données / entrées et groupes. diff --git a/fastlane/pro/metadata/android/ja-JP/full_description.txt b/fastlane/pro/metadata/android/ja-JP/full_description.txt index 2ff47dfee..d6f7237e4 100644 --- a/fastlane/pro/metadata/android/ja-JP/full_description.txt +++ b/fastlane/pro/metadata/android/ja-JP/full_description.txt @@ -1,7 +1,7 @@ 複数の形式に対応する KeePass パスワード マネージャー。Android の設計基準が組み込まれており、パスワード、鍵、デジタル ID を安全な方法で保存して使用できます。 この pro バージョンは開発中です。購入することで開発の加速サービスの改善を支援し、広告なしのオープンソース ソフトウェアの作成に貢献できます。 -現在、このアプリケーションの機能はテーマのロックが解除された free バージョンと同じです。よく利用されるサイトやサービスの接続と同期を楽にする要素を統合することが予定されています。 +現在、このアプリケーションの機能はテーマのロックが解除された free バージョンと同じです。一般的に使われている不自由なサイトやサービスに関連する要素を統合することを計画しています。 機能 - データベースファイル / エントリー・グループの作成 From a83032bffaef6e43dced02ebecf735380eaea9d9 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Sat, 2 Jan 2021 09:43:00 +0100 Subject: [PATCH 4/8] Fix binary in a single entry #828 --- .../database/file/input/DatabaseInputKDBX.kt | 23 +++---- .../file/output/DatabaseOutputKDBX.kt | 62 +++++++++++-------- 2 files changed, 44 insertions(+), 41 deletions(-) diff --git a/app/src/main/java/com/kunzisoft/keepass/database/file/input/DatabaseInputKDBX.kt b/app/src/main/java/com/kunzisoft/keepass/database/file/input/DatabaseInputKDBX.kt index e9e3fa0b8..b7dee66c1 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/file/input/DatabaseInputKDBX.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/file/input/DatabaseInputKDBX.kt @@ -958,7 +958,7 @@ class DatabaseInputKDBX(cacheDirectory: File, // Create empty binary if not retrieved in pool if (binaryRetrieve == null) { binaryRetrieve = mDatabase.buildNewBinary(cacheDirectory, - compression = false, protection = true, binaryPoolId = id) + compression = false, protection = false, binaryPoolId = id) } return binaryRetrieve } @@ -1024,29 +1024,20 @@ class DatabaseInputKDBX(cacheDirectory: File, return xpp.safeNextText() } - @Throws(XmlPullParserException::class, IOException::class) - private fun readBase64String(xpp: XmlPullParser): ByteArray { - - //readNextNode = false; - Base64.decode(xpp.safeNextText(), BASE_64_FLAG)?.let { data -> - val plainText = ByteArray(data.size) - randomStream?.processBytes(data, 0, data.size, plainText, 0) - return plainText - } - return ByteArray(0) - } @Throws(XmlPullParserException::class, IOException::class) private fun readProtectedBase64String(xpp: XmlPullParser): ByteArray? { - //(xpp.getEventType() == XmlPullParser.START_TAG); - if (xpp.attributeCount > 0) { val protect = xpp.getAttributeValue(null, DatabaseKDBXXML.AttrProtected) if (protect != null && protect.equals(DatabaseKDBXXML.ValTrue, ignoreCase = true)) { - return readBase64String(xpp) + Base64.decode(xpp.safeNextText(), BASE_64_FLAG)?.let { data -> + val plainText = ByteArray(data.size) + randomStream?.processBytes(data, 0, data.size, plainText, 0) + return plainText + } + return ByteArray(0) } } - return null } diff --git a/app/src/main/java/com/kunzisoft/keepass/database/file/output/DatabaseOutputKDBX.kt b/app/src/main/java/com/kunzisoft/keepass/database/file/output/DatabaseOutputKDBX.kt index 422a0fb49..372623f2c 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/file/output/DatabaseOutputKDBX.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/file/output/DatabaseOutputKDBX.kt @@ -38,7 +38,6 @@ import com.kunzisoft.keepass.database.element.entry.EntryKDBX import com.kunzisoft.keepass.database.element.group.GroupKDBX import com.kunzisoft.keepass.database.element.icon.IconImageCustom import com.kunzisoft.keepass.database.element.node.NodeKDBXInterface -import com.kunzisoft.keepass.database.element.database.BinaryAttachment import com.kunzisoft.keepass.database.element.security.MemoryProtectionConfig import com.kunzisoft.keepass.database.element.security.ProtectedString import com.kunzisoft.keepass.database.exception.DatabaseOutputException @@ -420,41 +419,56 @@ class DatabaseOutputKDBX(private val mDatabaseKDBX: DatabaseKDBX, writeObject(name, String(Base64.encode(data, BASE_64_FLAG))) } + /* + // Normally used by a single entry but obsolete because binaries are in meta tag with kdbx3.1- + // or in file header with kdbx4 + // binary.isProtected attribute is not used to create the XML @Throws(IllegalArgumentException::class, IllegalStateException::class, IOException::class) - private fun writeBinary(binary : BinaryAttachment) { - val binaryLength = binary.length() - if (binaryLength > 0) { + private fun writeEntryBinary(binary : BinaryAttachment) { + if (binary.length() > 0) { if (binary.isProtected) { xml.attribute(null, DatabaseKDBXXML.AttrProtected, DatabaseKDBXXML.ValTrue) - - binary.getInputDataStream().readBytes(BUFFER_SIZE_BYTES) { buffer -> - val encoded = ByteArray(buffer.size) - randomStream!!.processBytes(buffer, 0, encoded.size, encoded, 0) - val charArray = String(Base64.encode(encoded, BASE_64_FLAG)).toCharArray() - xml.text(charArray, 0, charArray.size) + binary.getInputDataStream().use { inputStream -> + inputStream.readBytes(BUFFER_SIZE_BYTES) { buffer -> + val encoded = ByteArray(buffer.size) + randomStream!!.processBytes(buffer, 0, encoded.size, encoded, 0) + xml.text(String(Base64.encode(encoded, BASE_64_FLAG))) + } } } else { - if (binary.isCompressed) { - xml.attribute(null, DatabaseKDBXXML.AttrCompressed, DatabaseKDBXXML.ValTrue) - } // Write the XML - binary.getInputDataStream().readBytes(BUFFER_SIZE_BYTES) { buffer -> - val charArray = String(Base64.encode(buffer, BASE_64_FLAG)).toCharArray() - xml.text(charArray, 0, charArray.size) + binary.getInputDataStream().use { inputStream -> + inputStream.readBytes(BUFFER_SIZE_BYTES) { buffer -> + xml.text(String(Base64.encode(buffer, BASE_64_FLAG))) + } } } } } + */ + // Only uses with kdbx3.1 to write binaries in meta tag + // With kdbx4, don't use this method because binaries are in header file @Throws(IllegalArgumentException::class, IllegalStateException::class, IOException::class) private fun writeMetaBinaries() { xml.startTag(null, DatabaseKDBXXML.ElemBinaries) - // Use indexes because necessarily in DatabaseV4 (binary header ref is the order) + // Use indexes because necessarily (binary header ref is the order) mDatabaseKDBX.binaryPool.doForEachOrderedBinary { index, keyBinary -> xml.startTag(null, DatabaseKDBXXML.ElemBinary) xml.attribute(null, DatabaseKDBXXML.AttrId, index.toString()) - writeBinary(keyBinary.binary) + val binary = keyBinary.binary + if (binary.length() > 0) { + if (binary.isCompressed) { + xml.attribute(null, DatabaseKDBXXML.AttrCompressed, DatabaseKDBXXML.ValTrue) + } + // Write the XML + binary.getInputDataStream().use { inputStream -> + inputStream.readBytes(BUFFER_SIZE_BYTES) { buffer -> + xml.text(String(Base64.encode(buffer, BASE_64_FLAG))) + } + } + } xml.endTag(null, DatabaseKDBXXML.ElemBinary) } @@ -523,13 +537,11 @@ class DatabaseOutputKDBX(private val mDatabaseKDBX: DatabaseKDBX, if (protect) { xml.attribute(null, DatabaseKDBXXML.AttrProtected, DatabaseKDBXXML.ValTrue) - - val data = value.toString().toByteArray(charset("UTF-8")) - val valLength = data.size - - if (valLength > 0) { - val encoded = ByteArray(valLength) - randomStream!!.processBytes(data, 0, valLength, encoded, 0) + val data = value.toString().toByteArray() + val dataLength = data.size + if (data.isNotEmpty()) { + val encoded = ByteArray(dataLength) + randomStream!!.processBytes(data, 0, dataLength, encoded, 0) xml.text(String(Base64.encode(encoded, BASE_64_FLAG))) } } else { From a8a3685965f07d8da80d38113c9bc62cb4f89ea0 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Sat, 2 Jan 2021 13:50:38 +0100 Subject: [PATCH 5/8] Upgrade Room to 2.2.6 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 9355b6966..980454418 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -92,7 +92,7 @@ android { } } -def room_version = "2.2.5" +def room_version = "2.2.6" dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" From 53b51934b9cca0fc024baaa7ec809040f683a4ec Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Sat, 2 Jan 2021 18:14:15 +0100 Subject: [PATCH 6/8] Upgrade kotlin version --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index cde378402..8e5371d69 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.4.10' + ext.kotlin_version = '1.4.21' repositories { jcenter() google() From 50912c69666892695a8583ce6f7412f282066c98 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Sat, 2 Jan 2021 18:25:45 +0100 Subject: [PATCH 7/8] Update CHANGELOG --- CHANGELOG | 5 +++-- fastlane/metadata/android/en-US/changelogs/52.txt | 3 ++- fastlane/metadata/android/fr-FR/changelogs/52.txt | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 9ea00e7e9..df6b6fb1d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,9 +1,10 @@ KeePassDX(2.9.8) - * + * Fix specific attachments with kdbx3.1 databases #828 + * Fix small bugs KeePassDX(2.9.7) + * Remove write permission since Android 10 #823 * Fix small bugs - * Remove write permission since Android 10 KeePassDX(2.9.6) * Fix KeyFile bug #820 diff --git a/fastlane/metadata/android/en-US/changelogs/52.txt b/fastlane/metadata/android/en-US/changelogs/52.txt index 42780ecb1..5edd71c36 100644 --- a/fastlane/metadata/android/en-US/changelogs/52.txt +++ b/fastlane/metadata/android/en-US/changelogs/52.txt @@ -1 +1,2 @@ - * \ No newline at end of file + * Fix specific attachments with kdbx3.1 databases #828 + * Fix small bugs \ No newline at end of file diff --git a/fastlane/metadata/android/fr-FR/changelogs/52.txt b/fastlane/metadata/android/fr-FR/changelogs/52.txt index 42780ecb1..c3ebc1548 100644 --- a/fastlane/metadata/android/fr-FR/changelogs/52.txt +++ b/fastlane/metadata/android/fr-FR/changelogs/52.txt @@ -1 +1,2 @@ - * \ No newline at end of file + * Correction des pièces jointes spécifiques avec les bases kdbx3.1 #828 + * Correction de petits bugs \ No newline at end of file From 8b23932788e62c91f9643d56703261fd9f52e290 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Sat, 2 Jan 2021 18:28:03 +0100 Subject: [PATCH 8/8] Fix IllegalStateException --- .../biometric/AdvancedUnlockFragment.kt | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/com/kunzisoft/keepass/biometric/AdvancedUnlockFragment.kt b/app/src/main/java/com/kunzisoft/keepass/biometric/AdvancedUnlockFragment.kt index c3c04fadf..6ad976420 100644 --- a/app/src/main/java/com/kunzisoft/keepass/biometric/AdvancedUnlockFragment.kt +++ b/app/src/main/java/com/kunzisoft/keepass/biometric/AdvancedUnlockFragment.kt @@ -554,18 +554,20 @@ class AdvancedUnlockFragment: StylishFragment(), AdvancedUnlockManager.AdvancedU readOnlyEducationPerformed: Boolean, onEducationViewClick: ((TapTargetView?) -> Unit)? = null, onOuterViewClick: ((TapTargetView?) -> Unit)? = null) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M - && !readOnlyEducationPerformed) { - val biometricCanAuthenticate = AdvancedUnlockManager.canAuthenticate(requireContext()) - PreferencesUtil.isAdvancedUnlockEnable(requireContext()) - && (biometricCanAuthenticate == BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED - || biometricCanAuthenticate == BiometricManager.BIOMETRIC_SUCCESS) - && mAdvancedUnlockInfoView != null && mAdvancedUnlockInfoView?.visibility == View.VISIBLE - && mAdvancedUnlockInfoView?.unlockIconImageView != null - && passwordActivityEducation.checkAndPerformedBiometricEducation(mAdvancedUnlockInfoView!!.unlockIconImageView!!, - onEducationViewClick, - onOuterViewClick) - } + try { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M + && !readOnlyEducationPerformed) { + val biometricCanAuthenticate = AdvancedUnlockManager.canAuthenticate(requireContext()) + PreferencesUtil.isAdvancedUnlockEnable(requireContext()) + && (biometricCanAuthenticate == BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED + || biometricCanAuthenticate == BiometricManager.BIOMETRIC_SUCCESS) + && mAdvancedUnlockInfoView != null && mAdvancedUnlockInfoView?.visibility == View.VISIBLE + && mAdvancedUnlockInfoView?.unlockIconImageView != null + && passwordActivityEducation.checkAndPerformedBiometricEducation(mAdvancedUnlockInfoView!!.unlockIconImageView!!, + onEducationViewClick, + onOuterViewClick) + } + } catch (ignored: Exception) {} } enum class Mode {