Skip to content

Commit

Permalink
Merge branch 'release/2.9.11'
Browse files Browse the repository at this point in the history
  • Loading branch information
J-Jamet committed Jan 16, 2021
2 parents 77b7afe + 3a55dea commit 2928b7d
Show file tree
Hide file tree
Showing 15 changed files with 92 additions and 27 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
KeePassDX(2.9.11)
* Add Keyfile XML version 2 (fix hex) #844
* Fix hex Keyfile #861

KeePassDX(2.9.10)
* Try to fix autofill #852
* Fix database change dialog displayed too often #853
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ android {
applicationId "com.kunzisoft.keepass"
minSdkVersion 14
targetSdkVersion 30
versionCode = 54
versionName = "2.9.10"
versionCode = 55
versionName = "2.9.11"
multiDexEnabled true

testApplicationId = "com.kunzisoft.keepass.tests"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ import com.kunzisoft.keepass.database.element.security.MemoryProtectionConfig
import com.kunzisoft.keepass.database.exception.UnknownKDF
import com.kunzisoft.keepass.database.file.DatabaseHeaderKDBX.Companion.FILE_VERSION_32_3
import com.kunzisoft.keepass.database.file.DatabaseHeaderKDBX.Companion.FILE_VERSION_32_4
import com.kunzisoft.keepass.utils.StringUtil.hexStringToByteArray
import com.kunzisoft.keepass.utils.StringUtil.removeSpaceChars
import com.kunzisoft.keepass.utils.StringUtil.toHexString
import com.kunzisoft.keepass.utils.UnsignedInt
import com.kunzisoft.keepass.utils.VariantDictionary
import org.apache.commons.codec.binary.Hex
import org.w3c.dom.Node
import java.io.File
import java.io.IOException
Expand Down Expand Up @@ -445,16 +445,19 @@ class DatabaseKDBX : DatabaseVersioned<UUID, UUID, GroupKDBX, EntryKDBX> {
when (xmlKeyFileVersion) {
1F -> {
// No hash in KeyFile XML version 1
return Base64.decode(dataString, BASE_64_FLAG)
}
2F -> {
if (hashString != null
&& checkKeyFileHash(dataString, hashString))
return if (hashString != null
&& checkKeyFileHash(dataString, hashString)) {
Log.i(TAG, "Successful key file hash check.")
else
Hex.decodeHex(dataString)
} else {
Log.e(TAG, "Unable to check the hash of the key file.")
null
}
}
}
return Base64.decode(dataString, BASE_64_FLAG)
}
}
}
Expand All @@ -474,7 +477,7 @@ class DatabaseKDBX : DatabaseVersioned<UUID, UUID, GroupKDBX, EntryKDBX> {
digest = MessageDigest.getInstance("SHA-256")
digest?.reset()
// hexadecimal encoding of the first 4 bytes of the SHA-256 hash of the key.
val dataDigest = digest.digest(data.hexStringToByteArray())
val dataDigest = digest.digest(Hex.decodeHex(data))
.copyOfRange(0, 4)
.toHexString()
success = dataDigest == hash
Expand Down Expand Up @@ -698,8 +701,8 @@ class DatabaseKDBX : DatabaseVersioned<UUID, UUID, GroupKDBX, EntryKDBX> {
private const val DEFAULT_HISTORY_MAX_SIZE = (6 * 1024 * 1024).toLong() // -1 unlimited

private const val XML_NODE_ROOT_NAME = "KeyFile"
private const val XML_NODE_META_NAME = "Meta";
private const val XML_NODE_VERSION_NAME = "Version";
private const val XML_NODE_META_NAME = "Meta"
private const val XML_NODE_VERSION_NAME = "Version"
private const val XML_NODE_KEY_NAME = "Key"
private const val XML_NODE_DATA_NAME = "Data"
private const val XML_ATTRIBUTE_DATA_HASH = "Hash"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import com.kunzisoft.keepass.database.element.node.NodeId
import com.kunzisoft.keepass.database.element.node.Type
import com.kunzisoft.keepass.database.element.security.EncryptionAlgorithm
import com.kunzisoft.keepass.database.exception.DuplicateUuidDatabaseException
import org.apache.commons.codec.binary.Hex
import java.io.ByteArrayInputStream
import java.io.IOException
import java.io.InputStream
Expand Down Expand Up @@ -135,9 +136,14 @@ abstract class DatabaseVersioned<
return xmlKeyByteArray
}

// Check 32 bits key file
if (keyData.size == 32) {
return keyData
// Check 32 bytes key file
when (keyData.size) {
32 -> return keyData
64 -> try {
return Hex.decodeHex(String(keyData))
} catch (ignoredException: Exception) {
// Key is not base 64, treat it as binary data
}
}

// Hash file as binary data
Expand Down
12 changes: 0 additions & 12 deletions app/src/main/java/com/kunzisoft/keepass/utils/StringUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,5 @@ object StringUtil {
return this.replace("[\\r|\\n|\\t|\\s|\\u00A0]+".toRegex(), "")
}

fun String.hexStringToByteArray(): ByteArray {
val len = this.length
val data = ByteArray(len / 2)
var i = 0
while (i < len) {
data[i / 2] = ((Character.digit(this[i], 16) shl 4)
+ Character.digit(this[i + 1], 16)).toByte()
i += 2
}
return data
}

fun ByteArray.toHexString() = joinToString("") { "%02X".format(it) }
}
7 changes: 7 additions & 0 deletions app/src/main/res/values-el/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -545,4 +545,11 @@
<string name="kdf_Argon2d">Argon2d</string>
<string name="error_rebuild_list">Δεν είναι δυνατή η σωστή αναδημιουργία της λίστας.</string>
<string name="error_database_uri_null">Δεν είναι δυνατή η ανάκτηση του URI βάσης δεδομένων.</string>
<string name="autofill_inline_suggestions_keyboard">Προστέθηκαν προτάσεις αυτόματης συμπλήρωσης.</string>
<string name="autofill_inline_suggestions_summary">Απόπειρα εμφάνισης προτάσεων αυτόματης συμπλήρωσης απευθείας από ένα συμβατό πληκτρολόγιο</string>
<string name="autofill_inline_suggestions_title">Προτάσεις στην ίδια γραμμή</string>
<string name="warning_database_revoked">Πρόσβαση στο αρχείο που ανακλήθηκε από το διαχειριστή αρχείων, κλείστε τη βάση δεδομένων και ανοίξτε το ξανά από τη θέση του.</string>
<string name="warning_database_info_changed_options">Αντικαταστήστε τις εξωτερικές τροποποιήσεις αποθηκεύοντας τη βάση δεδομένων ή φορτώστε την ξανά με τις πιο πρόσφατες αλλαγές.</string>
<string name="warning_database_info_changed">Οι πληροφορίες που περιέχονται στο αρχείο της βάσης δεδομένων σας έχουν τροποποιηθεί εκτός της εφαρμογής.</string>
<string name="menu_reload_database">Επαναφόρτωση βάσης δεδομένων</string>
</resources>
7 changes: 7 additions & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -554,4 +554,11 @@
<string name="kdf_Argon2d">Argon2d</string>
<string name="error_rebuild_list">Impossible de reconstruire correctement la liste.</string>
<string name="error_database_uri_null">L\'URI de la base de données ne peut pas être récupéré.</string>
<string name="autofill_inline_suggestions_keyboard">Suggestions de remplissage automatique ajoutées.</string>
<string name="autofill_inline_suggestions_summary">Tente d\'afficher des suggestions de remplissage automatique directement à partir d\'un clavier compatible</string>
<string name="autofill_inline_suggestions_title">Suggestions en ligne</string>
<string name="warning_database_info_changed_options">Écraser les modifications externes en sauvegardant la base de données ou recharger-la avec les dernières modifications.</string>
<string name="warning_database_revoked">Accès au dossier révoqué par le gestionnaire de fichiers, fermer la base de données et la rouvrir à partir de son emplacement.</string>
<string name="warning_database_info_changed">Les informations contenues dans votre fichier de base de données ont été modifiées en dehors de l\'application.</string>
<string name="menu_reload_database">Recharger la base de données</string>
</resources>
11 changes: 9 additions & 2 deletions app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
<string name="autofill_service_name">Autocompletamento di KeePassDX</string>
<string name="autofill_sign_in_prompt">Accedi con KeePassDX</string>
<string name="set_autofill_service_title">Imposta servizio predefinito di autocompletamento</string>
<string name="autofill_explanation_summary">Attiva l\'autocompletamento per compilare velocemente i moduli in altre app</string>
<string name="autofill_explanation_summary">Attiva l\'autocompletamento per riempire velocemente i campi in altre app</string>
<string name="password_size_title">Dimensione password generata</string>
<string name="password_size_summary">Imposta la dimensione predefinita delle password generate</string>
<string name="list_password_generator_options_title">Caratteri password</string>
Expand Down Expand Up @@ -235,7 +235,7 @@
<string name="other">Altro</string>
<string name="keyboard">Tastiera</string>
<string name="magic_keyboard_title">Magitastiera</string>
<string name="magic_keyboard_explanation_summary">Attiva una tastiera personale che popola le tue password e i campi di identità</string>
<string name="magic_keyboard_explanation_summary">Attiva una tastiera personale che inserisce le tue password e i campi di identità</string>
<string name="allow_no_password_title">Non consentire nessuna chiave principale</string>
<string name="allow_no_password_summary">Permetti di toccare il pulsante \"Apri\" se non sono selezionate credenziali</string>
<string name="enable_read_only_title">Protetto da scrittura</string>
Expand Down Expand Up @@ -548,4 +548,11 @@
<string name="kdf_Argon2d">Argon2d</string>
<string name="error_rebuild_list">Non è possibile ricostruire la lista correttamente.</string>
<string name="error_database_uri_null">Non è stato recuperato l\'indirizzo del database.</string>
<string name="autofill_inline_suggestions_keyboard">Suggerimento di riempimento aggiunto.</string>
<string name="autofill_inline_suggestions_summary">Mostra i suggerimenti di riempimento campi in una tastiera compatibile</string>
<string name="autofill_inline_suggestions_title">Suggerimenti in linea</string>
<string name="warning_database_revoked">L\'accesso al file è stato revocato dal file manager, chiudi il database e riaprilo dalla sua posizione originale.</string>
<string name="warning_database_info_changed_options">Sovrascrivi le modifiche esterne salvano il database o ricaricalo con gli ultimi cambiamenti.</string>
<string name="warning_database_info_changed">I dati nel tuo database sono stati modificati al di fuori di questa app.</string>
<string name="menu_reload_database">Ricarica database</string>
</resources>
11 changes: 11 additions & 0 deletions app/src/main/res/values-pl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -541,4 +541,15 @@
<string name="advanced_unlock_scanning_error">Błąd zaawansowanego odblokowywania: %1$s</string>
<string name="error_rebuild_list">Nie można poprawnie odbudować listy.</string>
<string name="error_database_uri_null">Nie można pobrać identyfikatora URI bazy danych.</string>
<string name="autofill_inline_suggestions_keyboard">Dodano sugestie autouzupełniania.</string>
<string name="autofill_inline_suggestions_title">Sugestie wbudowane</string>
<string name="autofill_inline_suggestions_summary">Spróbuj wyświetlić sugestie autouzupełniania bezpośrednio z kompatybilnej klawiatury</string>
<string name="temp_advanced_unlock_enable_title">Zaawansowane odblokowywanie tymczasowe</string>
<string name="advanced_unlock_prompt_not_initialized">Nie można zainicjować zaawansowanego monitu o odblokowanie.</string>
<string name="open_advanced_unlock_prompt_store_credential">Otwórz zaawansowany monit o odblokowanie, aby zapisać poświadczenia</string>
<string name="open_advanced_unlock_prompt_unlock_database">Otwórz zaawansowany monit o odblokowanie, aby odblokować bazę danych</string>
<string name="warning_database_revoked">Dostęp do pliku odwołany przez menedżera plików, zamknij bazę danych i otwórz ją ponownie z jej lokalizacji.</string>
<string name="warning_database_info_changed_options">Nadpisz zewnętrzne modyfikacje, zapisując bazę danych lub przeładuj ją z najnowszymi zmianami.</string>
<string name="warning_database_info_changed">Informacje zawarte w pliku bazy danych zostały zmodyfikowane poza aplikacją.</string>
<string name="menu_reload_database">Załaduj ponownie bazę danych</string>
</resources>
7 changes: 7 additions & 0 deletions app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -545,4 +545,11 @@
<string name="kdf_Argon2d">Argon2D</string>
<string name="error_database_uri_null">Невозможно получить URI базы.</string>
<string name="error_rebuild_list">Невозможно правильно перестроить список.</string>
<string name="autofill_inline_suggestions_keyboard">Предложения автозаполнения добавлены.</string>
<string name="autofill_inline_suggestions_summary">Показывать предложения автозаполнения непосредственно в совместимой клавиатуре</string>
<string name="autofill_inline_suggestions_title">Встроенные предложения</string>
<string name="warning_database_revoked">Доступ к файлу отозван файловым менеджером, закройте базу и снова откройте.</string>
<string name="warning_database_info_changed_options">Сохранить базу, перезаписав внешние изменения, или перезагрузить её с последними изменениями.</string>
<string name="warning_database_info_changed">Информация, содержащаяся в файле базы, была изменена вне этого приложения.</string>
<string name="menu_reload_database">Перезагрузить базу</string>
</resources>
7 changes: 7 additions & 0 deletions app/src/main/res/values-tr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -529,4 +529,11 @@
<string name="kdf_Argon2d">Argon2d</string>
<string name="error_rebuild_list">Liste düzgün şekilde yeniden oluşturulamıyor.</string>
<string name="error_database_uri_null">Veri tabanı URI\'si alınamıyor.</string>
<string name="autofill_inline_suggestions_keyboard">Otomatik doldurma önerileri eklendi.</string>
<string name="autofill_inline_suggestions_summary">Doğrudan uyumlu bir klavyeden otomatik doldurma önerileri görüntülemeye çalış</string>
<string name="autofill_inline_suggestions_title">Satır içi öneriler</string>
<string name="warning_database_revoked">Dosyaya erişim dosya yöneticisi tarafından iptal edildi, veri tabanını kapatın ve bulunduğu yerden yeniden açın.</string>
<string name="warning_database_info_changed_options">Veri tabanını kaydederek veya en son değişikliklerle yeniden yükleyerek harici değişikliklerin üzerine yazın.</string>
<string name="warning_database_info_changed">Veri tabanı dosyanızda bulunan bilgiler, uygulamanın dışında değiştirildi.</string>
<string name="menu_reload_database">Veri tabanını yeniden yükle</string>
</resources>
7 changes: 7 additions & 0 deletions app/src/main/res/values-uk/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -545,4 +545,11 @@
<string name="kdf_Argon2d">Argon2d</string>
<string name="error_rebuild_list">Не вдалося належним чином відновити список.</string>
<string name="error_database_uri_null">Неможливо отримати URI бази даних.</string>
<string name="autofill_inline_suggestions_keyboard">Додано пропозиції автозаповнення.</string>
<string name="autofill_inline_suggestions_summary">Спробувати показ пропозицій автозаповнення безпосередньо з сумісної клавіатури</string>
<string name="autofill_inline_suggestions_title">Вбудовані пропозиції</string>
<string name="warning_database_revoked">Доступ до файлу скасовано менеджером файлів, закрийте базу даних і знову відкрийте її з її розташування.</string>
<string name="warning_database_info_changed_options">Перезаписати зовнішні зміни, зберігши базу даних або перезавантажте її з найновішими змінами.</string>
<string name="warning_database_info_changed">Відомості, що містяться у файлі бази даних, змінено за межами застосунку.</string>
<string name="menu_reload_database">Перезавантажити базу даних</string>
</resources>
7 changes: 7 additions & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -545,4 +545,11 @@
<string name="kdf_Argon2d">Argon2d</string>
<string name="error_rebuild_list">无法正确地重建列表。</string>
<string name="error_database_uri_null">无法检索数据库 URI 。</string>
<string name="autofill_inline_suggestions_keyboard">已添加自动填充建议。</string>
<string name="autofill_inline_suggestions_summary">尝试直接从兼容的键盘显示自动填充建议</string>
<string name="autofill_inline_suggestions_title">内联建议</string>
<string name="warning_database_revoked">文件管理器撤销了对此文件的访问,关闭数据库并从其位置重新打开它。</string>
<string name="warning_database_info_changed_options">通过保存数据库或用最新的更改重新加载数据库来覆盖外部修改。</string>
<string name="warning_database_info_changed">数据库文件中包含的信息已在应用程序之外被修改。</string>
<string name="menu_reload_database">重新加载数据库</string>
</resources>
2 changes: 2 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/55.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Add Keyfile XML version 2 (fix hex) #844
* Fix hex Keyfile #861
2 changes: 2 additions & 0 deletions fastlane/metadata/android/fr-FR/changelogs/55.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Ajout de fichier de clé XML version 2 (correction hex) #844
* Correction de fichier de clé hex #861

0 comments on commit 2928b7d

Please sign in to comment.