diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index 49d9d7048..0315a7d60 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -30,7 +30,7 @@ If applicable, add screenshots to help explain your problem.
- Size: [e.g. 150Mo]
- Contains attachment: [e.g. Yes]
-**KeePass DX (please complete the following information):**
+**KeePassDX (please complete the following information):**
- Version: [e.g. 2.5.0.0beta23]
- Build: [e.g. Free]
- Language: [e.g. French]
diff --git a/CHANGELOG b/CHANGELOG
index b1d2b6707..49fabe095 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,16 @@
+KeepassDX (2.5.0.0beta26)
+ * Download attachments
+ * Change file size string format
+ * Prevent screenshot for all screen
+ * Auto performed "Go" key in Magikeyboard
+ * Restore and delete entry history
+ * Setting to hide expired entries
+ * New Black theme
+ * Fix crash when clearing clipboard
+ * Fix attachments compressions
+ * Fix dates
+ * Fix UUID message for Database v1
+
KeepassDX (2.5.0.0beta25)
* Setting for Recycle Bin
* Fix Recycle bin issues
diff --git a/LICENSE b/LICENSE
index 873671ea7..7410c373a 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
---
-KeePass DX is free software: you can redistribute it and/or modify
+KeePassDX is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
@@ -13,7 +13,7 @@ KeePass DX is free software: you can redistribute it and/or modify
You should have received a copy of the GNU General Public License
along with this program. If not, see .
-The KeePass DX icon was created by Jeremy JAMET and is licensed under the terms of GPLv3.
+The KeePassDX icon was created by Jeremy JAMET and is licensed under the terms of GPLv3.
---
diff --git a/ReadMe.md b/ReadMe.md
index 1fbedeedd..09b71d579 100644
--- a/ReadMe.md
+++ b/ReadMe.md
@@ -1,6 +1,6 @@
-# Android Keepass DX
+# Android KeepassDX
-
Keepass DX is a **multi-format KeePass manager for Android devices**. The application allows to create keys and passwords in a secure way by integrating with the Android design standards.
+
KeepassDX is a **multi-format KeePass manager for Android devices**. The application allows to create keys and passwords in a secure way by integrating with the Android design standards.
@@ -8,27 +8,27 @@
* Create database files / entries and groups
* Support for **.kdb** and **.kdbx** files (version 1 to 4) with AES - Twofish - ChaCha20 - Argon2 algorithm
- * **Compatible** with the majority of alternative programs (KeePass, KeePassX, KeePass XC...)
+ * **Compatible** with the majority of alternative programs (KeePass, KeePassX, KeePassXC...)
* Allows **fast copy** of fields and opening of URI / URL
* **Biometric recognition** for fast unlocking *(Fingerprint / Face unlock / ...)*
- * **One-Time Password** management *(HOTP / TOTP)*
+ * **One-Time Password** management *(HOTP / TOTP)* for Two-factor authentication (2FA)
* Material design with **themes**
* **AutoFill** and Integration
* Field filling **keyboard**
* Precise management of **settings**
* Code written in **native language** *(Kotlin / Java / JNI / C)*
-Keepass DX is **open source** and **ad-free**.
+KeepassDX is **open source** and **ad-free**.
-## What is KeePass DX?
+## What is KeePassDX?
Today you need to remember many passwords. You need a password for your e-mail account, your website's FTP password, online passwords (like website member account), etc. etc. etc. The list is endless. Also, you **should use different passwords for each account**. Because if you use only one password everywhere and someone gets this password you have a problem... A serious problem. The thief would have access to your e-mail account, website, etc. Unimaginable.
-KeePass DX is a **free open source password manager for Android**, which helps you to **manage your passwords in a secure way**. You can put all your passwords in one database, which is locked with one **master key** or a **key file**. So you **only have to remember one single master password or select the key file** to unlock the whole database. The databases are encrypted using the best and **most secure encryption algorithms** currently known.
+KeePassDX is a **free open source password manager for Android**, which helps you to **manage your passwords in a secure way**. You can put all your passwords in one database, which is locked with one **master key** or a **key file**. So you **only have to remember one single master password or select the key file** to unlock the whole database. The databases are encrypted using the best and **most secure encryption algorithms** currently known.
## Is it really free?
-Yes, KeePass DX is under **free license (OSI certified)** and **without advertising**. You can have a look at its full source and check whether the encryption algorithms are implemented correctly.
+Yes, KeePassDX is under **free license (OSI certified)** and **without advertising**. You can have a look at its full source and check whether the encryption algorithms are implemented correctly.
*Note : If you access the application from a store, visual features may not be available to incentivize the contribution to the work of open source projects. These optional visuals are accessible after a donation (and a small congratulation message :) or the purchase of an extended version, but do not worry, the main features remain completely free. If you contribute to the project and you do not have access to the themes, do not hesitate to contact me at [contact@kunzisoft.com](contact@kunzisoft.com), I will give you the procedure.*
@@ -39,7 +39,7 @@ You can contribute in different ways to help us on our work.
* Add features by a **[pull request](https://help.github.com/articles/about-pull-requests/)**.
* Help to **[translate](https://hosted.weblate.org/projects/keepass-dx/strings/)** into your language (By using [Weblate](https://hosted.weblate.org/projects/keepass-dx/) or with a manual [pull request](https://help.github.com/articles/about-pull-requests/))
* **[Donate](https://www.kunzisoft.com/donation)** 人◕ ‿‿ ◕人Y for a better service and a quick development of your features.
-* Buy the **[Pro version](https://play.google.com/store/apps/details?id=com.kunzisoft.keepass.pro)** of KeePass DX
+* Buy the **[Pro version](https://play.google.com/store/apps/details?id=com.kunzisoft.keepass.pro)** of KeePassDX
## Download
@@ -65,21 +65,21 @@ Other questions? You can read the [F.A.Q.](https://github.com/Kunzisoft/KeePassD
## License
- Copyright (c) 2019 Jeremy Jamet / [Kunzisoft](https://www.kunzisoft.com).
+ Copyright (c) 2020 Jeremy Jamet / [Kunzisoft](https://www.kunzisoft.com).
- This file is part of KeePass DX.
+ This file is part of KeePassDX.
- [KeePass DX](https://www.keepassdx.com) is free software: you can redistribute it and/or modify
+ [KeePassDX](https://www.keepassdx.com) is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
- KeePass DX is distributed in the hope that it will be useful,
+ KeePassDX is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with KeePass DX. If not, see .
+ along with KeePassDX. If not, see .
*This project is a fork of [KeepassDroid](https://github.com/bpellin/keepassdroid) by bpellin.*
diff --git a/app/build.gradle b/app/build.gradle
index d92761824..148ee04b5 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -11,8 +11,8 @@ android {
applicationId "com.kunzisoft.keepass"
minSdkVersion 14
targetSdkVersion 28
- versionCode = 25
- versionName = "2.5.0.0beta25"
+ versionCode = 26
+ versionName = "2.5.0.0beta26"
multiDexEnabled true
testApplicationId = "com.kunzisoft.keepass.tests"
diff --git a/app/src/androidTest/java/com/kunzisoft/keepass/tests/PwDateTest.kt b/app/src/androidTest/java/com/kunzisoft/keepass/tests/PwDateTest.kt
deleted file mode 100644
index eadfbc4eb..000000000
--- a/app/src/androidTest/java/com/kunzisoft/keepass/tests/PwDateTest.kt
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2019 Jeremy Jamet / Kunzisoft.
- *
- * This file is part of KeePass DX.
- *
- * KeePass DX is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * KeePass DX is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
- *
- */
-package com.kunzisoft.keepass.tests
-
-import junit.framework.TestCase
-
-import com.kunzisoft.keepass.database.element.DateInstant
-import com.kunzisoft.keepass.utils.DatabaseInputOutputUtils
-import org.junit.Assert
-
-class PwDateTest : TestCase() {
-
- fun testDate() {
- val jDate = DateInstant(System.currentTimeMillis())
- val intermediate = DateInstant(jDate)
- val cDate = DatabaseInputOutputUtils.readCDate(DatabaseInputOutputUtils.writeCDate(intermediate.date)!!, 0)
-
- Assert.assertTrue("jDate and intermediate not equal", jDate == intermediate)
- Assert.assertTrue("jDate $jDate and cDate $cDate not equal", cDate == jDate)
- }
-}
diff --git a/app/src/androidTest/java/com/kunzisoft/keepass/tests/DatabaseInputOutputUtilsTest.kt b/app/src/androidTest/java/com/kunzisoft/keepass/tests/StringDatabaseKDBUtilsTest.kt
similarity index 62%
rename from app/src/androidTest/java/com/kunzisoft/keepass/tests/DatabaseInputOutputUtilsTest.kt
rename to app/src/androidTest/java/com/kunzisoft/keepass/tests/StringDatabaseKDBUtilsTest.kt
index 61dcd2a5d..94dfa6715 100644
--- a/app/src/androidTest/java/com/kunzisoft/keepass/tests/DatabaseInputOutputUtilsTest.kt
+++ b/app/src/androidTest/java/com/kunzisoft/keepass/tests/StringDatabaseKDBUtilsTest.kt
@@ -1,37 +1,33 @@
/*
- * Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.tests
-import org.junit.Assert.assertArrayEquals
-
-import java.io.ByteArrayOutputStream
-import java.util.Calendar
-import java.util.Random
-
+import com.kunzisoft.keepass.database.element.DateInstant
+import com.kunzisoft.keepass.database.file.DatabaseHeaderKDBX.Companion.ULONG_MAX_VALUE
+import com.kunzisoft.keepass.stream.*
import junit.framework.TestCase
+import org.junit.Assert.assertArrayEquals
+import java.io.ByteArrayOutputStream
+import java.util.*
-import com.kunzisoft.keepass.stream.LEDataInputStream
-import com.kunzisoft.keepass.stream.LEDataOutputStream
-import com.kunzisoft.keepass.utils.DatabaseInputOutputUtils
-
-class DatabaseInputOutputUtilsTest : TestCase() {
+class StringDatabaseKDBUtilsTest : TestCase() {
fun testReadWriteLongZero() {
testReadWriteLong(0.toByte())
@@ -55,15 +51,9 @@ class DatabaseInputOutputUtilsTest : TestCase() {
private fun testReadWriteLong(value: Byte) {
val orig = ByteArray(8)
- val dest = ByteArray(8)
-
- setArray(orig, value, 0, 8)
-
- val one = LEDataInputStream.readLong(orig, 0)
- LEDataOutputStream.writeLong(one, dest, 0)
-
- assertArrayEquals(orig, dest)
+ setArray(orig, value, 8)
+ assertArrayEquals(orig, longTo8Bytes(bytes64ToLong(orig)))
}
fun testReadWriteIntZero() {
@@ -80,24 +70,22 @@ class DatabaseInputOutputUtilsTest : TestCase() {
private fun testReadWriteInt(value: Byte) {
val orig = ByteArray(4)
- val dest = ByteArray(4)
for (i in 0..3) {
orig[i] = 0
}
- setArray(orig, value, 0, 4)
+ setArray(orig, value, 4)
- val one = LEDataInputStream.readInt(orig, 0)
-
- LEDataOutputStream.writeInt(one, dest, 0)
+ val one = bytes4ToInt(orig)
+ val dest = intTo4Bytes(one)
assertArrayEquals(orig, dest)
}
- private fun setArray(buf: ByteArray, value: Byte, offset: Int, size: Int) {
- for (i in offset until offset + size) {
+ private fun setArray(buf: ByteArray, value: Byte, size: Int) {
+ for (i in 0 until size) {
buf[i] = value
}
}
@@ -108,11 +96,10 @@ class DatabaseInputOutputUtilsTest : TestCase() {
orig[0] = 0
orig[1] = 1
- val one = LEDataInputStream.readUShort(orig, 0)
- val dest = LEDataOutputStream.writeUShortBuf(one)
+ val one = bytes2ToUShort(orig)
+ val dest = uShortTo2Bytes(one)
assertArrayEquals(orig, dest)
-
}
fun testReadWriteShortMin() {
@@ -125,15 +112,12 @@ class DatabaseInputOutputUtilsTest : TestCase() {
private fun testReadWriteShort(value: Byte) {
val orig = ByteArray(2)
- val dest = ByteArray(2)
+ setArray(orig, value, 2)
- setArray(orig, value, 0, 2)
-
- val one = LEDataInputStream.readUShort(orig, 0)
- LEDataOutputStream.writeUShort(one, dest, 0)
+ val one = bytes2ToUShort(orig)
+ val dest = uShortTo2Bytes(one)
assertArrayEquals(orig, dest)
-
}
fun testReadWriteByteZero() {
@@ -149,16 +133,8 @@ class DatabaseInputOutputUtilsTest : TestCase() {
}
private fun testReadWriteByte(value: Byte) {
- val orig = ByteArray(1)
- val dest = ByteArray(1)
-
- setArray(orig, value, 0, 1)
-
- val one = DatabaseInputOutputUtils.readUByte(orig, 0)
- DatabaseInputOutputUtils.writeUByte(one, dest, 0)
-
- assertArrayEquals(orig, dest)
-
+ val dest: Byte = uIntToByte(byteToUInt(value))
+ assert(value == dest)
}
fun testDate() {
@@ -168,27 +144,33 @@ class DatabaseInputOutputUtilsTest : TestCase() {
expected.set(2008, 1, 2, 3, 4, 5)
val actual = Calendar.getInstance()
- DatabaseInputOutputUtils.writeCDate(expected.time, cal)?.let { buf ->
- actual.time = DatabaseInputOutputUtils.readCDate(buf, 0, cal).date
+ dateTo5Bytes(expected.time, cal)?.let { buf ->
+ actual.time = bytes5ToDate(buf, cal).date
}
+ val jDate = DateInstant(System.currentTimeMillis())
+ val intermediate = DateInstant(jDate)
+ val cDate = bytes5ToDate(dateTo5Bytes(intermediate.date)!!)
+
assertEquals("Year mismatch: ", 2008, actual.get(Calendar.YEAR))
assertEquals("Month mismatch: ", 1, actual.get(Calendar.MONTH))
assertEquals("Day mismatch: ", 2, actual.get(Calendar.DAY_OF_MONTH))
assertEquals("Hour mismatch: ", 3, actual.get(Calendar.HOUR_OF_DAY))
assertEquals("Minute mismatch: ", 4, actual.get(Calendar.MINUTE))
assertEquals("Second mismatch: ", 5, actual.get(Calendar.SECOND))
+ assertTrue("jDate and intermediate not equal", jDate == intermediate)
+ assertTrue("jDate $jDate and cDate $cDate not equal", cDate == jDate)
}
fun testUUID() {
val bUUID = ByteArray(16)
Random().nextBytes(bUUID)
- val uuid = DatabaseInputOutputUtils.bytesToUuid(bUUID)
- val eUUID = DatabaseInputOutputUtils.uuidToBytes(uuid)
+ val uuid = bytes16ToUuid(bUUID)
+ val eUUID = uuidTo16Bytes(uuid)
- val lUUID = LEDataInputStream.readUuid(bUUID, 0)
- val leUUID = DatabaseInputOutputUtils.uuidToBytes(lUUID)
+ val lUUID = bytes16ToUuid(bUUID)
+ val leUUID = uuidTo16Bytes(lUUID)
assertArrayEquals("UUID match failed", bUUID, eUUID)
assertArrayEquals("UUID match failed", bUUID, leUUID)
@@ -202,8 +184,8 @@ class DatabaseInputOutputUtilsTest : TestCase() {
}
val bos = ByteArrayOutputStream()
- val leos = LEDataOutputStream(bos)
- leos.writeLong(DatabaseInputOutputUtils.ULONG_MAX_VALUE)
+ val leos = LittleEndianDataOutputStream(bos)
+ leos.writeLong(ULONG_MAX_VALUE)
leos.close()
val uLongMax = bos.toByteArray()
diff --git a/app/src/androidTest/java/com/kunzisoft/keepass/tests/crypto/AESTest.kt b/app/src/androidTest/java/com/kunzisoft/keepass/tests/crypto/AESTest.kt
index 590914330..69fdb222c 100644
--- a/app/src/androidTest/java/com/kunzisoft/keepass/tests/crypto/AESTest.kt
+++ b/app/src/androidTest/java/com/kunzisoft/keepass/tests/crypto/AESTest.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.tests.crypto
diff --git a/app/src/androidTest/java/com/kunzisoft/keepass/tests/crypto/CipherTest.kt b/app/src/androidTest/java/com/kunzisoft/keepass/tests/crypto/CipherTest.kt
index 0d19ba794..680f48608 100644
--- a/app/src/androidTest/java/com/kunzisoft/keepass/tests/crypto/CipherTest.kt
+++ b/app/src/androidTest/java/com/kunzisoft/keepass/tests/crypto/CipherTest.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.tests.crypto
@@ -39,9 +39,8 @@ import junit.framework.TestCase
import com.kunzisoft.keepass.crypto.CipherFactory
import com.kunzisoft.keepass.crypto.engine.AesEngine
-import com.kunzisoft.keepass.crypto.engine.CipherEngine
import com.kunzisoft.keepass.stream.BetterCipherInputStream
-import com.kunzisoft.keepass.stream.LEDataInputStream
+import com.kunzisoft.keepass.stream.LittleEndianDataInputStream
class CipherTest : TestCase() {
private val rand = Random()
@@ -93,7 +92,7 @@ class CipherTest : TestCase() {
val bis = ByteArrayInputStream(secrettext)
val cis = BetterCipherInputStream(bis, decrypt)
- val lis = LEDataInputStream(cis)
+ val lis = LittleEndianDataInputStream(cis)
val decrypttext = lis.readBytes(MESSAGE_LENGTH)
diff --git a/app/src/androidTest/java/com/kunzisoft/keepass/tests/crypto/FinalKeyTest.kt b/app/src/androidTest/java/com/kunzisoft/keepass/tests/crypto/FinalKeyTest.kt
index ce98f6db9..1424eceed 100644
--- a/app/src/androidTest/java/com/kunzisoft/keepass/tests/crypto/FinalKeyTest.kt
+++ b/app/src/androidTest/java/com/kunzisoft/keepass/tests/crypto/FinalKeyTest.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.tests.crypto
diff --git a/app/src/androidTest/java/com/kunzisoft/keepass/tests/stream/HashedBlock.kt b/app/src/androidTest/java/com/kunzisoft/keepass/tests/stream/HashedBlock.kt
index 4e80c5226..62cbe52e9 100644
--- a/app/src/androidTest/java/com/kunzisoft/keepass/tests/stream/HashedBlock.kt
+++ b/app/src/androidTest/java/com/kunzisoft/keepass/tests/stream/HashedBlock.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.tests.stream
diff --git a/app/src/androidTest/java/com/kunzisoft/keepass/tests/utils/StringUtilTest.kt b/app/src/androidTest/java/com/kunzisoft/keepass/tests/utils/StringUtilTest.kt
index d681c63ed..e6431e810 100644
--- a/app/src/androidTest/java/com/kunzisoft/keepass/tests/utils/StringUtilTest.kt
+++ b/app/src/androidTest/java/com/kunzisoft/keepass/tests/utils/StringUtilTest.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.tests.utils
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 79fa6bea8..fa6cc5fb6 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,5 +1,6 @@
-
+
+ android:resizeableActivity="true"
+ android:theme="@style/KeepassDXStyle.Night"
+ tools:targetApi="n">
+
.
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.activities
diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/EntryActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/EntryActivity.kt
index 6c672b948..1ef682c3c 100644
--- a/app/src/main/java/com/kunzisoft/keepass/activities/EntryActivity.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/activities/EntryActivity.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*/
package com.kunzisoft.keepass.activities
@@ -22,6 +22,7 @@ import android.app.Activity
import android.content.Intent
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
+import android.net.Uri
import android.os.Bundle
import android.os.Handler
import android.util.Log
@@ -36,24 +37,33 @@ import androidx.appcompat.widget.Toolbar
import com.google.android.material.appbar.CollapsingToolbarLayout
import com.kunzisoft.keepass.R
import com.kunzisoft.keepass.activities.helpers.ReadOnlyHelper
-import com.kunzisoft.keepass.activities.lock.LockingHideActivity
+import com.kunzisoft.keepass.activities.lock.LockingActivity
import com.kunzisoft.keepass.database.element.Database
import com.kunzisoft.keepass.database.element.Entry
import com.kunzisoft.keepass.database.element.node.NodeId
import com.kunzisoft.keepass.education.EntryActivityEducation
import com.kunzisoft.keepass.icons.assignDatabaseIcon
import com.kunzisoft.keepass.magikeyboard.MagikIME
+import com.kunzisoft.keepass.model.AttachmentState
+import com.kunzisoft.keepass.model.EntryAttachment
+import com.kunzisoft.keepass.notifications.AttachmentFileNotificationService
import com.kunzisoft.keepass.notifications.ClipboardEntryNotificationService
+import com.kunzisoft.keepass.notifications.DatabaseTaskNotificationService.Companion.ACTION_DATABASE_DELETE_ENTRY_HISTORY
+import com.kunzisoft.keepass.notifications.DatabaseTaskNotificationService.Companion.ACTION_DATABASE_RESTORE_ENTRY_HISTORY
import com.kunzisoft.keepass.settings.PreferencesUtil
import com.kunzisoft.keepass.settings.SettingsAutofillActivity
+import com.kunzisoft.keepass.tasks.AttachmentFileBinderManager
import com.kunzisoft.keepass.timeout.ClipboardHelper
import com.kunzisoft.keepass.timeout.TimeoutHelper
import com.kunzisoft.keepass.utils.MenuUtil
import com.kunzisoft.keepass.utils.UriUtil
+import com.kunzisoft.keepass.utils.createDocument
+import com.kunzisoft.keepass.utils.onCreateDocumentResult
import com.kunzisoft.keepass.view.EntryContentsView
import java.util.*
+import kotlin.collections.HashMap
-class EntryActivity : LockingHideActivity() {
+class EntryActivity : LockingActivity() {
private var collapsingToolbarLayout: CollapsingToolbarLayout? = null
private var titleIconView: ImageView? = null
@@ -65,10 +75,16 @@ class EntryActivity : LockingHideActivity() {
private var mDatabase: Database? = null
private var mEntry: Entry? = null
+
private var mIsHistory: Boolean = false
+ private var mEntryLastVersion: Entry? = null
+ private var mEntryHistoryPosition: Int = -1
private var mShowPassword: Boolean = false
+ private var mAttachmentFileBinderManager: AttachmentFileBinderManager? = null
+ private var mAttachmentsToDownload: HashMap = HashMap()
+
private var clipboardHelper: ClipboardHelper? = null
private var firstLaunchOfActivity: Boolean = false
@@ -108,6 +124,21 @@ class EntryActivity : LockingHideActivity() {
// Init the clipboard helper
clipboardHelper = ClipboardHelper(this)
firstLaunchOfActivity = true
+
+ // Init attachment service binder manager
+ mAttachmentFileBinderManager = AttachmentFileBinderManager(this)
+
+ mProgressDialogThread?.onActionFinish = { actionTask, result ->
+ when (actionTask) {
+ ACTION_DATABASE_RESTORE_ENTRY_HISTORY,
+ ACTION_DATABASE_DELETE_ENTRY_HISTORY -> {
+ // Close the current activity after an history action
+ if (result.isSuccess)
+ finish()
+ }
+ }
+ // TODO Visual error for entry history
+ }
}
override fun onResume() {
@@ -117,11 +148,13 @@ class EntryActivity : LockingHideActivity() {
try {
val keyEntry: NodeId = intent.getParcelableExtra(KEY_ENTRY)
mEntry = mDatabase?.getEntryById(keyEntry)
+ mEntryLastVersion = mEntry
} catch (e: ClassCastException) {
Log.e(TAG, "Unable to retrieve the entry key")
}
- val historyPosition = intent.getIntExtra(KEY_ENTRY_HISTORY_POSITION, -1)
+ val historyPosition = intent.getIntExtra(KEY_ENTRY_HISTORY_POSITION, mEntryHistoryPosition)
+ mEntryHistoryPosition = historyPosition
if (historyPosition >= 0) {
mIsHistory = true
mEntry = mEntry?.getHistory()?.get(historyPosition)
@@ -155,9 +188,24 @@ class EntryActivity : LockingHideActivity() {
}
}
+ mAttachmentFileBinderManager?.apply {
+ registerProgressTask()
+ onActionTaskListener = object : AttachmentFileNotificationService.ActionTaskListener {
+ override fun onAttachmentProgress(fileUri: Uri, attachment: EntryAttachment) {
+ entryContentsView?.updateAttachmentDownloadProgress(attachment)
+ }
+ }
+ }
+
firstLaunchOfActivity = false
}
+ override fun onPause() {
+ mAttachmentFileBinderManager?.unregisterProgressTask()
+
+ super.onPause()
+ }
+
private fun fillEntryDataInContentsView(entry: Entry) {
val database = Database.getInstance()
@@ -191,7 +239,7 @@ class EntryActivity : LockingHideActivity() {
"\n\n" +
getString(R.string.clipboard_warning))
.create().apply {
- setButton(AlertDialog.BUTTON_POSITIVE, getText(R.string.enable)) {dialog, _ ->
+ setButton(AlertDialog.BUTTON_POSITIVE, getText(R.string.enable)) { dialog, _ ->
PreferencesUtil.setAllowCopyPasswordAndProtectedFields(this@EntryActivity, true)
dialog.dismiss()
fillEntryDataInContentsView(entry)
@@ -265,6 +313,27 @@ class EntryActivity : LockingHideActivity() {
}
entryContentsView?.setHiddenPasswordStyle(!mShowPassword)
+ // Manage attachments
+ val attachments = entry.getAttachments()
+ val showAttachmentsView = attachments.isNotEmpty()
+ entryContentsView?.showAttachments(showAttachmentsView)
+ if (showAttachmentsView) {
+ entryContentsView?.assignAttachments(attachments)
+ entryContentsView?.onAttachmentClick { attachmentItem, _ ->
+ when (attachmentItem.downloadState) {
+ AttachmentState.NULL, AttachmentState.ERROR, AttachmentState.COMPLETE -> {
+ createDocument(this, attachmentItem.name)?.let { requestCode ->
+ mAttachmentsToDownload[requestCode] = attachmentItem
+ }
+ }
+ else -> {
+ // TODO Stop download
+ }
+ }
+ }
+ }
+ entryContentsView?.refreshAttachments()
+
// Assign dates
entryContentsView?.assignCreationDate(entry.creationTime)
entryContentsView?.assignModificationDate(entry.lastModificationTime)
@@ -276,9 +345,6 @@ class EntryActivity : LockingHideActivity() {
entryContentsView?.assignExpiresDate(getString(R.string.never))
}
- // Assign special data
- entryContentsView?.assignUUID(entry.nodeId.id)
-
// Manage history
historyView?.visibility = if (mIsHistory) View.VISIBLE else View.GONE
if (mIsHistory) {
@@ -287,23 +353,26 @@ class EntryActivity : LockingHideActivity() {
taColorAccent.recycle()
}
val entryHistory = entry.getHistory()
- // isMainEntry = not an history
+ // TODO isMainEntry = not an history
val showHistoryView = entryHistory.isNotEmpty()
entryContentsView?.showHistory(showHistoryView)
if (showHistoryView) {
entryContentsView?.assignHistory(entryHistory)
entryContentsView?.onHistoryClick { historyItem, position ->
- launch(this, historyItem, true, position)
+ launch(this, historyItem, mReadOnly, position)
}
}
+ entryContentsView?.refreshHistory()
+
+ // Assign special data
+ entryContentsView?.assignUUID(entry.nodeId.id)
database.stopManageEntry(entry)
-
- entryContentsView?.refreshHistory()
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
+
when (requestCode) {
EntryEditActivity.ADD_OR_UPDATE_ENTRY_REQUEST_CODE ->
// Not directly get the entry from intent data but from database
@@ -311,6 +380,15 @@ class EntryActivity : LockingHideActivity() {
fillEntryDataInContentsView(it)
}
}
+
+ onCreateDocumentResult(requestCode, resultCode, data) { createdFileUri ->
+ if (createdFileUri != null) {
+ mAttachmentsToDownload[requestCode]?.let { attachmentToDownload ->
+ mAttachmentFileBinderManager
+ ?.startDownloadAttachment(createdFileUri, attachmentToDownload)
+ }
+ }
+ }
}
private fun changeShowPasswordIcon(togglePassword: MenuItem?) {
@@ -330,7 +408,10 @@ class EntryActivity : LockingHideActivity() {
MenuUtil.contributionMenuInflater(inflater, menu)
inflater.inflate(R.menu.entry, menu)
inflater.inflate(R.menu.database, menu)
- if (mReadOnly) {
+ if (mIsHistory && !mReadOnly) {
+ inflater.inflate(R.menu.entry_history, menu)
+ }
+ if (mIsHistory || mReadOnly) {
menu.findItem(R.id.menu_save_database)?.isVisible = false
menu.findItem(R.id.menu_edit)?.isVisible = false
}
@@ -423,6 +504,22 @@ class EntryActivity : LockingHideActivity() {
UriUtil.gotoUrl(this, url)
return true
}
+ R.id.menu_restore_entry_history -> {
+ mEntryLastVersion?.let { mainEntry ->
+ mProgressDialogThread?.startDatabaseRestoreEntryHistory(
+ mainEntry,
+ mEntryHistoryPosition,
+ !mReadOnly && mAutoSaveEnable)
+ }
+ }
+ R.id.menu_delete_entry_history -> {
+ mEntryLastVersion?.let { mainEntry ->
+ mProgressDialogThread?.startDatabaseDeleteEntryHistory(
+ mainEntry,
+ mEntryHistoryPosition,
+ !mReadOnly && mAutoSaveEnable)
+ }
+ }
R.id.menu_lock -> {
lockAndExit()
return true
diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/EntryEditActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/EntryEditActivity.kt
index b6e04520d..8b7f3c5c8 100644
--- a/app/src/main/java/com/kunzisoft/keepass/activities/EntryEditActivity.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/activities/EntryEditActivity.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*/
package com.kunzisoft.keepass.activities
@@ -28,11 +28,13 @@ import android.view.MenuItem
import android.view.View
import android.widget.ScrollView
import androidx.appcompat.widget.Toolbar
+import androidx.coordinatorlayout.widget.CoordinatorLayout
+import com.google.android.material.snackbar.Snackbar
import com.kunzisoft.keepass.R
import com.kunzisoft.keepass.activities.dialogs.SetOTPDialogFragment
import com.kunzisoft.keepass.activities.dialogs.GeneratePasswordDialogFragment
import com.kunzisoft.keepass.activities.dialogs.IconPickerDialogFragment
-import com.kunzisoft.keepass.activities.lock.LockingHideActivity
+import com.kunzisoft.keepass.activities.lock.LockingActivity
import com.kunzisoft.keepass.database.element.*
import com.kunzisoft.keepass.database.element.icon.IconImage
import com.kunzisoft.keepass.database.element.node.NodeId
@@ -47,9 +49,10 @@ import com.kunzisoft.keepass.settings.PreferencesUtil
import com.kunzisoft.keepass.timeout.TimeoutHelper
import com.kunzisoft.keepass.utils.MenuUtil
import com.kunzisoft.keepass.view.EntryEditContentsView
+import com.kunzisoft.keepass.view.asError
import java.util.*
-class EntryEditActivity : LockingHideActivity(),
+class EntryEditActivity : LockingActivity(),
IconPickerDialogFragment.IconPickerListener,
GeneratePasswordDialogFragment.GeneratePasswordListener,
SetOTPDialogFragment.CreateOtpListener {
@@ -64,6 +67,7 @@ class EntryEditActivity : LockingHideActivity(),
private var mIsNew: Boolean = false
// Views
+ private var coordinatorLayout: CoordinatorLayout? = null
private var scrollView: ScrollView? = null
private var entryEditContentsView: EntryEditContentsView? = null
private var saveView: View? = null
@@ -81,6 +85,8 @@ class EntryEditActivity : LockingHideActivity(),
supportActionBar?.setDisplayHomeAsUpEnabled(true)
supportActionBar?.setDisplayShowHomeEnabled(true)
+ coordinatorLayout = findViewById(R.id.entry_edit_coordinator_layout)
+
scrollView = findViewById(R.id.entry_edit_scroll)
scrollView?.scrollBarStyle = View.SCROLLBARS_INSIDE_INSET
@@ -182,6 +188,15 @@ class EntryEditActivity : LockingHideActivity(),
finish()
}
}
+
+ // Show error
+ if (!result.isSuccess) {
+ result.message?.let { resultMessage ->
+ Snackbar.make(coordinatorLayout!!,
+ resultMessage,
+ Snackbar.LENGTH_LONG).asError().show()
+ }
+ }
}
}
diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/FileDatabaseSelectActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/FileDatabaseSelectActivity.kt
index 906825af5..3472f2a70 100644
--- a/app/src/main/java/com/kunzisoft/keepass/activities/FileDatabaseSelectActivity.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/activities/FileDatabaseSelectActivity.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.activities
@@ -42,7 +42,6 @@ import androidx.recyclerview.widget.SimpleItemAnimator
import com.google.android.material.snackbar.Snackbar
import com.kunzisoft.keepass.R
import com.kunzisoft.keepass.activities.dialogs.AssignMasterKeyDialogFragment
-import com.kunzisoft.keepass.activities.dialogs.BrowserDialogFragment
import com.kunzisoft.keepass.activities.helpers.EntrySelectionHelper
import com.kunzisoft.keepass.activities.helpers.OpenFileHelper
import com.kunzisoft.keepass.activities.stylish.StylishActivity
@@ -53,8 +52,7 @@ import com.kunzisoft.keepass.database.action.ProgressDialogThread
import com.kunzisoft.keepass.database.element.Database
import com.kunzisoft.keepass.education.FileDatabaseSelectActivityEducation
import com.kunzisoft.keepass.notifications.DatabaseTaskNotificationService.Companion.ACTION_DATABASE_CREATE_TASK
-import com.kunzisoft.keepass.utils.MenuUtil
-import com.kunzisoft.keepass.utils.UriUtil
+import com.kunzisoft.keepass.utils.*
import com.kunzisoft.keepass.view.asError
import kotlinx.android.synthetic.main.activity_file_selection.*
import java.io.FileNotFoundException
@@ -92,17 +90,14 @@ class FileDatabaseSelectActivity : StylishActivity(),
// Create button
createButtonView = findViewById(R.id.create_database_button)
- if (Intent(Intent.ACTION_CREATE_DOCUMENT).apply {
- addCategory(Intent.CATEGORY_OPENABLE)
- type = "application/x-keepass"
- }.resolveActivity(packageManager) == null) {
- // No Activity found that can handle this intent.
- createButtonView?.visibility = View.GONE
- }
- else{
+ if (allowCreateDocumentByStorageAccessFramework(packageManager)) {
// There is an activity which can handle this intent.
createButtonView?.visibility = View.VISIBLE
}
+ else{
+ // No Activity found that can handle this intent.
+ createButtonView?.visibility = View.GONE
+ }
createButtonView?.setOnClickListener { createNewFile() }
@@ -182,18 +177,8 @@ class FileDatabaseSelectActivity : StylishActivity(),
*/
@SuppressLint("InlinedApi")
private fun createNewFile() {
- try {
- startActivityForResult(Intent(
- Intent.ACTION_CREATE_DOCUMENT).apply {
- addCategory(Intent.CATEGORY_OPENABLE)
- type = "application/x-keepass"
- putExtra(Intent.EXTRA_TITLE, getString(R.string.database_file_name_default) +
- getString(R.string.database_file_extension_default))
- },
- CREATE_FILE_REQUEST_CODE)
- } catch (e: Exception) {
- BrowserDialogFragment().show(supportFragmentManager, "browserDialog")
- }
+ createDocument(this, getString(R.string.database_file_name_default) +
+ getString(R.string.database_file_extension_default), "application/x-keepass")
}
private fun fileNoFoundAction(e: FileNotFoundException) {
@@ -367,14 +352,14 @@ class FileDatabaseSelectActivity : StylishActivity(),
}
// Retrieve the created URI from the file manager
- if (requestCode == CREATE_FILE_REQUEST_CODE && resultCode == Activity.RESULT_OK) {
- mDatabaseFileUri = data?.data
+ onCreateDocumentResult(requestCode, resultCode, data) { databaseFileCreatedUri ->
+ mDatabaseFileUri = databaseFileCreatedUri
if (mDatabaseFileUri != null) {
AssignMasterKeyDialogFragment.getInstance(true)
.show(supportFragmentManager, "passwordDialog")
}
// else {
- // TODO Show error
+ // TODO Show error
// }
}
}
@@ -427,8 +412,6 @@ class FileDatabaseSelectActivity : StylishActivity(),
private const val EXTRA_STAY = "EXTRA_STAY"
private const val EXTRA_DATABASE_URI = "EXTRA_DATABASE_URI"
- private const val CREATE_FILE_REQUEST_CODE = 3853
-
/*
* -------------------------
* No Standard Launch, pass by PasswordActivity
diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt
index c73aaf0a3..c60874e50 100644
--- a/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*/
package com.kunzisoft.keepass.activities
@@ -42,14 +42,19 @@ import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.fragment.app.FragmentManager
import com.google.android.material.snackbar.Snackbar
import com.kunzisoft.keepass.R
-import com.kunzisoft.keepass.activities.dialogs.*
+import com.kunzisoft.keepass.activities.dialogs.DeleteNodesDialogFragment
+import com.kunzisoft.keepass.activities.dialogs.GroupEditDialogFragment
+import com.kunzisoft.keepass.activities.dialogs.IconPickerDialogFragment
+import com.kunzisoft.keepass.activities.dialogs.SortDialogFragment
import com.kunzisoft.keepass.activities.helpers.EntrySelectionHelper
import com.kunzisoft.keepass.activities.helpers.ReadOnlyHelper
import com.kunzisoft.keepass.activities.lock.LockingActivity
import com.kunzisoft.keepass.adapters.SearchEntryCursorAdapter
import com.kunzisoft.keepass.autofill.AutofillHelper
+import com.kunzisoft.keepass.database.element.Database
+import com.kunzisoft.keepass.database.element.Entry
+import com.kunzisoft.keepass.database.element.Group
import com.kunzisoft.keepass.database.element.SortNodeEnum
-import com.kunzisoft.keepass.database.element.*
import com.kunzisoft.keepass.database.element.icon.IconImage
import com.kunzisoft.keepass.database.element.node.Node
import com.kunzisoft.keepass.database.element.node.NodeId
@@ -430,12 +435,8 @@ class GroupActivity : LockingActivity(),
val addGroupEnabled = !mReadOnly && !mCurrentGroupIsASearch
var addEntryEnabled = !mReadOnly && !mCurrentGroupIsASearch
mCurrentGroup?.let {
- val isRoot = it == mRootGroup
if (!it.allowAddEntryIfIsRoot())
- addEntryEnabled = !isRoot && addEntryEnabled
- if (isRoot) {
- showWarnings()
- }
+ addEntryEnabled = it != mRootGroup && addEntryEnabled
}
enableAddGroup(addGroupEnabled)
enableAddEntry(addEntryEnabled)
@@ -448,7 +449,7 @@ class GroupActivity : LockingActivity(),
private fun refreshNumberOfChildren() {
numberChildrenView?.apply {
if (PreferencesUtil.showNumberEntries(context)) {
- text = mCurrentGroup?.getChildEntries(true)?.size?.toString() ?: ""
+ text = mCurrentGroup?.getChildEntries(*Group.ChildFilter.getDefaults(context))?.size?.toString() ?: ""
visibility = View.VISIBLE
} else {
visibility = View.GONE
@@ -658,7 +659,8 @@ class GroupActivity : LockingActivity(),
}
// Menu for recycle bin
- if (mDatabase?.isRecycleBinEnabled == true
+ if (!mReadOnly
+ && mDatabase?.isRecycleBinEnabled == true
&& mDatabase?.recycleBin == mCurrentGroup) {
inflater.inflate(R.menu.recycle_bin, menu)
}
@@ -853,14 +855,6 @@ class GroupActivity : LockingActivity(),
.iconPicked(bundle)
}
- private fun showWarnings() {
- if (Database.getInstance().isReadOnly) {
- if (PreferencesUtil.showReadOnlyWarning(this)) {
- ReadOnlyDialog().show(supportFragmentManager, "readOnlyDialog")
- }
- }
- }
-
override fun onSortSelected(sortNodeEnum: SortNodeEnum, ascending: Boolean, groupsBefore: Boolean, recycleBinBottom: Boolean) {
mListNodesFragment?.onSortSelected(sortNodeEnum, ascending, groupsBefore, recycleBinBottom)
}
diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/ListNodesFragment.kt b/app/src/main/java/com/kunzisoft/keepass/activities/ListNodesFragment.kt
index 600a089a4..bb8ace166 100644
--- a/app/src/main/java/com/kunzisoft/keepass/activities/ListNodesFragment.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/activities/ListNodesFragment.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.activities
import android.content.Context
diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/PasswordActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/PasswordActivity.kt
index 2593baa95..fd1e71f29 100644
--- a/app/src/main/java/com/kunzisoft/keepass/activities/PasswordActivity.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/activities/PasswordActivity.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.activities
@@ -24,6 +24,7 @@ import android.app.assist.AssistStructure
import android.app.backup.BackupManager
import android.content.Intent
import android.content.SharedPreferences
+import android.content.pm.PackageManager
import android.net.Uri
import android.os.Build
import android.os.Bundle
@@ -37,13 +38,11 @@ import android.view.Menu
import android.view.MenuItem
import android.view.View
import android.view.inputmethod.EditorInfo.IME_ACTION_DONE
-import android.widget.Button
-import android.widget.CompoundButton
-import android.widget.EditText
-import android.widget.TextView
+import android.widget.*
import androidx.annotation.RequiresApi
import androidx.appcompat.widget.Toolbar
import androidx.biometric.BiometricManager
+import androidx.core.app.ActivityCompat
import com.google.android.material.snackbar.Snackbar
import com.kunzisoft.keepass.R
import com.kunzisoft.keepass.activities.dialogs.DuplicateUuidDialog
@@ -99,6 +98,7 @@ class PasswordActivity : StylishActivity() {
private var mRememberKeyFile: Boolean = false
private var mOpenFileHelper: OpenFileHelper? = null
+ private var mPermissionAsked = false
private var readOnly: Boolean = false
private var mProgressDialogThread: ProgressDialogThread? = null
@@ -130,6 +130,7 @@ class PasswordActivity : StylishActivity() {
checkboxDefaultDatabaseView = findViewById(R.id.default_database)
advancedUnlockInfoView = findViewById(R.id.biometric_info)
+ mPermissionAsked = savedInstanceState?.getBoolean(KEY_PERMISSION_ASKED) ?: mPermissionAsked
readOnly = ReadOnlyHelper.retrieveReadOnlyFromInstanceStateOrPreference(this, savedInstanceState)
val browseView = findViewById(R.id.open_database_button)
@@ -280,6 +281,7 @@ class PasswordActivity : StylishActivity() {
}
override fun onSaveInstanceState(outState: Bundle) {
+ outState.putBoolean(KEY_PERMISSION_ASKED, mPermissionAsked)
ReadOnlyHelper.onSaveInstanceState(outState, readOnly)
super.onSaveInstanceState(outState)
}
@@ -545,9 +547,6 @@ class PasswordActivity : StylishActivity() {
}.show(supportFragmentManager, "duplicateUUIDDialog")
}
- // To fix multiple view education
- private var performedEductionInProgress = false
-
override fun onCreateOptionsMenu(menu: Menu): Boolean {
val inflater = menuInflater
// Read menu
@@ -563,51 +562,96 @@ class PasswordActivity : StylishActivity() {
super.onCreateOptionsMenu(menu)
- if (!performedEductionInProgress) {
- performedEductionInProgress = true
- // Show education views
- Handler().post { performedNextEducation(PasswordActivityEducation(this), menu) }
+ launchEducation(menu) {
+ launchCheckPermission()
}
return true
}
+ // Check permission
+ private fun launchCheckPermission() {
+ val writePermission = android.Manifest.permission.WRITE_EXTERNAL_STORAGE
+ val permissions = arrayOf(writePermission)
+ if (Build.VERSION.SDK_INT >= 23
+ && !readOnly
+ && !mPermissionAsked) {
+ mPermissionAsked = true
+ // Check self permission to show or not the dialog
+ if (toolbar != null
+ && ActivityCompat.checkSelfPermission(this, writePermission) != PackageManager.PERMISSION_GRANTED) {
+ ActivityCompat.requestPermissions(this, permissions, WRITE_EXTERNAL_STORAGE_REQUEST)
+ }
+ }
+ }
+
+ override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray) {
+ super.onRequestPermissionsResult(requestCode, permissions, grantResults)
+
+ when (requestCode) {
+ WRITE_EXTERNAL_STORAGE_REQUEST -> {
+ if (grantResults.isEmpty() || grantResults[0] != PackageManager.PERMISSION_GRANTED) {
+ if (ActivityCompat.shouldShowRequestPermissionRationale(this, android.Manifest.permission.WRITE_EXTERNAL_STORAGE))
+ Toast.makeText(this, R.string.read_only_warning, Toast.LENGTH_LONG).show()
+ }
+ }
+ }
+ }
+
+ // To fix multiple view education
+ private var performedEductionInProgress = false
+ private fun launchEducation(menu: Menu, onEducationFinished: ()-> Unit) {
+ if (!performedEductionInProgress) {
+ performedEductionInProgress = true
+ // Show education views
+ Handler().post { performedNextEducation(PasswordActivityEducation(this), menu, onEducationFinished) }
+ }
+ }
+
private fun performedNextEducation(passwordActivityEducation: PasswordActivityEducation,
- menu: Menu) {
- val educationContainerView = containerView
- val unlockEducationPerformed = educationContainerView != null
+ menu: Menu,
+ onEducationFinished: ()-> Unit) {
+ val educationToolbar = toolbar
+ val unlockEducationPerformed = educationToolbar != null
&& passwordActivityEducation.checkAndPerformedUnlockEducation(
- educationContainerView,
+ educationToolbar,
{
- performedNextEducation(passwordActivityEducation, menu)
+ performedNextEducation(passwordActivityEducation, menu, onEducationFinished)
},
{
- performedNextEducation(passwordActivityEducation, menu)
+ performedNextEducation(passwordActivityEducation, menu, onEducationFinished)
})
if (!unlockEducationPerformed) {
- val educationToolbar = toolbar
val readOnlyEducationPerformed =
educationToolbar?.findViewById(R.id.menu_open_file_read_mode_key) != null
&& passwordActivityEducation.checkAndPerformedReadOnlyEducation(
educationToolbar.findViewById(R.id.menu_open_file_read_mode_key),
{
onOptionsItemSelected(menu.findItem(R.id.menu_open_file_read_mode_key))
- performedNextEducation(passwordActivityEducation, menu)
+ performedNextEducation(passwordActivityEducation, menu, onEducationFinished)
},
{
- performedNextEducation(passwordActivityEducation, menu)
+ performedNextEducation(passwordActivityEducation, menu, onEducationFinished)
})
if (!readOnlyEducationPerformed) {
-
val biometricCanAuthenticate = BiometricManager.from(this).canAuthenticate()
- // EducationPerformed
+ val biometricEducationPerformed =
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
&& PreferencesUtil.isBiometricUnlockEnable(applicationContext)
&& (biometricCanAuthenticate == BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED || biometricCanAuthenticate == BiometricManager.BIOMETRIC_SUCCESS)
&& advancedUnlockInfoView != null && advancedUnlockInfoView?.unlockIconImageView != null
- && passwordActivityEducation.checkAndPerformedBiometricEducation(advancedUnlockInfoView?.unlockIconImageView!!)
+ && passwordActivityEducation.checkAndPerformedBiometricEducation(advancedUnlockInfoView?.unlockIconImageView!!,
+ {
+ performedNextEducation(passwordActivityEducation, menu, onEducationFinished)
+ },
+ {
+ performedNextEducation(passwordActivityEducation, menu, onEducationFinished)
+ })
+ if (!biometricEducationPerformed) {
+ onEducationFinished.invoke()
+ }
}
}
}
@@ -683,6 +727,10 @@ class PasswordActivity : StylishActivity() {
private const val KEY_PASSWORD = "password"
private const val KEY_LAUNCH_IMMEDIATELY = "launchImmediately"
+ private const val KEY_PERMISSION_ASKED = "KEY_PERMISSION_ASKED"
+
+ private const val WRITE_EXTERNAL_STORAGE_REQUEST = 647
+
private fun buildAndLaunchIntent(activity: Activity, databaseFile: Uri, keyFile: Uri?,
intentBuildLauncher: (Intent) -> Unit) {
val intent = Intent(activity, PasswordActivity::class.java)
diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/AssignMasterKeyDialogFragment.kt b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/AssignMasterKeyDialogFragment.kt
index f78a239ea..1d2eb020d 100644
--- a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/AssignMasterKeyDialogFragment.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/AssignMasterKeyDialogFragment.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.activities.dialogs
diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/BrowserDialogFragment.kt b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/BrowserDialogFragment.kt
index 3dd5514ac..8c53e5eb5 100644
--- a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/BrowserDialogFragment.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/BrowserDialogFragment.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.activities.dialogs
diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/DeleteNodesDialogFragment.kt b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/DeleteNodesDialogFragment.kt
index 9ff06d9f2..db7241742 100644
--- a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/DeleteNodesDialogFragment.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/DeleteNodesDialogFragment.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.activities.dialogs
diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/DuplicateUuidDialog.kt b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/DuplicateUuidDialog.kt
index 219dd9c01..ebd3cc22e 100644
--- a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/DuplicateUuidDialog.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/DuplicateUuidDialog.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.activities.dialogs
diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/GeneratePasswordDialogFragment.kt b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/GeneratePasswordDialogFragment.kt
index 156a0be88..7e685d2ff 100644
--- a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/GeneratePasswordDialogFragment.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/GeneratePasswordDialogFragment.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.activities.dialogs
diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/GroupEditDialogFragment.kt b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/GroupEditDialogFragment.kt
index 1036d2733..d60294c64 100644
--- a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/GroupEditDialogFragment.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/GroupEditDialogFragment.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.activities.dialogs
diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/IconPickerDialogFragment.kt b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/IconPickerDialogFragment.kt
index 5bd71068e..516c18d33 100644
--- a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/IconPickerDialogFragment.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/IconPickerDialogFragment.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.activities.dialogs
diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/PasswordEncodingDialogFragment.kt b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/PasswordEncodingDialogFragment.kt
index 4cb8f1234..034ff1aa0 100644
--- a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/PasswordEncodingDialogFragment.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/PasswordEncodingDialogFragment.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.activities.dialogs
diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/ProFeatureDialogFragment.kt b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/ProFeatureDialogFragment.kt
index aacfed651..6e43a3fcd 100644
--- a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/ProFeatureDialogFragment.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/ProFeatureDialogFragment.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.activities.dialogs
diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/ReadOnlyDialog.kt b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/ReadOnlyDialog.kt
deleted file mode 100644
index 53396dce5..000000000
--- a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/ReadOnlyDialog.kt
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2019 Jeremy Jamet / Kunzisoft.
- *
- * This file is part of KeePass DX.
- *
- * KeePass DX is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * KeePass DX is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
- *
- */
-package com.kunzisoft.keepass.activities.dialogs
-
-import android.app.Dialog
-import android.os.Build
-import android.os.Bundle
-import android.preference.PreferenceManager
-import androidx.fragment.app.DialogFragment
-import com.kunzisoft.keepass.R
-
-class ReadOnlyDialog : DialogFragment() {
-
- override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
- activity?.let { activity ->
- // Use the Builder class for convenient dialog construction
- val builder = androidx.appcompat.app.AlertDialog.Builder(activity)
-
- var warning = getString(R.string.read_only_warning)
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
- warning = warning + "\n\n" + getString(R.string.read_only_kitkat_warning)
- }
- builder.setMessage(warning)
-
- builder.setPositiveButton(getString(android.R.string.ok)) { _, _ -> dismiss() }
- builder.setNegativeButton(getString(R.string.beta_dontask)) { _, _ ->
- val prefs = PreferenceManager.getDefaultSharedPreferences(context)
- val edit = prefs.edit()
- edit.putBoolean(getString(R.string.show_read_only_warning), false)
- edit.apply()
- dismiss()
- }
-
- // Create the AlertDialog object and return it
- return builder.create()
- }
- return super.onCreateDialog(savedInstanceState)
- }
-}
diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/SetOTPDialogFragment.kt b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/SetOTPDialogFragment.kt
index 79f762075..19b75ac98 100644
--- a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/SetOTPDialogFragment.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/SetOTPDialogFragment.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.activities.dialogs
import android.annotation.SuppressLint
diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/SortDialogFragment.kt b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/SortDialogFragment.kt
index 4b16bd891..07fdc36c1 100644
--- a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/SortDialogFragment.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/SortDialogFragment.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.activities.dialogs
diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/UnavailableFeatureDialogFragment.kt b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/UnavailableFeatureDialogFragment.kt
index 04c5ddaa1..750e7abb7 100644
--- a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/UnavailableFeatureDialogFragment.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/UnavailableFeatureDialogFragment.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.activities.dialogs
diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/UnderDevelopmentFeatureDialogFragment.kt b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/UnderDevelopmentFeatureDialogFragment.kt
index c1c69e114..8b73339b3 100644
--- a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/UnderDevelopmentFeatureDialogFragment.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/UnderDevelopmentFeatureDialogFragment.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.activities.dialogs
diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/helpers/EntrySelectionHelper.kt b/app/src/main/java/com/kunzisoft/keepass/activities/helpers/EntrySelectionHelper.kt
index dc04e3291..281c428af 100644
--- a/app/src/main/java/com/kunzisoft/keepass/activities/helpers/EntrySelectionHelper.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/activities/helpers/EntrySelectionHelper.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.activities.helpers
import android.app.assist.AssistStructure
diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/helpers/OpenFileHelper.kt b/app/src/main/java/com/kunzisoft/keepass/activities/helpers/OpenFileHelper.kt
index c9f09f0a4..32bfa7ee6 100644
--- a/app/src/main/java/com/kunzisoft/keepass/activities/helpers/OpenFileHelper.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/activities/helpers/OpenFileHelper.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.activities.helpers
diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/helpers/ReadOnlyHelper.kt b/app/src/main/java/com/kunzisoft/keepass/activities/helpers/ReadOnlyHelper.kt
index 05016bad1..5203b987e 100644
--- a/app/src/main/java/com/kunzisoft/keepass/activities/helpers/ReadOnlyHelper.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/activities/helpers/ReadOnlyHelper.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.activities.helpers
import android.content.Context
diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/lock/LockingActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/lock/LockingActivity.kt
index 94b6a6edc..9fa070262 100644
--- a/app/src/main/java/com/kunzisoft/keepass/activities/lock/LockingActivity.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/activities/lock/LockingActivity.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.activities.lock
diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/lock/LockingHideActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/lock/LockingHideActivity.kt
deleted file mode 100644
index f7da90250..000000000
--- a/app/src/main/java/com/kunzisoft/keepass/activities/lock/LockingHideActivity.kt
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
- *
- * This file is part of KeePass DX.
- *
- * KeePass DX is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * KeePass DX is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
- *
- */
-package com.kunzisoft.keepass.activities.lock
-
-import android.content.ActivityNotFoundException
-import android.content.Intent
-import android.os.Bundle
-import android.view.WindowManager
-
-/**
- * Locking Hide Activity that sets FLAG_SECURE to prevent screenshots, and from
- * appearing in the recent app preview
- */
-abstract class LockingHideActivity : LockingActivity() {
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
-
- // Several gingerbread devices have problems with FLAG_SECURE
- window.setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE)
- }
-
- /* (non-Javadoc) Workaround for HTC Linkify issues
- * @see android.app.Activity#startActivity(android.content.Intent)
- */
- override fun startActivity(intent: Intent) {
- try {
- if (intent.component != null && intent.component!!.shortClassName == ".HtcLinkifyDispatcherActivity") {
- intent.component = null
- }
- super.startActivity(intent)
- } catch (e: ActivityNotFoundException) {
- /* Catch the bad HTC implementation case */
- super.startActivity(Intent.createChooser(intent, null))
- }
-
- }
-}
diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/stylish/Stylish.kt b/app/src/main/java/com/kunzisoft/keepass/activities/stylish/Stylish.kt
index 2ec7797eb..2315f9dbd 100644
--- a/app/src/main/java/com/kunzisoft/keepass/activities/stylish/Stylish.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/activities/stylish/Stylish.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.activities.stylish
@@ -61,6 +61,7 @@ object Stylish {
return when (themeString) {
context.getString(R.string.list_style_name_night) -> R.style.KeepassDXStyle_Night
+ context.getString(R.string.list_style_name_black) -> R.style.KeepassDXStyle_Black
context.getString(R.string.list_style_name_dark) -> R.style.KeepassDXStyle_Dark
context.getString(R.string.list_style_name_blue) -> R.style.KeepassDXStyle_Blue
context.getString(R.string.list_style_name_red) -> R.style.KeepassDXStyle_Red
diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/stylish/StylishActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/stylish/StylishActivity.kt
index 7a4180522..3aca51b92 100644
--- a/app/src/main/java/com/kunzisoft/keepass/activities/stylish/StylishActivity.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/activities/stylish/StylishActivity.kt
@@ -1,38 +1,63 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.activities.stylish
+import android.content.ActivityNotFoundException
+import android.content.Intent
import android.os.Bundle
import androidx.annotation.StyleRes
import androidx.appcompat.app.AppCompatActivity
import android.util.Log
+import android.view.WindowManager
+/**
+ * Stylish Hide Activity that apply a dynamic style and sets FLAG_SECURE to prevent screenshots / from
+ * appearing in the recent app preview
+ */
abstract class StylishActivity : AppCompatActivity() {
@StyleRes
private var themeId: Int = 0
+ /* (non-Javadoc) Workaround for HTC Linkify issues
+ * @see android.app.Activity#startActivity(android.content.Intent)
+ */
+ override fun startActivity(intent: Intent) {
+ try {
+ if (intent.component != null && intent.component!!.shortClassName == ".HtcLinkifyDispatcherActivity") {
+ intent.component = null
+ }
+ super.startActivity(intent)
+ } catch (e: ActivityNotFoundException) {
+ /* Catch the bad HTC implementation case */
+ super.startActivity(Intent.createChooser(intent, null))
+ }
+ }
+
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
this.themeId = Stylish.getThemeId(this)
setTheme(themeId)
+
+ // Several gingerbread devices have problems with FLAG_SECURE
+ window.setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE)
}
override fun onResume() {
diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/stylish/StylishFragment.kt b/app/src/main/java/com/kunzisoft/keepass/activities/stylish/StylishFragment.kt
index 33682dec4..baf011c81 100644
--- a/app/src/main/java/com/kunzisoft/keepass/activities/stylish/StylishFragment.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/activities/stylish/StylishFragment.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.activities.stylish
diff --git a/app/src/main/java/com/kunzisoft/keepass/adapters/EntryAttachmentsAdapter.kt b/app/src/main/java/com/kunzisoft/keepass/adapters/EntryAttachmentsAdapter.kt
new file mode 100644
index 000000000..257ca9d43
--- /dev/null
+++ b/app/src/main/java/com/kunzisoft/keepass/adapters/EntryAttachmentsAdapter.kt
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
+package com.kunzisoft.keepass.adapters
+
+import android.content.Context
+import android.text.format.Formatter
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.ProgressBar
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.kunzisoft.keepass.R
+import com.kunzisoft.keepass.database.element.database.CompressionAlgorithm
+import com.kunzisoft.keepass.model.AttachmentState
+import com.kunzisoft.keepass.model.EntryAttachment
+
+class EntryAttachmentsAdapter(val context: Context) : RecyclerView.Adapter() {
+
+ private val inflater: LayoutInflater = LayoutInflater.from(context)
+ var entryAttachmentsList: MutableList = ArrayList()
+ var onItemClickListener: ((item: EntryAttachment, position: Int)->Unit)? = null
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): EntryBinariesViewHolder {
+ return EntryBinariesViewHolder(inflater.inflate(R.layout.item_attachment, parent, false))
+ }
+
+ override fun onBindViewHolder(holder: EntryBinariesViewHolder, position: Int) {
+ val entryAttachment = entryAttachmentsList[position]
+
+ holder.binaryFileTitle.text = entryAttachment.name
+ holder.binaryFileSize.text = Formatter.formatFileSize(context,
+ entryAttachment.binaryAttachment.length())
+ holder.binaryFileCompression.apply {
+ if (entryAttachment.binaryAttachment.isCompressed == true) {
+ text = CompressionAlgorithm.GZip.getName(context.resources)
+ visibility = View.VISIBLE
+ } else {
+ text = ""
+ visibility = View.GONE
+ }
+ }
+ holder.binaryFileProgress.apply {
+ visibility = when (entryAttachment.downloadState) {
+ AttachmentState.NULL, AttachmentState.COMPLETE, AttachmentState.ERROR -> View.GONE
+ AttachmentState.START, AttachmentState.IN_PROGRESS -> View.VISIBLE
+ }
+ progress = entryAttachment.downloadProgression
+ }
+
+ holder.itemView.setOnClickListener {
+ onItemClickListener?.invoke(entryAttachment, position)
+ }
+ }
+
+ override fun getItemCount(): Int {
+ return entryAttachmentsList.size
+ }
+
+ fun updateProgress(entryAttachment: EntryAttachment) {
+ val indexEntryAttachment = entryAttachmentsList.indexOfLast { current -> current.name == entryAttachment.name }
+ if (indexEntryAttachment != -1) {
+ entryAttachmentsList[indexEntryAttachment] = entryAttachment
+ notifyItemChanged(indexEntryAttachment)
+ }
+ }
+
+ fun clear() {
+ entryAttachmentsList.clear()
+ }
+
+ inner class EntryBinariesViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
+
+ var binaryFileTitle: TextView = itemView.findViewById(R.id.item_attachment_title)
+ var binaryFileSize: TextView = itemView.findViewById(R.id.item_attachment_size)
+ var binaryFileCompression: TextView = itemView.findViewById(R.id.item_attachment_compression)
+ var binaryFileProgress: ProgressBar = itemView.findViewById(R.id.item_attachment_progress)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/kunzisoft/keepass/adapters/EntryHistoryAdapter.kt b/app/src/main/java/com/kunzisoft/keepass/adapters/EntryHistoryAdapter.kt
index 035f07577..42e216fc8 100644
--- a/app/src/main/java/com/kunzisoft/keepass/adapters/EntryHistoryAdapter.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/adapters/EntryHistoryAdapter.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.adapters
import android.content.Context
diff --git a/app/src/main/java/com/kunzisoft/keepass/adapters/FieldsAdapter.kt b/app/src/main/java/com/kunzisoft/keepass/adapters/FieldsAdapter.kt
index bdd16ae11..8b2cd9025 100644
--- a/app/src/main/java/com/kunzisoft/keepass/adapters/FieldsAdapter.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/adapters/FieldsAdapter.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.adapters
import android.content.Context
@@ -15,7 +34,7 @@ import java.util.ArrayList
class FieldsAdapter(context: Context) : RecyclerView.Adapter() {
private val inflater: LayoutInflater = LayoutInflater.from(context)
- var fields: MutableList = ArrayList()
+ private var fields: MutableList = ArrayList()
var onItemClickListener: OnItemClickListener? = null
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): FieldViewHolder {
@@ -33,6 +52,11 @@ class FieldsAdapter(context: Context) : RecyclerView.Adapter) {
+ fields.clear()
+ fields.addAll(fieldsToAdd)
+ }
+
fun clear() {
fields.clear()
}
diff --git a/app/src/main/java/com/kunzisoft/keepass/adapters/FileDatabaseHistoryAdapter.kt b/app/src/main/java/com/kunzisoft/keepass/adapters/FileDatabaseHistoryAdapter.kt
index 3e2805914..5907a6b15 100644
--- a/app/src/main/java/com/kunzisoft/keepass/adapters/FileDatabaseHistoryAdapter.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/adapters/FileDatabaseHistoryAdapter.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.adapters
diff --git a/app/src/main/java/com/kunzisoft/keepass/adapters/NodeAdapter.kt b/app/src/main/java/com/kunzisoft/keepass/adapters/NodeAdapter.kt
index 8af26d21e..96a6e6959 100644
--- a/app/src/main/java/com/kunzisoft/keepass/adapters/NodeAdapter.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/adapters/NodeAdapter.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.adapters
@@ -34,12 +34,15 @@ import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.SortedList
import androidx.recyclerview.widget.SortedListAdapterCallback
import com.kunzisoft.keepass.R
+import com.kunzisoft.keepass.database.element.Database
+import com.kunzisoft.keepass.database.element.Entry
+import com.kunzisoft.keepass.database.element.Group
import com.kunzisoft.keepass.database.element.SortNodeEnum
-import com.kunzisoft.keepass.database.element.*
import com.kunzisoft.keepass.database.element.node.Node
import com.kunzisoft.keepass.database.element.node.Type
import com.kunzisoft.keepass.icons.assignDatabaseIcon
import com.kunzisoft.keepass.settings.PreferencesUtil
+import com.kunzisoft.keepass.view.strikeOut
import java.util.*
class NodeAdapter
@@ -66,6 +69,7 @@ class NodeAdapter
private var recycleBinBottomSort: Boolean = true
private var showUserNames: Boolean = true
private var showNumberEntries: Boolean = true
+ private var entryFilters = arrayOf()
private var actionNodesList = LinkedList()
private var nodeClickCallback: NodeClickCallback? = null
@@ -128,6 +132,8 @@ class NodeAdapter
this.showUserNames = PreferencesUtil.showUsernamesListEntries(context)
this.showNumberEntries = PreferencesUtil.showNumberEntries(context)
+ this.entryFilters = Group.ChildFilter.getDefaults(context)
+
// Reinit textSize for all view type
calculateViewTypeTextSize.forEachIndexed { index, _ -> calculateViewTypeTextSize[index] = true }
}
@@ -139,7 +145,7 @@ class NodeAdapter
this.nodeSortedList.clear()
assignPreferences()
try {
- this.nodeSortedList.addAll(group.getChildren())
+ this.nodeSortedList.addAll(group.getChildren(*entryFilters))
} catch (e: Exception) {
Log.e(TAG, "Can't add node elements to the list", e)
Toast.makeText(context, "Can't add node elements to the list : " + e.message, Toast.LENGTH_LONG).show()
@@ -289,15 +295,53 @@ class NodeAdapter
width = iconSize.toInt()
}
}
+
// Assign text
holder.text.apply {
text = subNode.title
setTextSize(textSizeUnit, infoTextSize)
- paintFlags = if (subNode.isCurrentlyExpires)
- paintFlags or Paint.STRIKE_THRU_TEXT_FLAG
- else
- paintFlags and Paint.STRIKE_THRU_TEXT_FLAG
+ strikeOut(subNode.isCurrentlyExpires)
}
+ // Add subText with username
+ holder.subText.apply {
+ text = ""
+ strikeOut(subNode.isCurrentlyExpires)
+ visibility = View.GONE
+ }
+
+ // Specific elements for entry
+ if (subNode.type == Type.ENTRY) {
+ val entry = subNode as Entry
+ mDatabase.startManageEntry(entry)
+
+ holder.text.text = entry.getVisualTitle()
+ holder.subText.apply {
+ val username = entry.username
+ if (showUserNames && username.isNotEmpty()) {
+ visibility = View.VISIBLE
+ text = username
+ setTextSize(textSizeUnit, subtextSize)
+ }
+ }
+
+ mDatabase.stopManageEntry(entry)
+ }
+
+ // Add number of entries in groups
+ if (subNode.type == Type.GROUP) {
+ if (showNumberEntries) {
+ holder.numberChildren?.apply {
+ text = (subNode as Group)
+ .getChildEntries(*entryFilters)
+ .size.toString()
+ setTextSize(textSizeUnit, numberChildrenTextSize)
+ visibility = View.VISIBLE
+ }
+ } else {
+ holder.numberChildren?.visibility = View.GONE
+ }
+ }
+
// Assign click
holder.container.setOnClickListener {
nodeClickCallback?.onNodeClick(subNode)
@@ -307,47 +351,9 @@ class NodeAdapter
}
holder.container.isSelected = actionNodesList.contains(subNode)
-
- // Add subText with username
- holder.subText.apply {
- text = ""
- paintFlags = if (subNode.isCurrentlyExpires)
- paintFlags or Paint.STRIKE_THRU_TEXT_FLAG
- else
- paintFlags and Paint.STRIKE_THRU_TEXT_FLAG
- visibility = View.GONE
- if (subNode.type == Type.ENTRY) {
- val entry = subNode as Entry
-
- mDatabase.startManageEntry(entry)
-
- holder.text.text = entry.getVisualTitle()
-
- val username = entry.username
- if (showUserNames && username.isNotEmpty()) {
- visibility = View.VISIBLE
- text = username
- setTextSize(textSizeUnit, subtextSize)
- }
-
- mDatabase.stopManageEntry(entry)
- }
- }
-
- // Add number of entries in groups
- if (subNode.type == Type.GROUP) {
- if (showNumberEntries) {
- holder.numberChildren?.apply {
- text = (subNode as Group).getChildEntries(true).size.toString()
- setTextSize(textSizeUnit, numberChildrenTextSize)
- visibility = View.VISIBLE
- }
- } else {
- holder.numberChildren?.visibility = View.GONE
- }
- }
}
+
override fun getItemCount(): Int {
return nodeSortedList.size()
}
diff --git a/app/src/main/java/com/kunzisoft/keepass/adapters/SearchEntryCursorAdapter.kt b/app/src/main/java/com/kunzisoft/keepass/adapters/SearchEntryCursorAdapter.kt
index 14a574643..b92da1f9d 100644
--- a/app/src/main/java/com/kunzisoft/keepass/adapters/SearchEntryCursorAdapter.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/adapters/SearchEntryCursorAdapter.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.adapters
@@ -28,15 +28,14 @@ import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import com.kunzisoft.keepass.R
-import com.kunzisoft.keepass.database.cursor.EntryCursor
import com.kunzisoft.keepass.database.element.Database
import com.kunzisoft.keepass.database.element.Entry
-import com.kunzisoft.keepass.database.element.icon.IconImage
import com.kunzisoft.keepass.icons.assignDatabaseIcon
import com.kunzisoft.keepass.settings.PreferencesUtil
-import java.util.*
+import com.kunzisoft.keepass.view.strikeOut
-class SearchEntryCursorAdapter(context: Context, private val database: Database)
+class SearchEntryCursorAdapter(private val context: Context,
+ private val database: Database)
: androidx.cursoradapter.widget.CursorAdapter(context, null, FLAG_REGISTER_CONTENT_OBSERVER) {
private val cursorInflater: LayoutInflater = context.getSystemService(
@@ -71,34 +70,31 @@ class SearchEntryCursorAdapter(context: Context, private val database: Database)
override fun bindView(view: View, context: Context, cursor: Cursor) {
- // Retrieve elements from cursor
- val uuid = UUID(cursor.getLong(cursor.getColumnIndex(EntryCursor.COLUMN_INDEX_UUID_MOST_SIGNIFICANT_BITS)),
- cursor.getLong(cursor.getColumnIndex(EntryCursor.COLUMN_INDEX_UUID_LEAST_SIGNIFICANT_BITS)))
- val iconFactory = database.iconFactory
- var icon: IconImage = iconFactory.getIcon(
- UUID(cursor.getLong(cursor.getColumnIndex(EntryCursor.COLUMN_INDEX_ICON_CUSTOM_UUID_MOST_SIGNIFICANT_BITS)),
- cursor.getLong(cursor.getColumnIndex(EntryCursor.COLUMN_INDEX_ICON_CUSTOM_UUID_LEAST_SIGNIFICANT_BITS))))
- if (icon.isUnknown) {
- icon = iconFactory.getIcon(cursor.getInt(cursor.getColumnIndex(EntryCursor.COLUMN_INDEX_ICON_STANDARD)))
- if (icon.isUnknown)
- icon = iconFactory.keyIcon
- }
- val title = cursor.getString(cursor.getColumnIndex(EntryCursor.COLUMN_INDEX_TITLE))
- val username = cursor.getString(cursor.getColumnIndex(EntryCursor.COLUMN_INDEX_USERNAME))
- val url = cursor.getString(cursor.getColumnIndex(EntryCursor.COLUMN_INDEX_URL))
+ database.getEntryFrom(cursor)?.let { currentEntry ->
+ val viewHolder = view.tag as ViewHolder
- val viewHolder = view.tag as ViewHolder
+ // Assign image
+ viewHolder.imageViewIcon?.assignDatabaseIcon(
+ database.drawFactory,
+ currentEntry.icon,
+ iconColor)
- // Assign image
- viewHolder.imageViewIcon?.assignDatabaseIcon(database.drawFactory, icon, iconColor)
+ // Assign title
+ viewHolder.textViewTitle?.apply {
+ text = currentEntry.getVisualTitle()
+ strikeOut(currentEntry.isCurrentlyExpires)
+ }
- // Assign title
- val showTitle = Entry.getVisualTitle(false, title, username, url, uuid.toString())
- viewHolder.textViewTitle?.text = showTitle
- if (displayUsername && username.isNotEmpty()) {
- viewHolder.textViewSubTitle?.text = String.format("(%s)", username)
- } else {
- viewHolder.textViewSubTitle?.text = ""
+ // Assign subtitle
+ viewHolder.textViewSubTitle?.apply {
+ val entryUsername = currentEntry.username
+ text = if (displayUsername && entryUsername.isNotEmpty()) {
+ String.format("(%s)", entryUsername)
+ } else {
+ ""
+ }
+ strikeOut(currentEntry.isCurrentlyExpires)
+ }
}
}
@@ -109,7 +105,7 @@ class SearchEntryCursorAdapter(context: Context, private val database: Database)
}
override fun runQueryOnBackgroundThread(constraint: CharSequence): Cursor? {
- return database.searchEntries(constraint.toString())
+ return database.searchEntries(context, constraint.toString())
}
fun getEntryFromPosition(position: Int): Entry? {
diff --git a/app/src/main/java/com/kunzisoft/keepass/app/App.kt b/app/src/main/java/com/kunzisoft/keepass/app/App.kt
index 6d375cd7b..48ad694d6 100644
--- a/app/src/main/java/com/kunzisoft/keepass/app/App.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/app/App.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.app
diff --git a/app/src/main/java/com/kunzisoft/keepass/app/database/ActionDatabaseAsyncTask.kt b/app/src/main/java/com/kunzisoft/keepass/app/database/ActionDatabaseAsyncTask.kt
index fde90ab21..470838cc8 100644
--- a/app/src/main/java/com/kunzisoft/keepass/app/database/ActionDatabaseAsyncTask.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/app/database/ActionDatabaseAsyncTask.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.app.database
import android.os.AsyncTask
diff --git a/app/src/main/java/com/kunzisoft/keepass/app/database/AppDatabase.kt b/app/src/main/java/com/kunzisoft/keepass/app/database/AppDatabase.kt
index 8a41cf981..3597ceea4 100644
--- a/app/src/main/java/com/kunzisoft/keepass/app/database/AppDatabase.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/app/database/AppDatabase.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.app.database
import androidx.room.Database
diff --git a/app/src/main/java/com/kunzisoft/keepass/app/database/CipherDatabaseAction.kt b/app/src/main/java/com/kunzisoft/keepass/app/database/CipherDatabaseAction.kt
index 18f20cdec..a55765102 100644
--- a/app/src/main/java/com/kunzisoft/keepass/app/database/CipherDatabaseAction.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/app/database/CipherDatabaseAction.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.app.database
import android.content.Context
diff --git a/app/src/main/java/com/kunzisoft/keepass/app/database/CipherDatabaseDao.kt b/app/src/main/java/com/kunzisoft/keepass/app/database/CipherDatabaseDao.kt
index 9431b7861..c67078da0 100644
--- a/app/src/main/java/com/kunzisoft/keepass/app/database/CipherDatabaseDao.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/app/database/CipherDatabaseDao.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.app.database
import androidx.room.*
diff --git a/app/src/main/java/com/kunzisoft/keepass/app/database/CipherDatabaseEntity.kt b/app/src/main/java/com/kunzisoft/keepass/app/database/CipherDatabaseEntity.kt
index 304517552..4222ff5d3 100644
--- a/app/src/main/java/com/kunzisoft/keepass/app/database/CipherDatabaseEntity.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/app/database/CipherDatabaseEntity.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.app.database
import android.os.Parcel
diff --git a/app/src/main/java/com/kunzisoft/keepass/app/database/FileDatabaseHistoryAction.kt b/app/src/main/java/com/kunzisoft/keepass/app/database/FileDatabaseHistoryAction.kt
index 6638830d6..61cf5e882 100644
--- a/app/src/main/java/com/kunzisoft/keepass/app/database/FileDatabaseHistoryAction.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/app/database/FileDatabaseHistoryAction.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.app.database
diff --git a/app/src/main/java/com/kunzisoft/keepass/app/database/FileDatabaseHistoryDao.kt b/app/src/main/java/com/kunzisoft/keepass/app/database/FileDatabaseHistoryDao.kt
index 1268238da..2ca9bcfb1 100644
--- a/app/src/main/java/com/kunzisoft/keepass/app/database/FileDatabaseHistoryDao.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/app/database/FileDatabaseHistoryDao.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.app.database
import androidx.room.*
diff --git a/app/src/main/java/com/kunzisoft/keepass/app/database/FileDatabaseHistoryEntity.kt b/app/src/main/java/com/kunzisoft/keepass/app/database/FileDatabaseHistoryEntity.kt
index 14b340fd1..470bec74c 100644
--- a/app/src/main/java/com/kunzisoft/keepass/app/database/FileDatabaseHistoryEntity.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/app/database/FileDatabaseHistoryEntity.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.app.database
import androidx.room.ColumnInfo
diff --git a/app/src/main/java/com/kunzisoft/keepass/autofill/AutofillHelper.kt b/app/src/main/java/com/kunzisoft/keepass/autofill/AutofillHelper.kt
index b9afb9d9b..57b431296 100644
--- a/app/src/main/java/com/kunzisoft/keepass/autofill/AutofillHelper.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/autofill/AutofillHelper.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.autofill
diff --git a/app/src/main/java/com/kunzisoft/keepass/autofill/AutofillLauncherActivity.kt b/app/src/main/java/com/kunzisoft/keepass/autofill/AutofillLauncherActivity.kt
index 036c8c565..7e9251050 100644
--- a/app/src/main/java/com/kunzisoft/keepass/autofill/AutofillLauncherActivity.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/autofill/AutofillLauncherActivity.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.autofill
diff --git a/app/src/main/java/com/kunzisoft/keepass/autofill/KeeAutofillService.kt b/app/src/main/java/com/kunzisoft/keepass/autofill/KeeAutofillService.kt
index dcdf98be7..305bc239e 100644
--- a/app/src/main/java/com/kunzisoft/keepass/autofill/KeeAutofillService.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/autofill/KeeAutofillService.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.autofill
diff --git a/app/src/main/java/com/kunzisoft/keepass/autofill/StructureParser.kt b/app/src/main/java/com/kunzisoft/keepass/autofill/StructureParser.kt
index 8a91a2fde..89474dbee 100644
--- a/app/src/main/java/com/kunzisoft/keepass/autofill/StructureParser.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/autofill/StructureParser.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*/
package com.kunzisoft.keepass.autofill
diff --git a/app/src/main/java/com/kunzisoft/keepass/backup/SettingsBackupAgent.kt b/app/src/main/java/com/kunzisoft/keepass/backup/SettingsBackupAgent.kt
index bbe19fdb0..0c315f2ae 100644
--- a/app/src/main/java/com/kunzisoft/keepass/backup/SettingsBackupAgent.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/backup/SettingsBackupAgent.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.backup
diff --git a/app/src/main/java/com/kunzisoft/keepass/biometric/AdvancedUnlockedManager.kt b/app/src/main/java/com/kunzisoft/keepass/biometric/AdvancedUnlockedManager.kt
index 5530da408..8662ea2da 100644
--- a/app/src/main/java/com/kunzisoft/keepass/biometric/AdvancedUnlockedManager.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/biometric/AdvancedUnlockedManager.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.biometric
import android.content.Intent
diff --git a/app/src/main/java/com/kunzisoft/keepass/biometric/BiometricUnlockDatabaseHelper.kt b/app/src/main/java/com/kunzisoft/keepass/biometric/BiometricUnlockDatabaseHelper.kt
index b31890a19..7a001a3bf 100644
--- a/app/src/main/java/com/kunzisoft/keepass/biometric/BiometricUnlockDatabaseHelper.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/biometric/BiometricUnlockDatabaseHelper.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.biometric
diff --git a/app/src/main/java/com/kunzisoft/keepass/biometric/FingerPrintAnimatedVector.kt b/app/src/main/java/com/kunzisoft/keepass/biometric/FingerPrintAnimatedVector.kt
index 678128d26..8ee09f349 100644
--- a/app/src/main/java/com/kunzisoft/keepass/biometric/FingerPrintAnimatedVector.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/biometric/FingerPrintAnimatedVector.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.biometric
diff --git a/app/src/main/java/com/kunzisoft/keepass/crypto/AESProvider.kt b/app/src/main/java/com/kunzisoft/keepass/crypto/AESProvider.kt
index 989115163..5f5297f15 100644
--- a/app/src/main/java/com/kunzisoft/keepass/crypto/AESProvider.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/crypto/AESProvider.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.crypto
diff --git a/app/src/main/java/com/kunzisoft/keepass/crypto/CipherFactory.kt b/app/src/main/java/com/kunzisoft/keepass/crypto/CipherFactory.kt
index 355b3034c..0cd383c19 100644
--- a/app/src/main/java/com/kunzisoft/keepass/crypto/CipherFactory.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/crypto/CipherFactory.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.crypto
diff --git a/app/src/main/java/com/kunzisoft/keepass/crypto/CrsAlgorithm.kt b/app/src/main/java/com/kunzisoft/keepass/crypto/CrsAlgorithm.kt
index 094eb1d3b..b6c0085e6 100644
--- a/app/src/main/java/com/kunzisoft/keepass/crypto/CrsAlgorithm.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/crypto/CrsAlgorithm.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.crypto
diff --git a/app/src/main/java/com/kunzisoft/keepass/crypto/CryptoUtil.kt b/app/src/main/java/com/kunzisoft/keepass/crypto/CryptoUtil.kt
index d51045826..7a1a25fae 100644
--- a/app/src/main/java/com/kunzisoft/keepass/crypto/CryptoUtil.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/crypto/CryptoUtil.kt
@@ -1,33 +1,31 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.crypto
-import com.kunzisoft.keepass.stream.LEDataOutputStream
import com.kunzisoft.keepass.stream.NullOutputStream
-
+import com.kunzisoft.keepass.stream.longTo8Bytes
import java.io.IOException
import java.security.DigestOutputStream
import java.security.MessageDigest
import java.security.NoSuchAlgorithmException
-import java.util.Arrays
-
+import java.util.*
import javax.crypto.Mac
import kotlin.math.min
@@ -60,7 +58,7 @@ object CryptoUtil {
throw RuntimeException(e)
}
- val pbR = LEDataOutputStream.writeLongBuf(r)
+ val pbR = longTo8Bytes(r)
val part = hmac.doFinal(pbR)
val copy = min(cbOut - pos, part.size)
diff --git a/app/src/main/java/com/kunzisoft/keepass/crypto/NativeAESCipherSpi.java b/app/src/main/java/com/kunzisoft/keepass/crypto/NativeAESCipherSpi.java
index 913bca1c3..b420eda6e 100644
--- a/app/src/main/java/com/kunzisoft/keepass/crypto/NativeAESCipherSpi.java
+++ b/app/src/main/java/com/kunzisoft/keepass/crypto/NativeAESCipherSpi.java
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.crypto;
diff --git a/app/src/main/java/com/kunzisoft/keepass/crypto/NativeLib.kt b/app/src/main/java/com/kunzisoft/keepass/crypto/NativeLib.kt
index 06dbd2ef8..d43cf9152 100644
--- a/app/src/main/java/com/kunzisoft/keepass/crypto/NativeLib.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/crypto/NativeLib.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.crypto
diff --git a/app/src/main/java/com/kunzisoft/keepass/crypto/StreamCipherFactory.kt b/app/src/main/java/com/kunzisoft/keepass/crypto/StreamCipherFactory.kt
index 6ccf62f3c..1c5ac7dff 100644
--- a/app/src/main/java/com/kunzisoft/keepass/crypto/StreamCipherFactory.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/crypto/StreamCipherFactory.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.crypto
diff --git a/app/src/main/java/com/kunzisoft/keepass/crypto/engine/AesEngine.kt b/app/src/main/java/com/kunzisoft/keepass/crypto/engine/AesEngine.kt
index 01aabbc1f..7c2928d1e 100644
--- a/app/src/main/java/com/kunzisoft/keepass/crypto/engine/AesEngine.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/crypto/engine/AesEngine.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.crypto.engine
@@ -22,7 +22,7 @@ package com.kunzisoft.keepass.crypto.engine
import com.kunzisoft.keepass.crypto.CipherFactory
import com.kunzisoft.keepass.database.element.security.EncryptionAlgorithm
-import com.kunzisoft.keepass.utils.DatabaseInputOutputUtils
+import com.kunzisoft.keepass.stream.bytes16ToUuid
import java.security.InvalidAlgorithmParameterException
import java.security.InvalidKeyException
import java.security.NoSuchAlgorithmException
@@ -47,7 +47,22 @@ class AesEngine : CipherEngine() {
companion object {
- val CIPHER_UUID: UUID = DatabaseInputOutputUtils.bytesToUuid(
- byteArrayOf(0x31.toByte(), 0xC1.toByte(), 0xF2.toByte(), 0xE6.toByte(), 0xBF.toByte(), 0x71.toByte(), 0x43.toByte(), 0x50.toByte(), 0xBE.toByte(), 0x58.toByte(), 0x05.toByte(), 0x21.toByte(), 0x6A.toByte(), 0xFC.toByte(), 0x5A.toByte(), 0xFF.toByte()))
+ val CIPHER_UUID: UUID = bytes16ToUuid(
+ byteArrayOf(0x31.toByte(),
+ 0xC1.toByte(),
+ 0xF2.toByte(),
+ 0xE6.toByte(),
+ 0xBF.toByte(),
+ 0x71.toByte(),
+ 0x43.toByte(),
+ 0x50.toByte(),
+ 0xBE.toByte(),
+ 0x58.toByte(),
+ 0x05.toByte(),
+ 0x21.toByte(),
+ 0x6A.toByte(),
+ 0xFC.toByte(),
+ 0x5A.toByte(),
+ 0xFF.toByte()))
}
}
diff --git a/app/src/main/java/com/kunzisoft/keepass/crypto/engine/ChaCha20Engine.kt b/app/src/main/java/com/kunzisoft/keepass/crypto/engine/ChaCha20Engine.kt
index 2828c5e22..2789e8954 100644
--- a/app/src/main/java/com/kunzisoft/keepass/crypto/engine/ChaCha20Engine.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/crypto/engine/ChaCha20Engine.kt
@@ -1,26 +1,26 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.crypto.engine
import com.kunzisoft.keepass.database.element.security.EncryptionAlgorithm
-import com.kunzisoft.keepass.utils.DatabaseInputOutputUtils
+import com.kunzisoft.keepass.stream.bytes16ToUuid
import org.spongycastle.jce.provider.BouncyCastleProvider
import java.security.InvalidAlgorithmParameterException
import java.security.InvalidKeyException
@@ -50,7 +50,22 @@ class ChaCha20Engine : CipherEngine() {
companion object {
- val CIPHER_UUID: UUID = DatabaseInputOutputUtils.bytesToUuid(
- byteArrayOf(0xD6.toByte(), 0x03.toByte(), 0x8A.toByte(), 0x2B.toByte(), 0x8B.toByte(), 0x6F.toByte(), 0x4C.toByte(), 0xB5.toByte(), 0xA5.toByte(), 0x24.toByte(), 0x33.toByte(), 0x9A.toByte(), 0x31.toByte(), 0xDB.toByte(), 0xB5.toByte(), 0x9A.toByte()))
+ val CIPHER_UUID: UUID = bytes16ToUuid(
+ byteArrayOf(0xD6.toByte(),
+ 0x03.toByte(),
+ 0x8A.toByte(),
+ 0x2B.toByte(),
+ 0x8B.toByte(),
+ 0x6F.toByte(),
+ 0x4C.toByte(),
+ 0xB5.toByte(),
+ 0xA5.toByte(),
+ 0x24.toByte(),
+ 0x33.toByte(),
+ 0x9A.toByte(),
+ 0x31.toByte(),
+ 0xDB.toByte(),
+ 0xB5.toByte(),
+ 0x9A.toByte()))
}
}
diff --git a/app/src/main/java/com/kunzisoft/keepass/crypto/engine/CipherEngine.kt b/app/src/main/java/com/kunzisoft/keepass/crypto/engine/CipherEngine.kt
index 64977d748..f1f10abd8 100644
--- a/app/src/main/java/com/kunzisoft/keepass/crypto/engine/CipherEngine.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/crypto/engine/CipherEngine.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.crypto.engine
diff --git a/app/src/main/java/com/kunzisoft/keepass/crypto/engine/TwofishEngine.kt b/app/src/main/java/com/kunzisoft/keepass/crypto/engine/TwofishEngine.kt
index 5718ac33c..3f5399494 100644
--- a/app/src/main/java/com/kunzisoft/keepass/crypto/engine/TwofishEngine.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/crypto/engine/TwofishEngine.kt
@@ -1,33 +1,31 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.crypto.engine
import com.kunzisoft.keepass.crypto.CipherFactory
import com.kunzisoft.keepass.database.element.security.EncryptionAlgorithm
-import com.kunzisoft.keepass.utils.DatabaseInputOutputUtils
-
+import com.kunzisoft.keepass.stream.bytes16ToUuid
import java.security.InvalidAlgorithmParameterException
import java.security.InvalidKeyException
import java.security.NoSuchAlgorithmException
-import java.util.UUID
-
+import java.util.*
import javax.crypto.Cipher
import javax.crypto.NoSuchPaddingException
import javax.crypto.spec.IvParameterSpec
@@ -53,7 +51,22 @@ class TwofishEngine : CipherEngine() {
companion object {
- val CIPHER_UUID: UUID = DatabaseInputOutputUtils.bytesToUuid(
- byteArrayOf(0xAD.toByte(), 0x68.toByte(), 0xF2.toByte(), 0x9F.toByte(), 0x57.toByte(), 0x6F.toByte(), 0x4B.toByte(), 0xB9.toByte(), 0xA3.toByte(), 0x6A.toByte(), 0xD4.toByte(), 0x7A.toByte(), 0xF9.toByte(), 0x65.toByte(), 0x34.toByte(), 0x6C.toByte()))
+ val CIPHER_UUID: UUID = bytes16ToUuid(
+ byteArrayOf(0xAD.toByte(),
+ 0x68.toByte(),
+ 0xF2.toByte(),
+ 0x9F.toByte(),
+ 0x57.toByte(),
+ 0x6F.toByte(),
+ 0x4B.toByte(),
+ 0xB9.toByte(),
+ 0xA3.toByte(),
+ 0x6A.toByte(),
+ 0xD4.toByte(),
+ 0x7A.toByte(),
+ 0xF9.toByte(),
+ 0x65.toByte(),
+ 0x34.toByte(),
+ 0x6C.toByte()))
}
}
diff --git a/app/src/main/java/com/kunzisoft/keepass/crypto/finalkey/AndroidFinalKey.java b/app/src/main/java/com/kunzisoft/keepass/crypto/finalkey/AndroidFinalKey.java
index b573f8629..c9b9992ed 100644
--- a/app/src/main/java/com/kunzisoft/keepass/crypto/finalkey/AndroidFinalKey.java
+++ b/app/src/main/java/com/kunzisoft/keepass/crypto/finalkey/AndroidFinalKey.java
@@ -1,20 +1,20 @@
/*
* Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.crypto.finalkey;
diff --git a/app/src/main/java/com/kunzisoft/keepass/crypto/finalkey/FinalKey.java b/app/src/main/java/com/kunzisoft/keepass/crypto/finalkey/FinalKey.java
index 9495a6ce4..09120d123 100644
--- a/app/src/main/java/com/kunzisoft/keepass/crypto/finalkey/FinalKey.java
+++ b/app/src/main/java/com/kunzisoft/keepass/crypto/finalkey/FinalKey.java
@@ -1,20 +1,20 @@
/*
* Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.crypto.finalkey;
diff --git a/app/src/main/java/com/kunzisoft/keepass/crypto/finalkey/FinalKeyFactory.java b/app/src/main/java/com/kunzisoft/keepass/crypto/finalkey/FinalKeyFactory.java
index b74c76b58..dd2b6a973 100644
--- a/app/src/main/java/com/kunzisoft/keepass/crypto/finalkey/FinalKeyFactory.java
+++ b/app/src/main/java/com/kunzisoft/keepass/crypto/finalkey/FinalKeyFactory.java
@@ -1,20 +1,20 @@
/*
* Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.crypto.finalkey;
diff --git a/app/src/main/java/com/kunzisoft/keepass/crypto/finalkey/NativeFinalKey.java b/app/src/main/java/com/kunzisoft/keepass/crypto/finalkey/NativeFinalKey.java
index 2ca268dc3..055a7f306 100644
--- a/app/src/main/java/com/kunzisoft/keepass/crypto/finalkey/NativeFinalKey.java
+++ b/app/src/main/java/com/kunzisoft/keepass/crypto/finalkey/NativeFinalKey.java
@@ -1,20 +1,20 @@
/*
* Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.crypto.finalkey;
diff --git a/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/AesKdf.kt b/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/AesKdf.kt
index 4612ee9dd..e117db533 100644
--- a/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/AesKdf.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/AesKdf.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.crypto.keyDerivation
@@ -23,7 +23,7 @@ import android.content.res.Resources
import com.kunzisoft.keepass.R
import com.kunzisoft.keepass.crypto.CryptoUtil
import com.kunzisoft.keepass.crypto.finalkey.FinalKeyFactory
-import com.kunzisoft.keepass.utils.DatabaseInputOutputUtils
+import com.kunzisoft.keepass.stream.bytes16ToUuid
import java.io.IOException
import java.security.SecureRandom
import java.util.*
@@ -88,7 +88,7 @@ class AesKdf internal constructor() : KdfEngine() {
private const val DEFAULT_ROUNDS = 6000
- val CIPHER_UUID: UUID = DatabaseInputOutputUtils.bytesToUuid(
+ val CIPHER_UUID: UUID = bytes16ToUuid(
byteArrayOf(0xC9.toByte(),
0xD9.toByte(),
0xF3.toByte(),
diff --git a/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/Argon2Kdf.kt b/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/Argon2Kdf.kt
index 8e60b330d..86798c1b2 100644
--- a/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/Argon2Kdf.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/Argon2Kdf.kt
@@ -1,27 +1,27 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.crypto.keyDerivation
import android.content.res.Resources
import com.kunzisoft.keepass.R
-import com.kunzisoft.keepass.utils.DatabaseInputOutputUtils
+import com.kunzisoft.keepass.stream.bytes16ToUuid
import java.io.IOException
import java.security.SecureRandom
import java.util.*
@@ -126,7 +126,7 @@ class Argon2Kdf internal constructor() : KdfEngine() {
companion object {
- val CIPHER_UUID: UUID = DatabaseInputOutputUtils.bytesToUuid(
+ val CIPHER_UUID: UUID = bytes16ToUuid(
byteArrayOf(0xEF.toByte(),
0x63.toByte(),
0x6D.toByte(),
diff --git a/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/Argon2Native.java b/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/Argon2Native.java
index 098641bff..5ef3a0b6c 100644
--- a/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/Argon2Native.java
+++ b/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/Argon2Native.java
@@ -1,20 +1,20 @@
/*
* Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.crypto.keyDerivation;
diff --git a/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/KdfEngine.kt b/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/KdfEngine.kt
index fbd22c191..499ef643c 100644
--- a/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/KdfEngine.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/KdfEngine.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.crypto.keyDerivation
diff --git a/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/KdfFactory.kt b/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/KdfFactory.kt
index d2cfa0994..7e70becde 100644
--- a/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/KdfFactory.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/KdfFactory.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.crypto.keyDerivation
diff --git a/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/KdfParameters.kt b/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/KdfParameters.kt
index d8526545f..19e6b233b 100644
--- a/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/KdfParameters.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/KdfParameters.kt
@@ -1,38 +1,38 @@
/*
- * Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.crypto.keyDerivation
+import com.kunzisoft.keepass.stream.LittleEndianDataInputStream
+import com.kunzisoft.keepass.stream.LittleEndianDataOutputStream
+import com.kunzisoft.keepass.stream.bytes16ToUuid
+import com.kunzisoft.keepass.stream.uuidTo16Bytes
import com.kunzisoft.keepass.utils.VariantDictionary
-import com.kunzisoft.keepass.stream.LEDataInputStream
-import com.kunzisoft.keepass.stream.LEDataOutputStream
-import com.kunzisoft.keepass.utils.DatabaseInputOutputUtils
-
import java.io.ByteArrayInputStream
import java.io.ByteArrayOutputStream
import java.io.IOException
-import java.util.UUID
+import java.util.*
class KdfParameters internal constructor(val uuid: UUID) : VariantDictionary() {
fun setParamUUID() {
- setByteArray(PARAM_UUID, DatabaseInputOutputUtils.uuidToBytes(uuid))
+ setByteArray(PARAM_UUID, uuidTo16Bytes(uuid))
}
companion object {
@@ -42,11 +42,11 @@ class KdfParameters internal constructor(val uuid: UUID) : VariantDictionary() {
@Throws(IOException::class)
fun deserialize(data: ByteArray): KdfParameters? {
val bis = ByteArrayInputStream(data)
- val lis = LEDataInputStream(bis)
+ val lis = LittleEndianDataInputStream(bis)
val d = deserialize(lis) ?: return null
- val uuid = DatabaseInputOutputUtils.bytesToUuid(d.getByteArray(PARAM_UUID))
+ val uuid = bytes16ToUuid(d.getByteArray(PARAM_UUID))
val kdfP = KdfParameters(uuid)
kdfP.copyTo(d)
@@ -56,7 +56,7 @@ class KdfParameters internal constructor(val uuid: UUID) : VariantDictionary() {
@Throws(IOException::class)
fun serialize(kdf: KdfParameters): ByteArray {
val bos = ByteArrayOutputStream()
- val los = LEDataOutputStream(bos)
+ val los = LittleEndianDataOutputStream(bos)
serialize(kdf, los)
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/action/AssignPasswordInDatabaseRunnable.kt b/app/src/main/java/com/kunzisoft/keepass/database/action/AssignPasswordInDatabaseRunnable.kt
index 7cbb194e5..73578e8c9 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/action/AssignPasswordInDatabaseRunnable.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/action/AssignPasswordInDatabaseRunnable.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.action
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/action/CreateDatabaseRunnable.kt b/app/src/main/java/com/kunzisoft/keepass/database/action/CreateDatabaseRunnable.kt
index 2c80fdcdf..dc0285883 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/action/CreateDatabaseRunnable.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/action/CreateDatabaseRunnable.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.action
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/action/LoadDatabaseRunnable.kt b/app/src/main/java/com/kunzisoft/keepass/database/action/LoadDatabaseRunnable.kt
index 993c50437..00d5fff24 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/action/LoadDatabaseRunnable.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/action/LoadDatabaseRunnable.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.action
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/action/ProgressDialogThread.kt b/app/src/main/java/com/kunzisoft/keepass/database/action/ProgressDialogThread.kt
index ae9a48495..fb03e482b 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/action/ProgressDialogThread.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/action/ProgressDialogThread.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.database.action
import android.content.*
@@ -22,9 +41,11 @@ import com.kunzisoft.keepass.notifications.DatabaseTaskNotificationService.Compa
import com.kunzisoft.keepass.notifications.DatabaseTaskNotificationService.Companion.ACTION_DATABASE_CREATE_ENTRY_TASK
import com.kunzisoft.keepass.notifications.DatabaseTaskNotificationService.Companion.ACTION_DATABASE_CREATE_GROUP_TASK
import com.kunzisoft.keepass.notifications.DatabaseTaskNotificationService.Companion.ACTION_DATABASE_CREATE_TASK
+import com.kunzisoft.keepass.notifications.DatabaseTaskNotificationService.Companion.ACTION_DATABASE_DELETE_ENTRY_HISTORY
import com.kunzisoft.keepass.notifications.DatabaseTaskNotificationService.Companion.ACTION_DATABASE_DELETE_NODES_TASK
import com.kunzisoft.keepass.notifications.DatabaseTaskNotificationService.Companion.ACTION_DATABASE_LOAD_TASK
import com.kunzisoft.keepass.notifications.DatabaseTaskNotificationService.Companion.ACTION_DATABASE_MOVE_NODES_TASK
+import com.kunzisoft.keepass.notifications.DatabaseTaskNotificationService.Companion.ACTION_DATABASE_RESTORE_ENTRY_HISTORY
import com.kunzisoft.keepass.notifications.DatabaseTaskNotificationService.Companion.ACTION_DATABASE_SAVE
import com.kunzisoft.keepass.notifications.DatabaseTaskNotificationService.Companion.ACTION_DATABASE_UPDATE_COLOR_TASK
import com.kunzisoft.keepass.notifications.DatabaseTaskNotificationService.Companion.ACTION_DATABASE_UPDATE_COMPRESSION_TASK
@@ -178,7 +199,11 @@ class ProgressDialogThread(private val activity: FragmentActivity) {
unBindService()
- activity.unregisterReceiver(databaseTaskBroadcastReceiver)
+ try {
+ activity.unregisterReceiver(databaseTaskBroadcastReceiver)
+ } catch (e: IllegalArgumentException) {
+ // If receiver not register, do nothing
+ }
}
@Synchronized
@@ -348,6 +373,34 @@ class ProgressDialogThread(private val activity: FragmentActivity) {
startDatabaseActionListNodes(ACTION_DATABASE_DELETE_NODES_TASK, nodesToDelete, null, save)
}
+ /*
+ -----------------
+ Entry History Settings
+ -----------------
+ */
+
+ fun startDatabaseRestoreEntryHistory(mainEntry: Entry,
+ entryHistoryPosition: Int,
+ save: Boolean) {
+ start(Bundle().apply {
+ putParcelable(DatabaseTaskNotificationService.ENTRY_ID_KEY, mainEntry.nodeId)
+ putInt(DatabaseTaskNotificationService.ENTRY_HISTORY_POSITION_KEY, entryHistoryPosition)
+ putBoolean(DatabaseTaskNotificationService.SAVE_DATABASE_KEY, save)
+ }
+ , ACTION_DATABASE_RESTORE_ENTRY_HISTORY)
+ }
+
+ fun startDatabaseDeleteEntryHistory(mainEntry: Entry,
+ entryHistoryPosition: Int,
+ save: Boolean) {
+ start(Bundle().apply {
+ putParcelable(DatabaseTaskNotificationService.ENTRY_ID_KEY, mainEntry.nodeId)
+ putInt(DatabaseTaskNotificationService.ENTRY_HISTORY_POSITION_KEY, entryHistoryPosition)
+ putBoolean(DatabaseTaskNotificationService.SAVE_DATABASE_KEY, save)
+ }
+ , ACTION_DATABASE_DELETE_ENTRY_HISTORY)
+ }
+
/*
-----------------
Main Settings
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/action/SaveDatabaseRunnable.kt b/app/src/main/java/com/kunzisoft/keepass/database/action/SaveDatabaseRunnable.kt
index 4c8e2f689..47133e692 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/action/SaveDatabaseRunnable.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/action/SaveDatabaseRunnable.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.action
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/action/UpdateCompressionBinariesDatabaseRunnable.kt b/app/src/main/java/com/kunzisoft/keepass/database/action/UpdateCompressionBinariesDatabaseRunnable.kt
index 7a22f0167..5b0e279c4 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/action/UpdateCompressionBinariesDatabaseRunnable.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/action/UpdateCompressionBinariesDatabaseRunnable.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.action
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/action/history/DeleteEntryHistoryDatabaseRunnable.kt b/app/src/main/java/com/kunzisoft/keepass/database/action/history/DeleteEntryHistoryDatabaseRunnable.kt
new file mode 100644
index 000000000..11a91d672
--- /dev/null
+++ b/app/src/main/java/com/kunzisoft/keepass/database/action/history/DeleteEntryHistoryDatabaseRunnable.kt
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2020 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
+package com.kunzisoft.keepass.database.action.history
+
+import android.content.Context
+import com.kunzisoft.keepass.database.action.SaveDatabaseRunnable
+import com.kunzisoft.keepass.database.element.Database
+import com.kunzisoft.keepass.database.element.Entry
+
+class DeleteEntryHistoryDatabaseRunnable (
+ context: Context,
+ database: Database,
+ private val mainEntry: Entry,
+ private val entryHistoryPosition: Int,
+ saveDatabase: Boolean)
+ : SaveDatabaseRunnable(context, database, saveDatabase) {
+
+ override fun onStartRun() {
+ try {
+ mainEntry.removeEntryFromHistory(entryHistoryPosition)
+ } catch (e: Exception) {
+ setError(e)
+ }
+
+ super.onStartRun()
+ }
+}
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/action/history/RestoreEntryHistoryDatabaseRunnable.kt b/app/src/main/java/com/kunzisoft/keepass/database/action/history/RestoreEntryHistoryDatabaseRunnable.kt
new file mode 100644
index 000000000..7163cdf38
--- /dev/null
+++ b/app/src/main/java/com/kunzisoft/keepass/database/action/history/RestoreEntryHistoryDatabaseRunnable.kt
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2020 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
+package com.kunzisoft.keepass.database.action.history
+
+import android.content.Context
+import com.kunzisoft.keepass.database.action.node.UpdateEntryRunnable
+import com.kunzisoft.keepass.database.element.Database
+import com.kunzisoft.keepass.database.element.Entry
+import com.kunzisoft.keepass.tasks.ActionRunnable
+
+class RestoreEntryHistoryDatabaseRunnable (
+ private val context: Context,
+ private val database: Database,
+ private val mainEntry: Entry,
+ private val entryHistoryPosition: Int,
+ private val saveDatabase: Boolean)
+ : ActionRunnable() {
+
+ private var updateEntryRunnable: UpdateEntryRunnable? = null
+
+ override fun onStartRun() {
+ try {
+ val historyToRestore = Entry(mainEntry.getHistory()[entryHistoryPosition])
+ // Copy history of main entry in the restore entry
+ mainEntry.getHistory().forEach {
+ historyToRestore.addEntryToHistory(it)
+ }
+ // Update the entry with the fresh formatted entry to restore
+ updateEntryRunnable = UpdateEntryRunnable(context,
+ database,
+ mainEntry,
+ historyToRestore,
+ saveDatabase,
+ null)
+
+ updateEntryRunnable?.onStartRun()
+
+ } catch (e: Exception) {
+ setError(e)
+ }
+ }
+
+ override fun onActionRun() {
+ updateEntryRunnable?.onActionRun()
+ }
+
+ override fun onFinishRun() {
+ updateEntryRunnable?.onFinishRun()
+ }
+}
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/action/node/ActionNodeDatabaseRunnable.kt b/app/src/main/java/com/kunzisoft/keepass/database/action/node/ActionNodeDatabaseRunnable.kt
index e8c8c2fee..e0946c5a1 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/action/node/ActionNodeDatabaseRunnable.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/action/node/ActionNodeDatabaseRunnable.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.database.action.node
import android.content.Context
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/action/node/AddEntryRunnable.kt b/app/src/main/java/com/kunzisoft/keepass/database/action/node/AddEntryRunnable.kt
index 7c40fc626..ecfd392c6 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/action/node/AddEntryRunnable.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/action/node/AddEntryRunnable.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.action.node
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/action/node/AddGroupRunnable.kt b/app/src/main/java/com/kunzisoft/keepass/database/action/node/AddGroupRunnable.kt
index 75b9ec14c..5c3285e4c 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/action/node/AddGroupRunnable.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/action/node/AddGroupRunnable.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.action.node
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/action/node/AfterActionNodesFinish.kt b/app/src/main/java/com/kunzisoft/keepass/database/action/node/AfterActionNodesFinish.kt
index ab186c692..bac995fd1 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/action/node/AfterActionNodesFinish.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/action/node/AfterActionNodesFinish.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.action.node
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/action/node/CopyNodesRunnable.kt b/app/src/main/java/com/kunzisoft/keepass/database/action/node/CopyNodesRunnable.kt
index 1b20c79ea..673122e6a 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/action/node/CopyNodesRunnable.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/action/node/CopyNodesRunnable.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.action.node
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/action/node/DeleteNodesRunnable.kt b/app/src/main/java/com/kunzisoft/keepass/database/action/node/DeleteNodesRunnable.kt
index 59701196e..cb3a0175f 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/action/node/DeleteNodesRunnable.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/action/node/DeleteNodesRunnable.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.action.node
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/action/node/MoveNodesRunnable.kt b/app/src/main/java/com/kunzisoft/keepass/database/action/node/MoveNodesRunnable.kt
index 1188a67db..42cc7559b 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/action/node/MoveNodesRunnable.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/action/node/MoveNodesRunnable.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.action.node
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/action/node/NodeHandler.kt b/app/src/main/java/com/kunzisoft/keepass/database/action/node/NodeHandler.kt
index e0c321872..28b40059c 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/action/node/NodeHandler.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/action/node/NodeHandler.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.action.node
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/action/node/UpdateEntryRunnable.kt b/app/src/main/java/com/kunzisoft/keepass/database/action/node/UpdateEntryRunnable.kt
index ceaae4143..6f349f2c5 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/action/node/UpdateEntryRunnable.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/action/node/UpdateEntryRunnable.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.action.node
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/action/node/UpdateGroupRunnable.kt b/app/src/main/java/com/kunzisoft/keepass/database/action/node/UpdateGroupRunnable.kt
index d66c99da6..05fdeba0a 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/action/node/UpdateGroupRunnable.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/action/node/UpdateGroupRunnable.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.action.node
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/cursor/EntryCursor.kt b/app/src/main/java/com/kunzisoft/keepass/database/cursor/EntryCursor.kt
index 2190de7b4..4007d0bdd 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/cursor/EntryCursor.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/cursor/EntryCursor.kt
@@ -1,10 +1,31 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.database.cursor
import android.database.MatrixCursor
import android.provider.BaseColumns
+import com.kunzisoft.keepass.database.element.DateInstant
import com.kunzisoft.keepass.database.element.entry.EntryVersioned
import com.kunzisoft.keepass.database.element.icon.IconImageFactory
import com.kunzisoft.keepass.database.element.node.NodeId
+import java.util.*
abstract class EntryCursor> : MatrixCursor(arrayOf(
_ID,
@@ -17,7 +38,9 @@ abstract class EntryCursor>
COLUMN_INDEX_USERNAME,
COLUMN_INDEX_PASSWORD,
COLUMN_INDEX_URL,
- COLUMN_INDEX_NOTES
+ COLUMN_INDEX_NOTES,
+ COLUMN_INDEX_EXPIRY_TIME,
+ COLUMN_INDEX_EXPIRES
)) {
protected var entryId: Long = 0
@@ -37,6 +60,9 @@ abstract class EntryCursor>
pwEntry.password = getString(getColumnIndex(COLUMN_INDEX_PASSWORD))
pwEntry.url = getString(getColumnIndex(COLUMN_INDEX_URL))
pwEntry.notes = getString(getColumnIndex(COLUMN_INDEX_NOTES))
+ pwEntry.expiryTime = DateInstant(getString(getColumnIndex(COLUMN_INDEX_EXPIRY_TIME)))
+ pwEntry.expires = getString(getColumnIndex(COLUMN_INDEX_EXPIRES))
+ .toLowerCase(Locale.ENGLISH) != "false"
}
companion object {
@@ -51,5 +77,7 @@ abstract class EntryCursor>
const val COLUMN_INDEX_PASSWORD = "password"
const val COLUMN_INDEX_URL = "URL"
const val COLUMN_INDEX_NOTES = "notes"
+ const val COLUMN_INDEX_EXPIRY_TIME = "expiry_time"
+ const val COLUMN_INDEX_EXPIRES = "expires"
}
}
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/cursor/EntryCursorKDB.kt b/app/src/main/java/com/kunzisoft/keepass/database/cursor/EntryCursorKDB.kt
index 5dee502de..df9eaaf8e 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/cursor/EntryCursorKDB.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/cursor/EntryCursorKDB.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.database.cursor
import com.kunzisoft.keepass.database.element.database.DatabaseVersioned
@@ -17,7 +36,9 @@ class EntryCursorKDB : EntryCursorUUID() {
entry.username,
entry.password,
entry.url,
- entry.notes
+ entry.notes,
+ entry.expiryTime,
+ entry.expires
))
entryId++
}
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/cursor/EntryCursorKDBX.kt b/app/src/main/java/com/kunzisoft/keepass/database/cursor/EntryCursorKDBX.kt
index 7a790e4c4..8564ca467 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/cursor/EntryCursorKDBX.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/cursor/EntryCursorKDBX.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.database.cursor
import com.kunzisoft.keepass.database.element.entry.EntryKDBX
@@ -21,7 +40,9 @@ class EntryCursorKDBX : EntryCursorUUID() {
entry.username,
entry.password,
entry.url,
- entry.notes
+ entry.notes,
+ entry.expiryTime,
+ entry.expires
))
for (element in entry.customFields.entries) {
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/cursor/EntryCursorUUID.kt b/app/src/main/java/com/kunzisoft/keepass/database/cursor/EntryCursorUUID.kt
index db89e6f00..778bc506d 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/cursor/EntryCursorUUID.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/cursor/EntryCursorUUID.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.database.cursor
import com.kunzisoft.keepass.database.element.entry.EntryVersioned
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/cursor/ExtraFieldCursor.kt b/app/src/main/java/com/kunzisoft/keepass/database/cursor/ExtraFieldCursor.kt
index bdbc0ee40..ea4533f15 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/cursor/ExtraFieldCursor.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/cursor/ExtraFieldCursor.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.database.cursor
import android.database.MatrixCursor
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/Database.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/Database.kt
index 091c4b13e..ab818b874 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/Database.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/Database.kt
@@ -1,25 +1,26 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.element
import android.content.ContentResolver
+import android.content.Context
import android.content.res.Resources
import android.database.Cursor
import android.net.Uri
@@ -36,7 +37,10 @@ import com.kunzisoft.keepass.database.element.node.NodeId
import com.kunzisoft.keepass.database.element.node.NodeIdInt
import com.kunzisoft.keepass.database.element.node.NodeIdUUID
import com.kunzisoft.keepass.database.element.security.EncryptionAlgorithm
-import com.kunzisoft.keepass.database.exception.*
+import com.kunzisoft.keepass.database.exception.DatabaseOutputException
+import com.kunzisoft.keepass.database.exception.FileNotFoundDatabaseException
+import com.kunzisoft.keepass.database.exception.LoadDatabaseException
+import com.kunzisoft.keepass.database.exception.SignatureDatabaseException
import com.kunzisoft.keepass.database.file.DatabaseHeaderKDB
import com.kunzisoft.keepass.database.file.DatabaseHeaderKDBX
import com.kunzisoft.keepass.database.file.input.DatabaseInputKDB
@@ -45,7 +49,7 @@ import com.kunzisoft.keepass.database.file.output.DatabaseOutputKDB
import com.kunzisoft.keepass.database.file.output.DatabaseOutputKDBX
import com.kunzisoft.keepass.database.search.SearchHelper
import com.kunzisoft.keepass.icons.IconDrawableFactory
-import com.kunzisoft.keepass.stream.LEDataInputStream
+import com.kunzisoft.keepass.stream.readBytes4ToInt
import com.kunzisoft.keepass.tasks.ProgressTaskUpdater
import com.kunzisoft.keepass.utils.SingletonHolder
import com.kunzisoft.keepass.utils.UriUtil
@@ -324,66 +328,67 @@ class Database {
isReadOnly = !file.canWrite()
}
- // Pass Uris as InputStreams
- val inputStream: InputStream?
+ // Pass KeyFile Uri as InputStreams
+ var databaseInputStream: InputStream? = null
+ var keyFileInputStream: InputStream? = null
try {
- inputStream = UriUtil.getUriInputStream(contentResolver, uri)
+ // Get keyFile inputStream
+ keyfile?.let {
+ keyFileInputStream = UriUtil.getUriInputStream(contentResolver, keyfile)
+ }
+
+ // Load Data, pass Uris as InputStreams
+ databaseInputStream = BufferedInputStream(UriUtil.getUriInputStream(contentResolver, uri))
+ if (!databaseInputStream.markSupported()) {
+ throw IOException("Input stream does not support mark.")
+ }
+
+ // We'll end up reading 8 bytes to identify the header. Might as well use two extra.
+ databaseInputStream.mark(10)
+
+ // Get the file directory to save the attachments
+ val sig1 = databaseInputStream.readBytes4ToInt()
+ val sig2 = databaseInputStream.readBytes4ToInt()
+
+ // Return to the start
+ databaseInputStream.reset()
+
+ when {
+ // Header of database KDB
+ DatabaseHeaderKDB.matchesHeader(sig1, sig2) -> setDatabaseKDB(DatabaseInputKDB(
+ cacheDirectory,
+ fixDuplicateUUID)
+ .openDatabase(databaseInputStream,
+ password,
+ keyFileInputStream,
+ progressTaskUpdater))
+
+ // Header of database KDBX
+ DatabaseHeaderKDBX.matchesHeader(sig1, sig2) -> setDatabaseKDBX(DatabaseInputKDBX(
+ cacheDirectory,
+ fixDuplicateUUID)
+ .openDatabase(databaseInputStream,
+ password,
+ keyFileInputStream,
+ progressTaskUpdater))
+
+ // Header not recognized
+ else -> throw SignatureDatabaseException()
+ }
+
+ this.mSearchHelper = SearchHelper(omitBackup)
+ loaded = true
+
+ } catch (e: LoadDatabaseException) {
+ Log.e("KPD", "Database::loadData", e)
+ throw e
} catch (e: Exception) {
Log.e("KPD", "Database::loadData", e)
throw FileNotFoundDatabaseException()
+ } finally {
+ keyFileInputStream?.close()
+ databaseInputStream?.close()
}
-
- // Pass KeyFile Uri as InputStreams
- var keyFileInputStream: InputStream? = null
- keyfile?.let {
- try {
- keyFileInputStream = UriUtil.getUriInputStream(contentResolver, keyfile)
- } catch (e: Exception) {
- Log.e("KPD", "Database::loadData", e)
- throw FileNotFoundDatabaseException()
- }
- }
-
- // Load Data
-
- val bufferedInputStream = BufferedInputStream(inputStream)
- if (!bufferedInputStream.markSupported()) {
- throw IOException("Input stream does not support mark.")
- }
-
- // We'll end up reading 8 bytes to identify the header. Might as well use two extra.
- bufferedInputStream.mark(10)
-
- // Get the file directory to save the attachments
- val sig1 = LEDataInputStream.readInt(bufferedInputStream)
- val sig2 = LEDataInputStream.readInt(bufferedInputStream)
-
- // Return to the start
- bufferedInputStream.reset()
-
- when {
- // Header of database KDB
- DatabaseHeaderKDB.matchesHeader(sig1, sig2) -> setDatabaseKDB(DatabaseInputKDB()
- .openDatabase(bufferedInputStream,
- password,
- keyFileInputStream,
- progressTaskUpdater))
-
- // Header of database KDBX
- DatabaseHeaderKDBX.matchesHeader(sig1, sig2) -> setDatabaseKDBX(DatabaseInputKDBX(
- cacheDirectory,
- fixDuplicateUUID)
- .openDatabase(bufferedInputStream,
- password,
- keyFileInputStream,
- progressTaskUpdater))
-
- // Header not recognized
- else -> throw SignatureDatabaseException()
- }
-
- this.mSearchHelper = SearchHelper(omitBackup)
- loaded = true
}
fun isGroupSearchable(group: Group, isOmitBackup: Boolean): Boolean {
@@ -397,7 +402,7 @@ class Database {
return mSearchHelper?.search(this, str, max)
}
- fun searchEntries(query: String): Cursor? {
+ fun searchEntries(context: Context, query: String): Cursor? {
var cursorKDB: EntryCursorKDB? = null
var cursorKDBX: EntryCursorKDBX? = null
@@ -409,7 +414,8 @@ class Database {
val searchResult = search(query, SearchHelper.MAX_SEARCH_ENTRY)
if (searchResult != null) {
- for (entry in searchResult.getChildEntries(true)) {
+ // Search in hide entries but not meta-stream
+ for (entry in searchResult.getChildEntries(*Group.ChildFilter.getDefaults(context))) {
entry.entryKDB?.let {
cursorKDB?.addEntry(it)
}
@@ -424,25 +430,21 @@ class Database {
fun getEntryFrom(cursor: Cursor): Entry? {
val iconFactory = mDatabaseKDB?.iconFactory ?: mDatabaseKDBX?.iconFactory ?: IconImageFactory()
- val entry = createEntry()
- // TODO invert field reference manager
- entry?.let { entryVersioned ->
- startManageEntry(entryVersioned)
+ return createEntry()?.apply {
+ startManageEntry(this)
mDatabaseKDB?.let {
- entryVersioned.entryKDB?.let { entryKDB ->
+ entryKDB?.let { entryKDB ->
(cursor as EntryCursorKDB).populateEntry(entryKDB, iconFactory)
}
}
mDatabaseKDBX?.let {
- entryVersioned.entryKDBX?.let { entryKDBX ->
+ entryKDBX?.let { entryKDBX ->
(cursor as EntryCursorKDBX).populateEntry(entryKDBX, iconFactory)
}
}
- stopManageEntry(entryVersioned)
+ stopManageEntry(this)
}
-
- return entry
}
@Throws(DatabaseOutputException::class)
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/DateInstant.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/DateInstant.kt
index 5b3eded9a..c7a930b80 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/DateInstant.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/DateInstant.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.element
@@ -23,6 +23,7 @@ import android.content.res.Resources
import android.os.Parcel
import android.os.Parcelable
import androidx.core.os.ConfigurationCompat
+import java.text.SimpleDateFormat
import java.util.*
class DateInstant : Parcelable {
@@ -44,6 +45,10 @@ class DateInstant : Parcelable {
jDate = Date(millis)
}
+ constructor(string: String) {
+ jDate = dateFormat.parse(string)
+ }
+
constructor() {
jDate = Date()
}
@@ -84,12 +89,13 @@ class DateInstant : Parcelable {
}
override fun toString(): String {
- return jDate.toString()
+ return dateFormat.format(jDate)
}
companion object {
val NEVER_EXPIRE = neverExpire
+ private val dateFormat = SimpleDateFormat.getDateTimeInstance()
private val neverExpire: DateInstant
get() {
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/DeletedObject.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/DeletedObject.kt
index 17d329c48..247f12a1e 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/DeletedObject.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/DeletedObject.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.element
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/Entry.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/Entry.kt
index a326c2ea9..f6a15b84a 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/Entry.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/Entry.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.database.element
import android.os.Parcel
@@ -13,7 +32,9 @@ import com.kunzisoft.keepass.database.element.node.Node
import com.kunzisoft.keepass.database.element.node.NodeId
import com.kunzisoft.keepass.database.element.node.NodeIdUUID
import com.kunzisoft.keepass.database.element.node.Type
+import com.kunzisoft.keepass.database.element.security.BinaryAttachment
import com.kunzisoft.keepass.database.element.security.ProtectedString
+import com.kunzisoft.keepass.model.EntryAttachment
import com.kunzisoft.keepass.model.EntryInfo
import com.kunzisoft.keepass.model.Field
import com.kunzisoft.keepass.otp.OtpElement
@@ -209,12 +230,27 @@ class Entry : Node, EntryVersionedInterface {
return title == PMS_TAN_ENTRY && username.isNotEmpty()
}
+ /**
+ * {@inheritDoc}
+ * Get the display title from an entry,
+ * [.startManageEntry] and [.stopManageEntry] must be called
+ * before and after [.getVisualTitle]
+ */
fun getVisualTitle(): String {
- return getVisualTitle(isTan(),
- title,
- username,
- url,
- nodeId.toString())
+ return if (isTan()) {
+ "$PMS_TAN_ENTRY $username"
+ } else {
+ if (title.isEmpty())
+ if (username.isEmpty())
+ if (url.isEmpty())
+ nodeId.toString()
+ else
+ url
+ else
+ username
+ else
+ title
+ }
}
/*
@@ -284,10 +320,29 @@ class Entry : Node, EntryVersionedInterface {
entryKDBX?.stopToManageFieldReferences()
}
+ fun getAttachments(): ArrayList {
+ val attachments = ArrayList()
+
+ val binaryDescriptionKDB = entryKDB?.binaryDescription ?: ""
+ val binaryKDB = entryKDB?.binaryData
+ if (binaryKDB != null) {
+ attachments.add(EntryAttachment(binaryDescriptionKDB, binaryKDB))
+ }
+
+ val actionEach = object : (Map.Entry)->Unit {
+ override fun invoke(mapEntry: Map.Entry) {
+ attachments.add(EntryAttachment(mapEntry.key, mapEntry.value))
+ }
+ }
+ entryKDBX?.binaries?.forEach(actionEach)
+
+ return attachments
+ }
+
fun getHistory(): ArrayList {
val history = ArrayList()
- val entryV4History = entryKDBX?.history ?: ArrayList()
- for (entryHistory in entryV4History) {
+ val entryKDBXHistory = entryKDBX?.history ?: ArrayList()
+ for (entryHistory in entryKDBXHistory) {
history.add(Entry(entryHistory))
}
return history
@@ -299,6 +354,10 @@ class Entry : Node, EntryVersionedInterface {
}
}
+ fun removeEntryFromHistory(position: Int) {
+ entryKDBX?.removeEntryFromHistory(position)
+ }
+
fun removeAllHistory() {
entryKDBX?.removeAllHistory()
}
@@ -379,28 +438,5 @@ class Entry : Node, EntryVersionedInterface {
}
const val PMS_TAN_ENTRY = ""
-
- /**
- * {@inheritDoc}
- * Get the display title from an entry,
- * [.startManageEntry] and [.stopManageEntry] must be called
- * before and after [.getVisualTitle]
- */
- fun getVisualTitle(isTan: Boolean, title: String, userName: String, url: String, id: String): String {
- return if (isTan) {
- "$PMS_TAN_ENTRY $userName"
- } else {
- if (title.isEmpty())
- if (userName.isEmpty())
- if (url.isEmpty())
- id
- else
- url
- else
- userName
- else
- title
- }
- }
}
}
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/Group.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/Group.kt
index 7e99cc989..9d50cda9a 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/Group.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/Group.kt
@@ -1,5 +1,25 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.database.element
+import android.content.Context
import android.os.Parcel
import android.os.Parcelable
import com.kunzisoft.keepass.database.element.group.GroupKDB
@@ -8,6 +28,7 @@ import com.kunzisoft.keepass.database.element.group.GroupVersionedInterface
import com.kunzisoft.keepass.database.element.icon.IconImage
import com.kunzisoft.keepass.database.element.icon.IconImageStandard
import com.kunzisoft.keepass.database.element.node.*
+import com.kunzisoft.keepass.settings.PreferencesUtil
import java.util.*
import kotlin.collections.ArrayList
@@ -57,6 +78,20 @@ class Group : Node, GroupVersionedInterface {
groupKDBX = parcel.readParcelable(GroupKDBX::class.java.classLoader)
}
+ enum class ChildFilter {
+ META_STREAM, EXPIRED;
+
+ companion object {
+ fun getDefaults(context: Context): Array {
+ return if (PreferencesUtil.showExpiredEntries(context)) {
+ arrayOf(META_STREAM)
+ } else {
+ arrayOf(META_STREAM, EXPIRED)
+ }
+ }
+ }
+ }
+
companion object CREATOR : Parcelable.Creator {
override fun createFromParcel(parcel: Parcel): Group {
return Group(parcel)
@@ -204,38 +239,45 @@ class Group : Node, GroupVersionedInterface {
}
override fun getChildEntries(): MutableList {
- return getChildEntries(false)
+ // To cal function with vararg
+ return getChildEntries(*emptyArray())
}
- fun getChildEntries(withoutMetaStream: Boolean): MutableList {
+ fun getChildEntries(vararg filter: ChildFilter): MutableList {
val children = ArrayList()
+ val withoutMetaStream = filter.contains(ChildFilter.META_STREAM)
+ val showExpiredEntries = !filter.contains(ChildFilter.EXPIRED)
+
groupKDB?.getChildEntries()?.forEach {
val entryToAddAsChild = Entry(it)
- if (!withoutMetaStream || (withoutMetaStream && !entryToAddAsChild.isMetaStream))
+ if ((!withoutMetaStream || (withoutMetaStream && !entryToAddAsChild.isMetaStream))
+ && (!entryToAddAsChild.isCurrentlyExpires or showExpiredEntries))
children.add(entryToAddAsChild)
}
groupKDBX?.getChildEntries()?.forEach {
- children.add(Entry(it))
+ val entryToAddAsChild = Entry(it)
+ if (!entryToAddAsChild.isCurrentlyExpires or showExpiredEntries)
+ children.add(entryToAddAsChild)
}
return children
}
/**
- * Filter MetaStream entries and return children
+ * Filter entries and return children
* @return List of direct children (one level below) as NodeVersioned
*/
- fun getChildren(withoutMetaStream: Boolean = true): List {
+ fun getChildren(vararg filter: ChildFilter): List {
val children = ArrayList()
children.addAll(getChildGroups())
groupKDB?.let {
- children.addAll(getChildEntries(withoutMetaStream))
+ children.addAll(getChildEntries(*filter))
}
groupKDBX?.let {
// No MetasStream in V4
- children.addAll(getChildEntries(withoutMetaStream))
+ children.addAll(getChildEntries(*filter))
}
return children
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/SortNodeEnum.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/SortNodeEnum.kt
index 8eb4643ef..202e93885 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/SortNodeEnum.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/SortNodeEnum.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2018 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/database/BinaryPool.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/database/BinaryPool.kt
index 4fcfe71e4..3306d6204 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/database/BinaryPool.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/database/BinaryPool.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.element.database
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/database/CompressionAlgorithm.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/database/CompressionAlgorithm.kt
index cefc27891..b3c193dbd 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/database/CompressionAlgorithm.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/database/CompressionAlgorithm.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.element.database
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/database/DatabaseKDB.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/database/DatabaseKDB.kt
index e24cc0ef6..a3bca0c9e 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/database/DatabaseKDB.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/database/DatabaseKDB.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*/
package com.kunzisoft.keepass.database.element.database
@@ -22,12 +22,12 @@ package com.kunzisoft.keepass.database.element.database
import com.kunzisoft.keepass.crypto.finalkey.FinalKeyFactory
import com.kunzisoft.keepass.crypto.keyDerivation.KdfEngine
import com.kunzisoft.keepass.crypto.keyDerivation.KdfFactory
-import com.kunzisoft.keepass.database.element.security.EncryptionAlgorithm
import com.kunzisoft.keepass.database.element.entry.EntryKDB
import com.kunzisoft.keepass.database.element.group.GroupKDB
import com.kunzisoft.keepass.database.element.node.NodeIdInt
import com.kunzisoft.keepass.database.element.node.NodeIdUUID
import com.kunzisoft.keepass.database.element.node.NodeVersioned
+import com.kunzisoft.keepass.database.element.security.EncryptionAlgorithm
import com.kunzisoft.keepass.stream.NullOutputStream
import java.io.IOException
import java.io.InputStream
@@ -267,6 +267,8 @@ class DatabaseKDB : DatabaseVersioned() {
private const val DEFAULT_ENCRYPTION_ROUNDS = 300
+ const val BUFFER_SIZE_BYTES = 3 * 128
+
/**
* Encrypt the master key a few times to make brute-force key-search harder
* @throws IOException
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/database/DatabaseKDBX.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/database/DatabaseKDBX.kt
index 4d4b6f084..591ebe481 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/database/DatabaseKDBX.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/database/DatabaseKDBX.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.element.database
@@ -181,7 +181,7 @@ class DatabaseKDBX : DatabaseVersioned {
}
CompressionAlgorithm.GZip -> {
// To compress, create a new binary with file
- binary.compress()
+ binary.compress(BUFFER_SIZE_BYTES)
}
}
}
@@ -189,7 +189,7 @@ class DatabaseKDBX : DatabaseVersioned {
when (newCompression) {
CompressionAlgorithm.None -> {
// To decompress, create a new binary with file
- binary.decompress()
+ binary.decompress(BUFFER_SIZE_BYTES)
}
CompressionAlgorithm.GZip -> {
}
@@ -562,7 +562,7 @@ class DatabaseKDBX : DatabaseVersioned {
private const val KeyElementName = "Key"
private const val KeyDataElementName = "Data"
- const val BASE_64_FLAG = Base64.DEFAULT
+ const val BASE_64_FLAG = Base64.NO_WRAP
const val BUFFER_SIZE_BYTES = 3 * 128
}
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/database/DatabaseVersioned.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/database/DatabaseVersioned.kt
index 463aa82ec..3ccdda39b 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/database/DatabaseVersioned.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/database/DatabaseVersioned.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.element.database
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/entry/AutoType.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/entry/AutoType.kt
index 0800fcd3d..85bccf259 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/entry/AutoType.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/entry/AutoType.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2018 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.element.entry
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/entry/EntryKDB.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/entry/EntryKDB.kt
index b6be2bdf5..223ec9f9c 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/entry/EntryKDB.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/entry/EntryKDB.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*/
package com.kunzisoft.keepass.database.element.entry
@@ -26,6 +26,7 @@ import com.kunzisoft.keepass.database.element.node.NodeId
import com.kunzisoft.keepass.database.element.node.NodeIdUUID
import com.kunzisoft.keepass.database.element.node.NodeKDBInterface
import com.kunzisoft.keepass.database.element.node.Type
+import com.kunzisoft.keepass.database.element.security.BinaryAttachment
import java.util.*
/**
@@ -51,19 +52,15 @@ import java.util.*
*/
class EntryKDB : EntryVersioned, NodeKDBInterface {
- /** A string describing what is in pBinaryData */
- var binaryDesc = ""
- /**
- * @return the actual binaryData byte array.
- */
- var binaryData: ByteArray = ByteArray(0)
+ /** A string describing what is in binaryData */
+ var binaryDescription = ""
+ var binaryData: BinaryAttachment? = null
// Determine if this is a MetaStream entry
val isMetaStream: Boolean
get() {
- if (binaryData.contentEquals(ByteArray(0))) return false
if (notes.isEmpty()) return false
- if (binaryDesc != PMS_ID_BINDESC) return false
+ if (binaryDescription != PMS_ID_BINDESC) return false
if (title.isEmpty()) return false
if (title != PMS_ID_TITLE) return false
if (username.isEmpty()) return false
@@ -88,9 +85,8 @@ class EntryKDB : EntryVersioned, NodeKDBInterface
password = parcel.readString() ?: password
url = parcel.readString() ?: url
notes = parcel.readString() ?: notes
- binaryDesc = parcel.readString() ?: binaryDesc
- binaryData = ByteArray(parcel.readInt())
- parcel.readByteArray(binaryData)
+ binaryDescription = parcel.readString() ?: binaryDescription
+ binaryData = parcel.readParcelable(BinaryAttachment::class.java.classLoader)
}
override fun readParentParcelable(parcel: Parcel): GroupKDB? {
@@ -108,9 +104,8 @@ class EntryKDB : EntryVersioned, NodeKDBInterface
dest.writeString(password)
dest.writeString(url)
dest.writeString(notes)
- dest.writeString(binaryDesc)
- dest.writeInt(binaryData.size)
- dest.writeByteArray(binaryData)
+ dest.writeString(binaryDescription)
+ dest.writeParcelable(binaryData, flags)
}
fun updateWith(source: EntryKDB) {
@@ -120,11 +115,8 @@ class EntryKDB : EntryVersioned, NodeKDBInterface
password = source.password
url = source.url
notes = source.notes
- binaryDesc = source.binaryDesc
-
- val descLen = source.binaryData.size
- binaryData = ByteArray(descLen)
- System.arraycopy(source.binaryData, 0, binaryData, 0, descLen)
+ binaryDescription = source.binaryDescription
+ binaryData = source.binaryData
}
override var username = ""
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/entry/EntryKDBX.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/entry/EntryKDBX.kt
index 0ccc82681..2037ede0e 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/entry/EntryKDBX.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/entry/EntryKDBX.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.element.entry
@@ -304,6 +304,10 @@ class EntryKDBX : EntryVersioned, NodeKDBXInte
history.add(entry)
}
+ fun removeEntryFromHistory(position: Int) {
+ history.removeAt(position)
+ }
+
fun removeAllHistory() {
history.clear()
}
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/entry/EntryVersioned.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/entry/EntryVersioned.kt
index d19883495..7e35bb672 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/entry/EntryVersioned.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/entry/EntryVersioned.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.database.element.entry
import android.os.Parcel
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/entry/EntryVersionedInterface.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/entry/EntryVersionedInterface.kt
index 64a7d16c5..e54f0b2ce 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/entry/EntryVersionedInterface.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/entry/EntryVersionedInterface.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.database.element.entry
import com.kunzisoft.keepass.database.element.node.NodeVersionedInterface
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/entry/FieldReferencesEngine.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/entry/FieldReferencesEngine.kt
index a0b801f70..957b61746 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/entry/FieldReferencesEngine.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/entry/FieldReferencesEngine.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.element.entry
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/group/GroupKDB.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/group/GroupKDB.kt
index 9452b260f..2c7e186e3 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/group/GroupKDB.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/group/GroupKDB.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/group/GroupKDBX.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/group/GroupKDBX.kt
index 34e7d2bd4..b437158a8 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/group/GroupKDBX.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/group/GroupKDBX.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.element.group
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/group/GroupVersioned.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/group/GroupVersioned.kt
index 6cc938a6a..fb451e2ba 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/group/GroupVersioned.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/group/GroupVersioned.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.database.element.group
import android.os.Parcel
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/group/GroupVersionedInterface.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/group/GroupVersionedInterface.kt
index 588aef471..c4d6220c1 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/group/GroupVersionedInterface.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/group/GroupVersionedInterface.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.database.element.group
import com.kunzisoft.keepass.database.action.node.NodeHandler
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/icon/IconImage.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/icon/IconImage.kt
index 47cc76e32..8f8ccf6f3 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/icon/IconImage.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/icon/IconImage.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.element.icon
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/icon/IconImageCustom.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/icon/IconImageCustom.kt
index 9744d9dd8..e9bcfc460 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/icon/IconImageCustom.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/icon/IconImageCustom.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Brian Pellin, Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.element.icon
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/icon/IconImageFactory.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/icon/IconImageFactory.kt
index e15a3988b..f48a8b264 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/icon/IconImageFactory.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/icon/IconImageFactory.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Brian Pellin, Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.element.icon
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/icon/IconImageStandard.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/icon/IconImageStandard.kt
index 9b507bdc3..bd20c38a3 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/icon/IconImageStandard.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/icon/IconImageStandard.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Brian Pellin, Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.element.icon
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/node/Node.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/node/Node.kt
index 24852a27b..e89a174d6 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/node/Node.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/node/Node.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.database.element.node
import com.kunzisoft.keepass.database.element.Group
@@ -8,7 +27,7 @@ interface Node: NodeVersionedInterface {
val nodePositionInParent: Int
get() {
- parent?.getChildren(true)?.let { children ->
+ parent?.getChildren(Group.ChildFilter.META_STREAM)?.let { children ->
children.forEachIndexed { index, nodeVersioned ->
if (nodeVersioned.nodeId == this.nodeId)
return index
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/node/NodeId.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/node/NodeId.kt
index 0a280b434..040c46ec8 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/node/NodeId.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/node/NodeId.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2018 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.element.node
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/node/NodeIdInt.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/node/NodeIdInt.kt
index 507cec4ea..8bd482972 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/node/NodeIdInt.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/node/NodeIdInt.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.element.node
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/node/NodeIdUUID.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/node/NodeIdUUID.kt
index 27dc093c5..32e17493c 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/node/NodeIdUUID.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/node/NodeIdUUID.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.element.node
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/node/NodeKDBInterface.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/node/NodeKDBInterface.kt
index 6151764ac..eefb64b1a 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/node/NodeKDBInterface.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/node/NodeKDBInterface.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.database.element.node
import com.kunzisoft.keepass.database.element.DateInstant
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/node/NodeKDBXInterface.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/node/NodeKDBXInterface.kt
index b5588d246..c8690b916 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/node/NodeKDBXInterface.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/node/NodeKDBXInterface.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.element.node
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/node/NodeTimeInterface.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/node/NodeTimeInterface.kt
index a97ed77a7..03c0294b4 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/node/NodeTimeInterface.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/node/NodeTimeInterface.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.element.node
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/node/NodeVersioned.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/node/NodeVersioned.kt
index a1ded7913..66fbbd222 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/node/NodeVersioned.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/node/NodeVersioned.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*
*/
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/node/NodeVersionedInterface.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/node/NodeVersionedInterface.kt
index 8bcd39847..19f4515f7 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/node/NodeVersionedInterface.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/node/NodeVersionedInterface.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.database.element.node
import android.os.Parcelable
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/security/BinaryAttachment.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/security/BinaryAttachment.kt
index d9137160d..e3c47d030 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/security/BinaryAttachment.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/security/BinaryAttachment.kt
@@ -1,29 +1,29 @@
/*
* Copyright 2018 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.element.security
+import android.content.ContentResolver
+import android.net.Uri
import android.os.Parcel
import android.os.Parcelable
-import com.kunzisoft.keepass.database.element.database.DatabaseKDBX.Companion.BUFFER_SIZE_BYTES
-import com.kunzisoft.keepass.stream.ReadBytes
-import com.kunzisoft.keepass.stream.readFromStream
+import com.kunzisoft.keepass.stream.readBytes
import java.io.*
import java.util.zip.GZIPInputStream
import java.util.zip.GZIPOutputStream
@@ -73,25 +73,29 @@ class BinaryAttachment : Parcelable {
}
@Throws(IOException::class)
- fun compress() {
+ fun compress(bufferSize: Int = DEFAULT_BUFFER_SIZE) {
if (dataFile != null) {
// To compress, create a new binary with file
if (isCompressed != true) {
val fileBinaryCompress = File(dataFile!!.parent, dataFile!!.name + "_temp")
- val outputStream = GZIPOutputStream(FileOutputStream(fileBinaryCompress))
- readFromStream(getInputDataStream(), BUFFER_SIZE_BYTES,
- object : ReadBytes {
- override fun read(buffer: ByteArray) {
- outputStream.write(buffer)
- }
- })
- outputStream.close()
+ var outputStream: GZIPOutputStream? = null
+ var inputStream: InputStream? = null
+ try {
+ outputStream = GZIPOutputStream(FileOutputStream(fileBinaryCompress))
+ inputStream = getInputDataStream()
+ inputStream.readBytes(bufferSize) { buffer ->
+ outputStream.write(buffer)
+ }
+ } finally {
+ inputStream?.close()
+ outputStream?.close()
- // Remove unGzip file
- if (dataFile!!.delete()) {
- if (fileBinaryCompress.renameTo(dataFile)) {
- // Harmonize with database compression
- isCompressed = true
+ // Remove unGzip file
+ if (dataFile!!.delete()) {
+ if (fileBinaryCompress.renameTo(dataFile)) {
+ // Harmonize with database compression
+ isCompressed = true
+ }
}
}
}
@@ -99,24 +103,54 @@ class BinaryAttachment : Parcelable {
}
@Throws(IOException::class)
- fun decompress() {
+ fun decompress(bufferSize: Int = DEFAULT_BUFFER_SIZE) {
if (dataFile != null) {
if (isCompressed != false) {
val fileBinaryDecompress = File(dataFile!!.parent, dataFile!!.name + "_temp")
- val outputStream = FileOutputStream(fileBinaryDecompress)
- readFromStream(GZIPInputStream(getInputDataStream()), BUFFER_SIZE_BYTES,
- object : ReadBytes {
- override fun read(buffer: ByteArray) {
- outputStream.write(buffer)
- }
- })
- outputStream.close()
+ var outputStream: FileOutputStream? = null
+ var inputStream: GZIPInputStream? = null
+ try {
+ outputStream = FileOutputStream(fileBinaryDecompress)
+ inputStream = GZIPInputStream(getInputDataStream())
+ inputStream.readBytes(bufferSize) { buffer ->
+ outputStream.write(buffer)
+ }
+ } finally {
+ inputStream?.close()
+ outputStream?.close()
- // Remove gzip file
- if (dataFile!!.delete()) {
- if (fileBinaryDecompress.renameTo(dataFile)) {
- // Harmonize with database compression
- isCompressed = false
+ // Remove gzip file
+ if (dataFile!!.delete()) {
+ if (fileBinaryDecompress.renameTo(dataFile)) {
+ // Harmonize with database compression
+ isCompressed = false
+ }
+ }
+ }
+ }
+ }
+ }
+
+ fun download(createdFileUri: Uri,
+ contentResolver: ContentResolver,
+ bufferSize: Int = DEFAULT_BUFFER_SIZE,
+ update: ((percent: Int)->Unit)? = null) {
+
+ var dataDownloaded = 0
+ contentResolver.openOutputStream(createdFileUri).use { outputStream ->
+ outputStream?.let { fileOutputStream ->
+ if (isCompressed == true) {
+ GZIPInputStream(getInputDataStream())
+ } else {
+ getInputDataStream()
+ }.use { inputStream ->
+ inputStream.readBytes(bufferSize) { buffer ->
+ fileOutputStream.write(buffer)
+ dataDownloaded += buffer.size
+ try {
+ val percentDownload = (100 * dataDownloaded / length()).toInt()
+ update?.invoke(percentDownload)
+ } catch (e: Exception) {}
}
}
}
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/security/EncryptionAlgorithm.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/security/EncryptionAlgorithm.kt
index cb87b0c3d..999278433 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/security/EncryptionAlgorithm.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/security/EncryptionAlgorithm.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.element.security
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/security/MemoryProtectionConfig.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/security/MemoryProtectionConfig.kt
index caae5289a..4b31e704d 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/security/MemoryProtectionConfig.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/security/MemoryProtectionConfig.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2018 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.element.security
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/security/ProtectedString.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/security/ProtectedString.kt
index 3b4e707a6..97d4a6f44 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/element/security/ProtectedString.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/element/security/ProtectedString.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.element.security
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/exception/ClipboardException.kt b/app/src/main/java/com/kunzisoft/keepass/database/exception/ClipboardException.kt
index 98950a1fa..5968f87d0 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/exception/ClipboardException.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/exception/ClipboardException.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.exception
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/exception/DatabaseException.kt b/app/src/main/java/com/kunzisoft/keepass/database/exception/DatabaseException.kt
index f9b904560..3ef124b62 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/exception/DatabaseException.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/exception/DatabaseException.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.database.exception
import android.content.res.Resources
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/exception/UnknownKDF.kt b/app/src/main/java/com/kunzisoft/keepass/database/exception/UnknownKDF.kt
index 435bf4b48..5daf59459 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/exception/UnknownKDF.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/exception/UnknownKDF.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.database.exception
import java.io.IOException
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/file/DatabaseHeader.kt b/app/src/main/java/com/kunzisoft/keepass/database/file/DatabaseHeader.kt
index 2a9432d6f..edc660ca3 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/file/DatabaseHeader.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/file/DatabaseHeader.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.file
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/file/DatabaseHeaderKDB.kt b/app/src/main/java/com/kunzisoft/keepass/database/file/DatabaseHeaderKDB.kt
index 12d1a629c..00b35b06f 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/file/DatabaseHeaderKDB.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/file/DatabaseHeaderKDB.kt
@@ -1,29 +1,31 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX. Derived from KeePass for J2ME
+ * This file is part of KeePassDX. Derived from KeePass for J2ME
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*
*/
package com.kunzisoft.keepass.database.file
-import com.kunzisoft.keepass.stream.LEDataInputStream
-
+import com.kunzisoft.keepass.stream.bytes4ToInt
+import com.kunzisoft.keepass.stream.readBytesLength
+import com.kunzisoft.keepass.stream.readBytes4ToInt
import java.io.IOException
+import java.io.InputStream
class DatabaseHeaderKDB : DatabaseHeader() {
@@ -47,30 +49,25 @@ class DatabaseHeaderKDB : DatabaseHeader() {
*/
var contentsHash = ByteArray(32)
+ // As UInt
var numKeyEncRounds: Int = 0
/**
* Parse given buf, as read from file.
- * @param buf
- * @throws IOException
*/
@Throws(IOException::class)
- fun loadFromFile(buf: ByteArray, offset: Int) {
- signature1 = LEDataInputStream.readInt(buf, offset)
- signature2 = LEDataInputStream.readInt(buf, offset + 4)
- flags = LEDataInputStream.readInt(buf, offset + 8)
- version = LEDataInputStream.readInt(buf, offset + 12)
-
- System.arraycopy(buf, offset + 16, masterSeed, 0, 16)
- System.arraycopy(buf, offset + 32, encryptionIV, 0, 16)
-
- numGroups = LEDataInputStream.readInt(buf, offset + 48)
- numEntries = LEDataInputStream.readInt(buf, offset + 52)
-
- System.arraycopy(buf, offset + 56, contentsHash, 0, 32)
-
- System.arraycopy(buf, offset + 88, transformSeed, 0, 32)
- numKeyEncRounds = LEDataInputStream.readInt(buf, offset + 120)
+ fun loadFromFile(inputStream: InputStream) {
+ signature1 = inputStream.readBytes4ToInt() // 4 bytes
+ signature2 = inputStream.readBytes4ToInt() // 4 bytes
+ flags = inputStream.readBytes4ToInt() // 4 bytes
+ version = inputStream.readBytes4ToInt() // 4 bytes
+ masterSeed = inputStream.readBytesLength(16) // 16 bytes
+ encryptionIV = inputStream.readBytesLength(16) // 16 bytes
+ numGroups = inputStream.readBytes4ToInt() // 4 bytes
+ numEntries = inputStream.readBytes4ToInt() // 4 bytes
+ contentsHash = inputStream.readBytesLength(32) // 32 bytes
+ transformSeed = inputStream.readBytesLength(32) // 32 bytes
+ numKeyEncRounds = inputStream.readBytes4ToInt()
if (numKeyEncRounds < 0) {
// TODO: Really treat this like an unsigned integer
throw IOException("Does not support more than " + Integer.MAX_VALUE + " rounds.")
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/file/DatabaseHeaderKDBX.kt b/app/src/main/java/com/kunzisoft/keepass/database/file/DatabaseHeaderKDBX.kt
index 4236d187c..1c7be7b01 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/file/DatabaseHeaderKDBX.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/file/DatabaseHeaderKDBX.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.file
@@ -30,10 +30,7 @@ import com.kunzisoft.keepass.database.element.entry.EntryKDBX
import com.kunzisoft.keepass.database.element.group.GroupKDBX
import com.kunzisoft.keepass.database.element.node.NodeKDBXInterface
import com.kunzisoft.keepass.database.exception.VersionDatabaseException
-import com.kunzisoft.keepass.stream.CopyInputStream
-import com.kunzisoft.keepass.stream.HmacBlockStream
-import com.kunzisoft.keepass.stream.LEDataInputStream
-import com.kunzisoft.keepass.utils.DatabaseInputOutputUtils
+import com.kunzisoft.keepass.stream.*
import java.io.ByteArrayOutputStream
import java.io.IOException
import java.io.InputStream
@@ -148,7 +145,7 @@ class DatabaseHeaderKDBX(private val databaseV4: DatabaseKDBX) : DatabaseHeader(
val headerBOS = ByteArrayOutputStream()
val copyInputStream = CopyInputStream(inputStream, headerBOS)
val digestInputStream = DigestInputStream(copyInputStream, messageDigest)
- val littleEndianDataInputStream = LEDataInputStream(digestInputStream)
+ val littleEndianDataInputStream = LittleEndianDataInputStream(digestInputStream)
val sig1 = littleEndianDataInputStream.readInt()
val sig2 = littleEndianDataInputStream.readInt()
@@ -172,7 +169,7 @@ class DatabaseHeaderKDBX(private val databaseV4: DatabaseKDBX) : DatabaseHeader(
}
@Throws(IOException::class)
- private fun readHeaderField(dis: LEDataInputStream): Boolean {
+ private fun readHeaderField(dis: LittleEndianDataInputStream): Boolean {
val fieldID = dis.read().toByte()
val fieldSize: Int = if (version < FILE_VERSION_32_4) {
@@ -243,12 +240,12 @@ class DatabaseHeaderKDBX(private val databaseV4: DatabaseKDBX) : DatabaseHeader(
throw IOException("Invalid cipher ID.")
}
- databaseV4.dataCipher = DatabaseInputOutputUtils.bytesToUuid(pbId)
+ databaseV4.dataCipher = bytes16ToUuid(pbId)
}
- private fun setTransformRound(roundsByte: ByteArray?) {
+ private fun setTransformRound(roundsByte: ByteArray) {
assignAesKdfEngineIfNotExists()
- val rounds = LEDataInputStream.readLong(roundsByte!!, 0)
+ val rounds = bytes64ToLong(roundsByte)
databaseV4.kdfParameters?.setUInt64(AesKdf.PARAM_ROUNDS, rounds)
databaseV4.numberKeyEncryptionRounds = rounds
}
@@ -259,7 +256,7 @@ class DatabaseHeaderKDBX(private val databaseV4: DatabaseKDBX) : DatabaseHeader(
throw IOException("Invalid compression flags.")
}
- val flag = LEDataInputStream.readInt(pbFlags, 0)
+ val flag = bytes4ToInt(pbFlags)
if (flag < 0 || flag >= CompressionAlgorithm.values().size) {
throw IOException("Unrecognized compression flag.")
}
@@ -275,7 +272,7 @@ class DatabaseHeaderKDBX(private val databaseV4: DatabaseKDBX) : DatabaseHeader(
throw IOException("Invalid stream id.")
}
- val id = LEDataInputStream.readInt(streamID, 0)
+ val id = bytes4ToInt(streamID)
if (id < 0 || id >= CrsAlgorithm.values().size) {
throw IOException("Invalid stream id.")
}
@@ -295,6 +292,9 @@ class DatabaseHeaderKDBX(private val databaseV4: DatabaseKDBX) : DatabaseHeader(
}
companion object {
+
+ var ULONG_MAX_VALUE: Long = -1
+
const val DBSIG_PRE2 = -0x4ab4049a
const val DBSIG_2 = -0x4ab40499
@@ -323,7 +323,7 @@ class DatabaseHeaderKDBX(private val databaseV4: DatabaseKDBX) : DatabaseHeader(
@Throws(IOException::class)
fun computeHeaderHmac(header: ByteArray, key: ByteArray): ByteArray {
- val blockKey = HmacBlockStream.GetHmacKey64(key, DatabaseInputOutputUtils.ULONG_MAX_VALUE)
+ val blockKey = HmacBlockStream.getHmacKey64(key, ULONG_MAX_VALUE)
val hmac: Mac
try {
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/file/DatabaseKDBXXML.kt b/app/src/main/java/com/kunzisoft/keepass/database/file/DatabaseKDBXXML.kt
index 9d6a4f9ba..57ee37f04 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/file/DatabaseKDBXXML.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/file/DatabaseKDBXXML.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.file
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/file/DateKDBXUtil.java b/app/src/main/java/com/kunzisoft/keepass/database/file/DateKDBXUtil.java
index 35c5a8c23..f35216ee8 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/file/DateKDBXUtil.java
+++ b/app/src/main/java/com/kunzisoft/keepass/database/file/DateKDBXUtil.java
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.file;
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/file/input/DatabaseInput.kt b/app/src/main/java/com/kunzisoft/keepass/database/file/input/DatabaseInput.kt
index 1d71fc2a7..8da334872 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/file/input/DatabaseInput.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/file/input/DatabaseInput.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.file.input
@@ -22,9 +22,11 @@ package com.kunzisoft.keepass.database.file.input
import com.kunzisoft.keepass.database.element.database.DatabaseVersioned
import com.kunzisoft.keepass.database.exception.LoadDatabaseException
import com.kunzisoft.keepass.tasks.ProgressTaskUpdater
+import java.io.File
import java.io.InputStream
-abstract class DatabaseInput> {
+abstract class DatabaseInput>
+ (protected val cacheDirectory: File) {
/**
* Load a versioned database file, return contents in a new DatabaseVersioned.
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/file/input/DatabaseInputKDB.kt b/app/src/main/java/com/kunzisoft/keepass/database/file/input/DatabaseInputKDB.kt
index a900180eb..5ce178f3e 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/file/input/DatabaseInputKDB.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/file/input/DatabaseInputKDB.kt
@@ -1,51 +1,25 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
- *
-
-Derived from
-
-KeePass for J2ME
-
-Copyright 2007 Naomaru Itoi
-
-This file was derived from
-
-Java clone of KeePass - A KeePass file viewer for Java
-Copyright 2006 Bill Zwicky
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; version 2
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
package com.kunzisoft.keepass.database.file.input
-import android.util.Log
import com.kunzisoft.keepass.R
import com.kunzisoft.keepass.crypto.CipherFactory
import com.kunzisoft.keepass.database.element.database.DatabaseKDB
@@ -53,28 +27,29 @@ import com.kunzisoft.keepass.database.element.entry.EntryKDB
import com.kunzisoft.keepass.database.element.group.GroupKDB
import com.kunzisoft.keepass.database.element.node.NodeIdInt
import com.kunzisoft.keepass.database.element.node.NodeIdUUID
+import com.kunzisoft.keepass.database.element.security.BinaryAttachment
import com.kunzisoft.keepass.database.element.security.EncryptionAlgorithm
import com.kunzisoft.keepass.database.exception.*
import com.kunzisoft.keepass.database.file.DatabaseHeader
import com.kunzisoft.keepass.database.file.DatabaseHeaderKDB
-import com.kunzisoft.keepass.stream.LEDataInputStream
-import com.kunzisoft.keepass.stream.NullOutputStream
+import com.kunzisoft.keepass.stream.*
import com.kunzisoft.keepass.tasks.ProgressTaskUpdater
-import com.kunzisoft.keepass.utils.DatabaseInputOutputUtils
-
-import javax.crypto.*
+import org.joda.time.Instant
+import java.io.*
+import java.security.*
+import java.util.*
+import javax.crypto.Cipher
+import javax.crypto.NoSuchPaddingException
import javax.crypto.spec.IvParameterSpec
import javax.crypto.spec.SecretKeySpec
-import java.io.IOException
-import java.io.InputStream
-import java.io.UnsupportedEncodingException
-import java.security.*
-import java.util.Arrays
+
/**
* Load a KDB database file.
*/
-class DatabaseInputKDB : DatabaseInput() {
+class DatabaseInputKDB(cacheDirectory: File,
+ private val fixDuplicateUUID: Boolean = false)
+ : DatabaseInput(cacheDirectory) {
private lateinit var mDatabaseToOpen: DatabaseKDB
@@ -87,52 +62,63 @@ class DatabaseInputKDB : DatabaseInput() {
try {
// Load entire file, most of it's encrypted.
val fileSize = databaseInputStream.available()
- val filebuf = ByteArray(fileSize + 16) // Pad with a blocksize (Twofish uses 128 bits), since Android 4.3 tries to write more to the buffer
- databaseInputStream.read(filebuf, 0, fileSize) // TODO remove
- databaseInputStream.close()
// Parse header (unencrypted)
if (fileSize < DatabaseHeaderKDB.BUF_SIZE)
throw IOException("File too short for header")
- val hdr = DatabaseHeaderKDB()
- hdr.loadFromFile(filebuf, 0)
+ val header = DatabaseHeaderKDB()
+ header.loadFromFile(databaseInputStream)
- if (hdr.signature1 != DatabaseHeader.PWM_DBSIG_1 || hdr.signature2 != DatabaseHeaderKDB.DBSIG_2) {
+ val contentSize = databaseInputStream.available()
+ if (fileSize != (contentSize + DatabaseHeaderKDB.BUF_SIZE))
+ throw IOException("Header corrupted")
+
+ if (header.signature1 != DatabaseHeader.PWM_DBSIG_1
+ || header.signature2 != DatabaseHeaderKDB.DBSIG_2) {
throw SignatureDatabaseException()
}
- if (!hdr.matchesVersion()) {
+ if (!header.matchesVersion()) {
throw VersionDatabaseException()
}
progressTaskUpdater?.updateMessage(R.string.retrieving_db_key)
mDatabaseToOpen = DatabaseKDB()
+
+ mDatabaseToOpen.changeDuplicateId = fixDuplicateUUID
mDatabaseToOpen.retrieveMasterKey(password, keyInputStream)
// Select algorithm
when {
- hdr.flags and DatabaseHeaderKDB.FLAG_RIJNDAEL != 0 -> mDatabaseToOpen.encryptionAlgorithm = EncryptionAlgorithm.AESRijndael
- hdr.flags and DatabaseHeaderKDB.FLAG_TWOFISH != 0 -> mDatabaseToOpen.encryptionAlgorithm = EncryptionAlgorithm.Twofish
+ header.flags and DatabaseHeaderKDB.FLAG_RIJNDAEL != 0 -> {
+ mDatabaseToOpen.encryptionAlgorithm = EncryptionAlgorithm.AESRijndael
+ }
+ header.flags and DatabaseHeaderKDB.FLAG_TWOFISH != 0 -> {
+ mDatabaseToOpen.encryptionAlgorithm = EncryptionAlgorithm.Twofish
+ }
else -> throw InvalidAlgorithmDatabaseException()
}
- mDatabaseToOpen.numberKeyEncryptionRounds = hdr.numKeyEncRounds.toLong()
+ mDatabaseToOpen.numberKeyEncryptionRounds = header.numKeyEncRounds.toLong()
// Generate transformedMasterKey from masterKey
- mDatabaseToOpen.makeFinalKey(hdr.masterSeed, hdr.transformSeed, mDatabaseToOpen.numberKeyEncryptionRounds)
+ mDatabaseToOpen.makeFinalKey(
+ header.masterSeed,
+ header.transformSeed,
+ mDatabaseToOpen.numberKeyEncryptionRounds)
progressTaskUpdater?.updateMessage(R.string.decrypting_db)
// Initialize Rijndael algorithm
- val cipher: Cipher
- try {
- if (mDatabaseToOpen.encryptionAlgorithm === EncryptionAlgorithm.AESRijndael) {
- cipher = CipherFactory.getInstance("AES/CBC/PKCS5Padding")
- } else if (mDatabaseToOpen.encryptionAlgorithm === EncryptionAlgorithm.Twofish) {
- cipher = CipherFactory.getInstance("Twofish/CBC/PKCS7PADDING")
- } else {
- throw IOException("Encryption algorithm is not supported")
+ val cipher: Cipher = try {
+ when {
+ mDatabaseToOpen.encryptionAlgorithm === EncryptionAlgorithm.AESRijndael -> {
+ CipherFactory.getInstance("AES/CBC/PKCS5Padding")
+ }
+ mDatabaseToOpen.encryptionAlgorithm === EncryptionAlgorithm.Twofish -> {
+ CipherFactory.getInstance("Twofish/CBC/PKCS7PADDING")
+ }
+ else -> throw IOException("Encryption algorithm is not supported")
}
-
} catch (e1: NoSuchAlgorithmException) {
throw IOException("No such algorithm")
} catch (e1: NoSuchPaddingException) {
@@ -140,98 +126,231 @@ class DatabaseInputKDB : DatabaseInput() {
}
try {
- cipher.init(Cipher.DECRYPT_MODE, SecretKeySpec(mDatabaseToOpen.finalKey, "AES"), IvParameterSpec(hdr.encryptionIV))
+ cipher.init(Cipher.DECRYPT_MODE,
+ SecretKeySpec(mDatabaseToOpen.finalKey, "AES"),
+ IvParameterSpec(header.encryptionIV))
} catch (e1: InvalidKeyException) {
throw IOException("Invalid key")
} catch (e1: InvalidAlgorithmParameterException) {
throw IOException("Invalid algorithm parameter.")
}
- // Decrypt! The first bytes aren't encrypted (that's the header)
- val encryptedPartSize: Int
+ val messageDigest: MessageDigest
try {
- encryptedPartSize = cipher.doFinal(filebuf, DatabaseHeaderKDB.BUF_SIZE, fileSize - DatabaseHeaderKDB.BUF_SIZE, filebuf, DatabaseHeaderKDB.BUF_SIZE)
- } catch (e1: ShortBufferException) {
- throw IOException("Buffer too short")
- } catch (e1: IllegalBlockSizeException) {
- throw IOException("Invalid block size")
- } catch (e1: BadPaddingException) {
- throw InvalidCredentialsDatabaseException()
- }
-
- val md: MessageDigest
- try {
- md = MessageDigest.getInstance("SHA-256")
+ messageDigest = MessageDigest.getInstance("SHA-256")
} catch (e: NoSuchAlgorithmException) {
throw IOException("No SHA-256 algorithm")
}
- val nos = NullOutputStream()
- val dos = DigestOutputStream(nos, md)
- dos.write(filebuf, DatabaseHeaderKDB.BUF_SIZE, encryptedPartSize)
- dos.close()
- val hash = md.digest()
+ // Decrypt content
+ val cipherInputStream = BufferedInputStream(
+ DigestInputStream(
+ BetterCipherInputStream(databaseInputStream, cipher),
+ messageDigest
+ )
+ )
- if (!Arrays.equals(hash, hdr.contentsHash)) {
+ /* TODO checksum
+ // Add a mark to the content start
+ if (!cipherInputStream.markSupported()) {
+ throw IOException("Input stream does not support mark.")
+ }
+ cipherInputStream.mark(cipherInputStream.available() +1)
+ // Consume all data to get the digest
+ var numberRead = 0
+ while (numberRead > -1) {
+ numberRead = cipherInputStream.read(ByteArray(1024))
+ }
- Log.w(TAG, "Database file did not decrypt correctly. (checksum code is broken)")
+ // Check sum
+ if (!Arrays.equals(messageDigest.digest(), header.contentsHash)) {
throw InvalidCredentialsDatabaseException()
}
+ // Back to the content start
+ cipherInputStream.reset()
+ */
// New manual root because KDB contains multiple root groups (here available with getRootGroups())
val newRoot = mDatabaseToOpen.createGroup()
newRoot.level = -1
mDatabaseToOpen.rootGroup = newRoot
- // Import all groups
- var pos = DatabaseHeaderKDB.BUF_SIZE
- var newGrp = mDatabaseToOpen.createGroup()
- run {
- var i = 0
- while (i < hdr.numGroups) {
- val fieldType = LEDataInputStream.readUShort(filebuf, pos)
- pos += 2
- val fieldSize = LEDataInputStream.readInt(filebuf, pos)
- pos += 4
+ // Import all nodes
+ var newGroup: GroupKDB? = null
+ var newEntry: EntryKDB? = null
+ var currentGroupNumber = 0
+ var currentEntryNumber = 0
+ while (currentGroupNumber < header.numGroups
+ || currentEntryNumber < header.numEntries) {
- if (fieldType == 0xFFFF) {
- // End-Group record. Save group and count it.
- mDatabaseToOpen.addGroupIndex(newGrp)
- newGrp = mDatabaseToOpen.createGroup()
- i++
- } else {
- readGroupField(mDatabaseToOpen, newGrp, fieldType, filebuf, pos)
+ val fieldType = cipherInputStream.readBytes2ToUShort()
+ val fieldSize = cipherInputStream.readBytes4ToUInt().toInt()
+
+ when (fieldType) {
+ 0x0000 -> {
+ cipherInputStream.readBytesLength(fieldSize)
+ }
+ 0x0001 -> {
+ // Create new node depending on byte number
+ when (fieldSize) {
+ 4 -> {
+ newGroup = mDatabaseToOpen.createGroup().apply {
+ setGroupId(cipherInputStream.readBytes4ToInt())
+ }
+ }
+ 16 -> {
+ newEntry = mDatabaseToOpen.createEntry().apply {
+ nodeId = NodeIdUUID(cipherInputStream.readBytes16ToUuid())
+ }
+ }
+ else -> {
+ throw UnsupportedEncodingException("Field type $fieldType")
+ }
+ }
+ }
+ 0x0002 -> {
+ newGroup?.let { group ->
+ group.title = cipherInputStream.readBytesToString(fieldSize)
+ } ?:
+ newEntry?.let { entry ->
+ val groupKDB = mDatabaseToOpen.createGroup()
+ groupKDB.nodeId = NodeIdInt(cipherInputStream.readBytes4ToInt())
+ entry.parent = groupKDB
+ }
+ }
+ 0x0003 -> {
+ newGroup?.let { group ->
+ group.creationTime = cipherInputStream.readBytes5ToDate()
+ } ?:
+ newEntry?.let { entry ->
+ var iconId = cipherInputStream.readBytes4ToInt()
+ // Clean up after bug that set icon ids to -1
+ if (iconId == -1) {
+ iconId = 0
+ }
+ entry.icon = mDatabaseToOpen.iconFactory.getIcon(iconId)
+ }
+ }
+ 0x0004 -> {
+ newGroup?.let { group ->
+ group.lastModificationTime = cipherInputStream.readBytes5ToDate()
+ } ?:
+ newEntry?.let { entry ->
+ entry.title = cipherInputStream.readBytesToString(fieldSize)
+ }
+ }
+ 0x0005 -> {
+ newGroup?.let { group ->
+ group.lastAccessTime = cipherInputStream.readBytes5ToDate()
+ } ?:
+ newEntry?.let { entry ->
+ entry.url = cipherInputStream.readBytesToString(fieldSize)
+ }
+ }
+ 0x0006 -> {
+ newGroup?.let { group ->
+ group.expiryTime = cipherInputStream.readBytes5ToDate()
+ } ?:
+ newEntry?.let { entry ->
+ entry.username = cipherInputStream.readBytesToString(fieldSize)
+ }
+ }
+ 0x0007 -> {
+ newGroup?.let { group ->
+ group.icon = mDatabaseToOpen.iconFactory.getIcon(cipherInputStream.readBytes4ToInt())
+ } ?:
+ newEntry?.let { entry ->
+ entry.password = cipherInputStream.readBytesToString(fieldSize,false)
+ }
+ }
+ 0x0008 -> {
+ newGroup?.let { group ->
+ group.level = cipherInputStream.readBytes2ToUShort()
+ } ?:
+ newEntry?.let { entry ->
+ entry.notes = cipherInputStream.readBytesToString(fieldSize)
+ }
+ }
+ 0x0009 -> {
+ newGroup?.let { group ->
+ group.flags = cipherInputStream.readBytes4ToInt()
+ } ?:
+ newEntry?.let { entry ->
+ entry.creationTime = cipherInputStream.readBytes5ToDate()
+ }
+ }
+ 0x000A -> {
+ newEntry?.let { entry ->
+ entry.lastModificationTime = cipherInputStream.readBytes5ToDate()
+ }
+ }
+ 0x000B -> {
+ newEntry?.let { entry ->
+ entry.lastAccessTime = cipherInputStream.readBytes5ToDate()
+ }
+ }
+ 0x000C -> {
+ newEntry?.let { entry ->
+ entry.expiryTime = cipherInputStream.readBytes5ToDate()
+ }
+ }
+ 0x000D -> {
+ newEntry?.let { entry ->
+ entry.binaryDescription = cipherInputStream.readBytesToString(fieldSize)
+ }
+ }
+ 0x000E -> {
+ newEntry?.let { entry ->
+ if (fieldSize > 0) {
+ // Generate an unique new file with timestamp
+ val binaryFile = File(cacheDirectory,
+ Instant.now().millis.toString())
+ entry.binaryData = BinaryAttachment(binaryFile)
+ BufferedOutputStream(FileOutputStream(binaryFile)).use { outputStream ->
+ cipherInputStream.readBytes(fieldSize,
+ DatabaseKDB.BUFFER_SIZE_BYTES) { buffer ->
+ outputStream.write(buffer)
+ }
+ }
+ }
+ }
+ }
+ 0xFFFF -> {
+ // End record. Save node and count it.
+ newGroup?.let { group ->
+ mDatabaseToOpen.addGroupIndex(group)
+ currentGroupNumber++
+ newGroup = null
+ }
+ newEntry?.let { entry ->
+ mDatabaseToOpen.addEntryIndex(entry)
+ currentEntryNumber++
+ newEntry = null
+ }
+ cipherInputStream.readBytesLength(fieldSize)
+ }
+ else -> {
+ throw UnsupportedEncodingException("Field type $fieldType")
}
- pos += fieldSize
}
}
-
- // Import all entries
- var newEnt = mDatabaseToOpen.createEntry()
- var i = 0
- while (i < hdr.numEntries) {
- val fieldType = LEDataInputStream.readUShort(filebuf, pos)
- val fieldSize = LEDataInputStream.readInt(filebuf, pos + 2)
-
- if (fieldType == 0xFFFF) {
- // End-Group record. Save group and count it.
- mDatabaseToOpen.addEntryIndex(newEnt)
- newEnt = mDatabaseToOpen.createEntry()
- i++
- } else {
- readEntryField(mDatabaseToOpen, newEnt, filebuf, pos)
- }
- pos += 2 + 4 + fieldSize
+ // Check sum
+ if (!Arrays.equals(messageDigest.digest(), header.contentsHash)) {
+ throw InvalidCredentialsDatabaseException()
}
-
constructTreeFromIndex()
+
} catch (e: LoadDatabaseException) {
+ mDatabaseToOpen.clearCache()
throw e
} catch (e: IOException) {
+ mDatabaseToOpen.clearCache()
throw IODatabaseException(e)
} catch (e: OutOfMemoryError) {
+ mDatabaseToOpen.clearCache()
throw NoMemoryDatabaseException(e)
} catch (e: Exception) {
+ mDatabaseToOpen.clearCache()
throw LoadDatabaseException(e)
}
@@ -279,71 +398,6 @@ class DatabaseInputKDB : DatabaseInput() {
}
}
- /**
- * Parse and save one record from binary file.
- * @param buf
- * @param offset
- * @return If >0,
- * @throws UnsupportedEncodingException
- */
- @Throws(UnsupportedEncodingException::class)
- private fun readGroupField(db: DatabaseKDB, grp: GroupKDB, fieldType: Int, buf: ByteArray, offset: Int) {
- when (fieldType) {
- 0x0000 -> {
- }
- 0x0001 -> grp.setGroupId(LEDataInputStream.readInt(buf, offset))
- 0x0002 -> grp.title = DatabaseInputOutputUtils.readCString(buf, offset)
- 0x0003 -> grp.creationTime = DatabaseInputOutputUtils.readCDate(buf, offset)
- 0x0004 -> grp.lastModificationTime = DatabaseInputOutputUtils.readCDate(buf, offset)
- 0x0005 -> grp.lastAccessTime = DatabaseInputOutputUtils.readCDate(buf, offset)
- 0x0006 -> grp.expiryTime = DatabaseInputOutputUtils.readCDate(buf, offset)
- 0x0007 -> grp.icon = db.iconFactory.getIcon(LEDataInputStream.readInt(buf, offset))
- 0x0008 -> grp.level = LEDataInputStream.readUShort(buf, offset)
- 0x0009 -> grp.flags = LEDataInputStream.readInt(buf, offset)
- }// Ignore field
- }
-
- @Throws(UnsupportedEncodingException::class)
- private fun readEntryField(db: DatabaseKDB, ent: EntryKDB, buf: ByteArray, offset: Int) {
- var offsetMutable = offset
- val fieldType = LEDataInputStream.readUShort(buf, offsetMutable)
- offsetMutable += 2
- val fieldSize = LEDataInputStream.readInt(buf, offsetMutable)
- offsetMutable += 4
-
- when (fieldType) {
- 0x0000 -> {
- }
- 0x0001 -> ent.nodeId = NodeIdUUID(LEDataInputStream.readUuid(buf, offsetMutable))
- 0x0002 -> {
- val groupKDB = mDatabaseToOpen.createGroup()
- groupKDB.nodeId = NodeIdInt(LEDataInputStream.readInt(buf, offsetMutable))
- ent.parent = groupKDB
- }
- 0x0003 -> {
- var iconId = LEDataInputStream.readInt(buf, offsetMutable)
-
- // Clean up after bug that set icon ids to -1
- if (iconId == -1) {
- iconId = 0
- }
-
- ent.icon = db.iconFactory.getIcon(iconId)
- }
- 0x0004 -> ent.title = DatabaseInputOutputUtils.readCString(buf, offsetMutable)
- 0x0005 -> ent.url = DatabaseInputOutputUtils.readCString(buf, offsetMutable)
- 0x0006 -> ent.username = DatabaseInputOutputUtils.readCString(buf, offsetMutable)
- 0x0007 -> ent.password = DatabaseInputOutputUtils.readPassword(buf, offsetMutable)
- 0x0008 -> ent.notes = DatabaseInputOutputUtils.readCString(buf, offsetMutable)
- 0x0009 -> ent.creationTime = DatabaseInputOutputUtils.readCDate(buf, offsetMutable)
- 0x000A -> ent.lastModificationTime = DatabaseInputOutputUtils.readCDate(buf, offsetMutable)
- 0x000B -> ent.lastAccessTime = DatabaseInputOutputUtils.readCDate(buf, offsetMutable)
- 0x000C -> ent.expiryTime = DatabaseInputOutputUtils.readCDate(buf, offsetMutable)
- 0x000D -> ent.binaryDesc = DatabaseInputOutputUtils.readCString(buf, offsetMutable)
- 0x000E -> ent.binaryData = DatabaseInputOutputUtils.readBytes(buf, offsetMutable, fieldSize)
- }// Ignore field
- }
-
companion object {
private val TAG = DatabaseInputKDB::class.java.name
}
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 0b3082542..2d9a89d9f 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
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.file.input
@@ -24,7 +24,8 @@ import com.kunzisoft.keepass.R
import com.kunzisoft.keepass.crypto.CipherFactory
import com.kunzisoft.keepass.crypto.StreamCipherFactory
import com.kunzisoft.keepass.crypto.engine.CipherEngine
-import com.kunzisoft.keepass.database.element.*
+import com.kunzisoft.keepass.database.element.DateInstant
+import com.kunzisoft.keepass.database.element.DeletedObject
import com.kunzisoft.keepass.database.element.database.CompressionAlgorithm
import com.kunzisoft.keepass.database.element.database.DatabaseKDBX
import com.kunzisoft.keepass.database.element.database.DatabaseKDBX.Companion.BASE_64_FLAG
@@ -37,12 +38,11 @@ import com.kunzisoft.keepass.database.element.node.NodeKDBXInterface
import com.kunzisoft.keepass.database.element.security.BinaryAttachment
import com.kunzisoft.keepass.database.element.security.ProtectedString
import com.kunzisoft.keepass.database.exception.*
-import com.kunzisoft.keepass.database.file.DateKDBXUtil
import com.kunzisoft.keepass.database.file.DatabaseHeaderKDBX
import com.kunzisoft.keepass.database.file.DatabaseKDBXXML
+import com.kunzisoft.keepass.database.file.DateKDBXUtil
import com.kunzisoft.keepass.stream.*
import com.kunzisoft.keepass.tasks.ProgressTaskUpdater
-import com.kunzisoft.keepass.utils.DatabaseInputOutputUtils
import org.spongycastle.crypto.StreamCipher
import org.xmlpull.v1.XmlPullParser
import org.xmlpull.v1.XmlPullParserException
@@ -54,10 +54,12 @@ import java.util.*
import java.util.zip.GZIPInputStream
import java.util.zip.GZIPOutputStream
import javax.crypto.Cipher
+import javax.crypto.CipherInputStream
import kotlin.math.min
-class DatabaseInputKDBX(private val streamDir: File,
- private val fixDuplicateUUID: Boolean = false) : DatabaseInput() {
+class DatabaseInputKDBX(cacheDirectory: File,
+ private val fixDuplicateUUID: Boolean = false)
+ : DatabaseInput(cacheDirectory) {
private var randomStream: StreamCipher? = null
private lateinit var mDatabase: DatabaseKDBX
@@ -131,11 +133,11 @@ class DatabaseInputKDBX(private val streamDir: File,
if (mDatabase.kdbxVersion < DatabaseHeaderKDBX.FILE_VERSION_32_4) {
val decrypted = attachCipherStream(databaseInputStream, cipher)
- val dataDecrypted = LEDataInputStream(decrypted)
+ val dataDecrypted = LittleEndianDataInputStream(decrypted)
val storedStartBytes: ByteArray?
try {
storedStartBytes = dataDecrypted.readBytes(32)
- if (storedStartBytes == null || storedStartBytes.size != 32) {
+ if (storedStartBytes.size != 32) {
throw InvalidCredentialsDatabaseException()
}
} catch (e: IOException) {
@@ -148,7 +150,7 @@ class DatabaseInputKDBX(private val streamDir: File,
isPlain = HashedBlockInputStream(dataDecrypted)
} else { // KDBX 4
- val isData = LEDataInputStream(databaseInputStream)
+ val isData = LittleEndianDataInputStream(databaseInputStream)
val storedHash = isData.readBytes(32)
if (!Arrays.equals(storedHash, hashOfHeader)) {
throw InvalidCredentialsDatabaseException()
@@ -157,7 +159,7 @@ class DatabaseInputKDBX(private val streamDir: File,
val hmacKey = mDatabase.hmacKey ?: throw LoadDatabaseException()
val headerHmac = DatabaseHeaderKDBX.computeHeaderHmac(pbHeader, hmacKey)
val storedHmac = isData.readBytes(32)
- if (storedHmac == null || storedHmac.size != 32) {
+ if (storedHmac.size != 32) {
throw InvalidCredentialsDatabaseException()
}
// Mac doesn't match
@@ -207,12 +209,12 @@ class DatabaseInputKDBX(private val streamDir: File,
}
private fun attachCipherStream(inputStream: InputStream, cipher: Cipher): InputStream {
- return BetterCipherInputStream(inputStream, cipher, 50 * 1024)
+ return CipherInputStream(inputStream, cipher)
}
@Throws(IOException::class)
private fun loadInnerHeader(inputStream: InputStream, header: DatabaseHeaderKDBX) {
- val lis = LEDataInputStream(inputStream)
+ val lis = LittleEndianDataInputStream(inputStream)
while (true) {
if (!readInnerHeader(lis, header)) break
@@ -220,7 +222,8 @@ class DatabaseInputKDBX(private val streamDir: File,
}
@Throws(IOException::class)
- private fun readInnerHeader(dataInputStream: LEDataInputStream, header: DatabaseHeaderKDBX): Boolean {
+ private fun readInnerHeader(dataInputStream: LittleEndianDataInputStream,
+ header: DatabaseHeaderKDBX): Boolean {
val fieldId = dataInputStream.read().toByte()
val size = dataInputStream.readInt()
@@ -243,13 +246,11 @@ class DatabaseInputKDBX(private val streamDir: File,
val protectedFlag = flag && DatabaseHeaderKDBX.KdbxBinaryFlags.Protected.toInt() != DatabaseHeaderKDBX.KdbxBinaryFlags.None.toInt()
val byteLength = size - 1
// Read in a file
- val file = File(streamDir, unusedCacheFileName)
+ val file = File(cacheDirectory, unusedCacheFileName)
FileOutputStream(file).use { outputStream ->
- dataInputStream.readBytes(byteLength, object : ReadBytes {
- override fun read(buffer: ByteArray) {
- outputStream.write(buffer)
- }
- })
+ dataInputStream.readBytes(byteLength, DatabaseKDBX.BUFFER_SIZE_BYTES) { buffer ->
+ outputStream.write(buffer)
+ }
}
val protectedBinary = BinaryAttachment(file, protectedFlag)
mDatabase.binaryPool.add(protectedBinary)
@@ -822,7 +823,7 @@ class DatabaseInputKDBX(private val streamDir: File,
buf = buf8
}
- val seconds = LEDataInputStream.readLong(buf, 0)
+ val seconds = bytes64ToLong(buf)
utcDate = DateKDBXUtil.convertKDBX4Time(seconds)
} else {
@@ -882,7 +883,7 @@ class DatabaseInputKDBX(private val streamDir: File,
}
val buf = Base64.decode(encoded, BASE_64_FLAG)
- return DatabaseInputOutputUtils.bytesToUuid(buf)
+ return bytes16ToUuid(buf)
}
@Throws(IOException::class, XmlPullParserException::class)
@@ -960,7 +961,7 @@ class DatabaseInputKDBX(private val streamDir: File,
// New binary to retrieve
else {
- var compressed: Boolean? = null
+ var compressed = false
var protected = false
if (xpp.attributeCount > 0) {
@@ -980,16 +981,16 @@ class DatabaseInputKDBX(private val streamDir: File,
return BinaryAttachment()
val data = Base64.decode(base64, BASE_64_FLAG)
- val file = File(streamDir, unusedCacheFileName)
+ val file = File(cacheDirectory, unusedCacheFileName)
return FileOutputStream(file).use { outputStream ->
// Force compression in this specific case
if (mDatabase.compressionAlgorithm == CompressionAlgorithm.GZip
- && compressed == false) {
+ && !compressed) {
GZIPOutputStream(outputStream).write(data)
BinaryAttachment(file, protected, true)
} else {
outputStream.write(data)
- BinaryAttachment(file, protected)
+ BinaryAttachment(file, protected, compressed)
}
}
}
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/file/output/DatabaseHeaderOutput.kt b/app/src/main/java/com/kunzisoft/keepass/database/file/output/DatabaseHeaderOutput.kt
index d279bd7f8..4cb13458d 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/file/output/DatabaseHeaderOutput.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/file/output/DatabaseHeaderOutput.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.file.output
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/file/output/DatabaseHeaderOutputKDB.kt b/app/src/main/java/com/kunzisoft/keepass/database/file/output/DatabaseHeaderOutputKDB.kt
index 749c87ad0..71a38715c 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/file/output/DatabaseHeaderOutputKDB.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/file/output/DatabaseHeaderOutputKDB.kt
@@ -1,53 +1,53 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.file.output
import com.kunzisoft.keepass.database.file.DatabaseHeaderKDB
-import com.kunzisoft.keepass.stream.LEDataOutputStream
-
+import com.kunzisoft.keepass.stream.intTo4Bytes
import java.io.IOException
import java.io.OutputStream
-class DatabaseHeaderOutputKDB(private val mHeader: DatabaseHeaderKDB, private val mOS: OutputStream) {
+class DatabaseHeaderOutputKDB(private val mHeader: DatabaseHeaderKDB,
+ private val mOutputStream: OutputStream) {
@Throws(IOException::class)
fun outputStart() {
- mOS.write(LEDataOutputStream.writeIntBuf(mHeader.signature1))
- mOS.write(LEDataOutputStream.writeIntBuf(mHeader.signature2))
- mOS.write(LEDataOutputStream.writeIntBuf(mHeader.flags))
- mOS.write(LEDataOutputStream.writeIntBuf(mHeader.version))
- mOS.write(mHeader.masterSeed)
- mOS.write(mHeader.encryptionIV)
- mOS.write(LEDataOutputStream.writeIntBuf(mHeader.numGroups))
- mOS.write(LEDataOutputStream.writeIntBuf(mHeader.numEntries))
+ mOutputStream.write(intTo4Bytes(mHeader.signature1))
+ mOutputStream.write(intTo4Bytes(mHeader.signature2))
+ mOutputStream.write(intTo4Bytes(mHeader.flags))
+ mOutputStream.write(intTo4Bytes(mHeader.version))
+ mOutputStream.write(mHeader.masterSeed)
+ mOutputStream.write(mHeader.encryptionIV)
+ mOutputStream.write(intTo4Bytes(mHeader.numGroups))
+ mOutputStream.write(intTo4Bytes(mHeader.numEntries))
}
@Throws(IOException::class)
fun outputContentHash() {
- mOS.write(mHeader.contentsHash)
+ mOutputStream.write(mHeader.contentsHash)
}
@Throws(IOException::class)
fun outputEnd() {
- mOS.write(mHeader.transformSeed)
- mOS.write(LEDataOutputStream.writeIntBuf(mHeader.numKeyEncRounds))
+ mOutputStream.write(mHeader.transformSeed)
+ mOutputStream.write(intTo4Bytes(mHeader.numKeyEncRounds))
}
@Throws(IOException::class)
@@ -59,6 +59,6 @@ class DatabaseHeaderOutputKDB(private val mHeader: DatabaseHeaderKDB, private va
@Throws(IOException::class)
fun close() {
- mOS.close()
+ mOutputStream.close()
}
}
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/file/output/DatabaseHeaderOutputKDBX.kt b/app/src/main/java/com/kunzisoft/keepass/database/file/output/DatabaseHeaderOutputKDBX.kt
index 520090d65..f5a987f6f 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/file/output/DatabaseHeaderOutputKDBX.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/file/output/DatabaseHeaderOutputKDBX.kt
@@ -1,35 +1,32 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.file.output
-import com.kunzisoft.keepass.utils.VariantDictionary
import com.kunzisoft.keepass.crypto.keyDerivation.KdfParameters
import com.kunzisoft.keepass.database.element.database.DatabaseKDBX
+import com.kunzisoft.keepass.database.exception.DatabaseOutputException
import com.kunzisoft.keepass.database.file.DatabaseHeader
import com.kunzisoft.keepass.database.file.DatabaseHeaderKDBX
-import com.kunzisoft.keepass.database.exception.DatabaseOutputException
-import com.kunzisoft.keepass.stream.HmacBlockStream
-import com.kunzisoft.keepass.stream.LEDataOutputStream
-import com.kunzisoft.keepass.stream.MacOutputStream
-import com.kunzisoft.keepass.utils.DatabaseInputOutputUtils
-
+import com.kunzisoft.keepass.database.file.DatabaseHeaderKDBX.Companion.ULONG_MAX_VALUE
+import com.kunzisoft.keepass.stream.*
+import com.kunzisoft.keepass.utils.VariantDictionary
import java.io.ByteArrayOutputStream
import java.io.IOException
import java.io.OutputStream
@@ -37,13 +34,15 @@ import java.security.DigestOutputStream
import java.security.InvalidKeyException
import java.security.MessageDigest
import java.security.NoSuchAlgorithmException
-
import javax.crypto.Mac
import javax.crypto.spec.SecretKeySpec
class DatabaseHeaderOutputKDBX @Throws(DatabaseOutputException::class)
-constructor(private val db: DatabaseKDBX, private val header: DatabaseHeaderKDBX, os: OutputStream) : DatabaseHeaderOutput() {
- private val los: LEDataOutputStream
+constructor(private val databaseKDBX: DatabaseKDBX,
+ private val header: DatabaseHeaderKDBX,
+ outputStream: OutputStream) : DatabaseHeaderOutput() {
+
+ private val los: LittleEndianDataOutputStream
private val mos: MacOutputStream
private val dos: DigestOutputStream
lateinit var headerHmac: ByteArray
@@ -58,15 +57,16 @@ constructor(private val db: DatabaseKDBX, private val header: DatabaseHeaderKDBX
}
try {
- db.makeFinalKey(header.masterSeed)
+ databaseKDBX.makeFinalKey(header.masterSeed)
} catch (e: IOException) {
throw DatabaseOutputException(e)
}
+ val hmacKey = databaseKDBX.hmacKey ?: throw DatabaseOutputException("HmacKey is not defined")
val hmac: Mac
try {
hmac = Mac.getInstance("HmacSHA256")
- val signingKey = SecretKeySpec(HmacBlockStream.GetHmacKey64(db.hmacKey, DatabaseInputOutputUtils.ULONG_MAX_VALUE), "HmacSHA256")
+ val signingKey = SecretKeySpec(HmacBlockStream.getHmacKey64(hmacKey, ULONG_MAX_VALUE), "HmacSHA256")
hmac.init(signingKey)
} catch (e: NoSuchAlgorithmException) {
throw DatabaseOutputException(e)
@@ -74,9 +74,9 @@ constructor(private val db: DatabaseKDBX, private val header: DatabaseHeaderKDBX
throw DatabaseOutputException(e)
}
- dos = DigestOutputStream(os, md)
+ dos = DigestOutputStream(outputStream, md)
mos = MacOutputStream(dos, hmac)
- los = LEDataOutputStream(mos)
+ los = LittleEndianDataOutputStream(mos)
}
@Throws(IOException::class)
@@ -86,15 +86,15 @@ constructor(private val db: DatabaseKDBX, private val header: DatabaseHeaderKDBX
los.writeUInt(DatabaseHeaderKDBX.DBSIG_2.toLong())
los.writeUInt(header.version)
- writeHeaderField(DatabaseHeaderKDBX.PwDbHeaderV4Fields.CipherID, DatabaseInputOutputUtils.uuidToBytes(db.dataCipher))
- writeHeaderField(DatabaseHeaderKDBX.PwDbHeaderV4Fields.CompressionFlags, LEDataOutputStream.writeIntBuf(DatabaseHeaderKDBX.getFlagFromCompression(db.compressionAlgorithm)))
+ writeHeaderField(DatabaseHeaderKDBX.PwDbHeaderV4Fields.CipherID, uuidTo16Bytes(databaseKDBX.dataCipher))
+ writeHeaderField(DatabaseHeaderKDBX.PwDbHeaderV4Fields.CompressionFlags, intTo4Bytes(DatabaseHeaderKDBX.getFlagFromCompression(databaseKDBX.compressionAlgorithm)))
writeHeaderField(DatabaseHeaderKDBX.PwDbHeaderV4Fields.MasterSeed, header.masterSeed)
if (header.version < DatabaseHeaderKDBX.FILE_VERSION_32_4) {
writeHeaderField(DatabaseHeaderKDBX.PwDbHeaderV4Fields.TransformSeed, header.transformSeed)
- writeHeaderField(DatabaseHeaderKDBX.PwDbHeaderV4Fields.TransformRounds, LEDataOutputStream.writeLongBuf(db.numberKeyEncryptionRounds))
+ writeHeaderField(DatabaseHeaderKDBX.PwDbHeaderV4Fields.TransformRounds, longTo8Bytes(databaseKDBX.numberKeyEncryptionRounds))
} else {
- writeHeaderField(DatabaseHeaderKDBX.PwDbHeaderV4Fields.KdfParameters, KdfParameters.serialize(db.kdfParameters!!))
+ writeHeaderField(DatabaseHeaderKDBX.PwDbHeaderV4Fields.KdfParameters, KdfParameters.serialize(databaseKDBX.kdfParameters!!))
}
if (header.encryptionIV.isNotEmpty()) {
@@ -104,13 +104,13 @@ constructor(private val db: DatabaseKDBX, private val header: DatabaseHeaderKDBX
if (header.version < DatabaseHeaderKDBX.FILE_VERSION_32_4) {
writeHeaderField(DatabaseHeaderKDBX.PwDbHeaderV4Fields.InnerRandomstreamKey, header.innerRandomStreamKey)
writeHeaderField(DatabaseHeaderKDBX.PwDbHeaderV4Fields.StreamStartBytes, header.streamStartBytes)
- writeHeaderField(DatabaseHeaderKDBX.PwDbHeaderV4Fields.InnerRandomStreamID, LEDataOutputStream.writeIntBuf(header.innerRandomStream!!.id))
+ writeHeaderField(DatabaseHeaderKDBX.PwDbHeaderV4Fields.InnerRandomStreamID, intTo4Bytes(header.innerRandomStream!!.id))
}
- if (db.containsPublicCustomData()) {
+ if (databaseKDBX.containsPublicCustomData()) {
val bos = ByteArrayOutputStream()
- val los = LEDataOutputStream(bos)
- VariantDictionary.serialize(db.publicCustomData, los)
+ val los = LittleEndianDataOutputStream(bos)
+ VariantDictionary.serialize(databaseKDBX.publicCustomData, los)
writeHeaderField(DatabaseHeaderKDBX.PwDbHeaderV4Fields.PublicCustomData, bos.toByteArray())
}
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/file/output/DatabaseInnerHeaderOutputKDBX.kt b/app/src/main/java/com/kunzisoft/keepass/database/file/output/DatabaseInnerHeaderOutputKDBX.kt
index 02990a065..c87289252 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/file/output/DatabaseInnerHeaderOutputKDBX.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/file/output/DatabaseInnerHeaderOutputKDBX.kt
@@ -1,7 +1,7 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
* KeePassDroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,9 +22,8 @@ package com.kunzisoft.keepass.database.file.output
import com.kunzisoft.keepass.database.element.database.DatabaseKDBX
import com.kunzisoft.keepass.database.element.database.DatabaseKDBX.Companion.BUFFER_SIZE_BYTES
import com.kunzisoft.keepass.database.file.DatabaseHeaderKDBX
-import com.kunzisoft.keepass.stream.ReadBytes
-import com.kunzisoft.keepass.stream.LEDataOutputStream
-import com.kunzisoft.keepass.stream.readFromStream
+import com.kunzisoft.keepass.stream.LittleEndianDataOutputStream
+import com.kunzisoft.keepass.stream.readBytes
import java.io.IOException
import java.io.OutputStream
import kotlin.experimental.or
@@ -33,7 +32,7 @@ class DatabaseInnerHeaderOutputKDBX(private val database: DatabaseKDBX,
private val header: DatabaseHeaderKDBX,
outputStream: OutputStream) {
- private val dataOutputStream: LEDataOutputStream = LEDataOutputStream(outputStream)
+ private val dataOutputStream: LittleEndianDataOutputStream = LittleEndianDataOutputStream(outputStream)
@Throws(IOException::class)
fun output() {
@@ -58,13 +57,9 @@ class DatabaseInnerHeaderOutputKDBX(private val database: DatabaseKDBX,
dataOutputStream.writeInt(protectedBinary.length().toInt() + 1) // TODO verify
dataOutputStream.write(flag.toInt())
- readFromStream(protectedBinary.getInputDataStream(), BUFFER_SIZE_BYTES,
- object : ReadBytes {
- override fun read(buffer: ByteArray) {
- dataOutputStream.write(buffer)
- }
- }
- )
+ protectedBinary.getInputDataStream().readBytes(BUFFER_SIZE_BYTES) { buffer ->
+ dataOutputStream.write(buffer)
+ }
}
dataOutputStream.write(DatabaseHeaderKDBX.PwDbInnerHeaderV4Fields.EndOfHeader.toInt())
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/file/output/DatabaseOutput.kt b/app/src/main/java/com/kunzisoft/keepass/database/file/output/DatabaseOutput.kt
index 27f5abdea..4c0951393 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/file/output/DatabaseOutput.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/file/output/DatabaseOutput.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.file.output
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/file/output/DatabaseOutputKDB.kt b/app/src/main/java/com/kunzisoft/keepass/database/file/output/DatabaseOutputKDB.kt
index 6a6a9bd33..80677f24a 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/file/output/DatabaseOutputKDB.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/file/output/DatabaseOutputKDB.kt
@@ -1,20 +1,20 @@
/*
` * Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.file.output
@@ -26,7 +26,7 @@ import com.kunzisoft.keepass.database.element.group.GroupKDB
import com.kunzisoft.keepass.database.exception.DatabaseOutputException
import com.kunzisoft.keepass.database.file.DatabaseHeader
import com.kunzisoft.keepass.database.file.DatabaseHeaderKDB
-import com.kunzisoft.keepass.stream.LEDataOutputStream
+import com.kunzisoft.keepass.stream.LittleEndianDataOutputStream
import com.kunzisoft.keepass.stream.NullOutputStream
import java.io.BufferedOutputStream
import java.io.ByteArrayOutputStream
@@ -128,7 +128,7 @@ class DatabaseOutputKDB(private val mDatabaseKDB: DatabaseKDB,
header.version = DatabaseHeaderKDB.DBVER_DW
header.numGroups = mDatabaseKDB.numberOfGroups()
header.numEntries = mDatabaseKDB.numberOfEntries()
- header.numKeyEncRounds = mDatabaseKDB.numberKeyEncryptionRounds.toInt()
+ header.numKeyEncRounds = mDatabaseKDB.numberKeyEncryptionRounds.toInt() // TODO Signed Long - Unsigned Int
setIVs(header)
@@ -197,7 +197,7 @@ class DatabaseOutputKDB(private val mDatabaseKDB: DatabaseKDB,
@Suppress("CAST_NEVER_SUCCEEDS")
@Throws(DatabaseOutputException::class)
fun outputPlanGroupAndEntries(os: OutputStream) {
- val los = LEDataOutputStream(os)
+ val los = LittleEndianDataOutputStream(os)
// useHeaderHash
if (headerHashBlock != null) {
@@ -261,7 +261,7 @@ class DatabaseOutputKDB(private val mDatabaseKDB: DatabaseKDB,
@Throws(IOException::class)
private fun writeExtData(headerDigest: ByteArray, os: OutputStream) {
- val los = LEDataOutputStream(os)
+ val los = LittleEndianDataOutputStream(os)
writeExtDataField(los, 0x0001, headerDigest, headerDigest.size)
val headerRandom = ByteArray(32)
@@ -273,7 +273,7 @@ class DatabaseOutputKDB(private val mDatabaseKDB: DatabaseKDB,
}
@Throws(IOException::class)
- private fun writeExtDataField(los: LEDataOutputStream, fieldType: Int, data: ByteArray?, fieldSize: Int) {
+ private fun writeExtDataField(los: LittleEndianDataOutputStream, fieldType: Int, data: ByteArray?, fieldSize: Int) {
los.writeUShort(fieldType)
los.writeInt(fieldSize)
if (data != 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 1cdb764f7..c9127047f 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
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.file.output
@@ -28,7 +28,7 @@ import com.kunzisoft.keepass.crypto.StreamCipherFactory
import com.kunzisoft.keepass.crypto.engine.CipherEngine
import com.kunzisoft.keepass.crypto.keyDerivation.KdfFactory
import com.kunzisoft.keepass.database.action.node.NodeHandler
-import com.kunzisoft.keepass.database.element.*
+import com.kunzisoft.keepass.database.element.DeletedObject
import com.kunzisoft.keepass.database.element.database.CompressionAlgorithm
import com.kunzisoft.keepass.database.element.database.DatabaseKDBX
import com.kunzisoft.keepass.database.element.database.DatabaseKDBX.Companion.BASE_64_FLAG
@@ -47,7 +47,6 @@ import com.kunzisoft.keepass.database.file.DatabaseHeaderKDBX
import com.kunzisoft.keepass.database.file.DatabaseKDBXXML
import com.kunzisoft.keepass.database.file.DateKDBXUtil
import com.kunzisoft.keepass.stream.*
-import com.kunzisoft.keepass.utils.DatabaseInputOutputUtils
import org.joda.time.DateTime
import org.spongycastle.crypto.StreamCipher
import org.xmlpull.v1.XmlSerializer
@@ -95,7 +94,8 @@ class DatabaseOutputKDBX(private val mDatabaseKDBX: DatabaseKDBX,
mOS.write(hashOfHeader!!)
mOS.write(headerHmac!!)
- attachStreamEncryptor(header!!, HmacBlockOutputStream(mOS, mDatabaseKDBX.hmacKey))
+
+ attachStreamEncryptor(header!!, HmacBlockOutputStream(mOS, mDatabaseKDBX.hmacKey!!))
}
val osXml: OutputStream
@@ -230,7 +230,7 @@ class DatabaseOutputKDBX(private val mDatabaseKDBX: DatabaseKDBX,
writeUuid(DatabaseKDBXXML.ElemLastTopVisibleGroup, mDatabaseKDBX.lastTopVisibleGroupUUID)
// Seem to work properly if always in meta
- // if (header!!.version < DatabaseHeaderKDBX.FILE_VERSION_32_4)
+ if (header!!.version < DatabaseHeaderKDBX.FILE_VERSION_32_4)
writeMetaBinaries()
writeCustomData(mDatabaseKDBX.customData)
@@ -390,7 +390,7 @@ class DatabaseOutputKDBX(private val mDatabaseKDBX: DatabaseKDBX,
} else {
val dt = DateTime(value)
val seconds = DateKDBXUtil.convertDateToKDBX4Time(dt)
- val buf = LEDataOutputStream.writeLongBuf(seconds)
+ val buf = longTo8Bytes(seconds)
val b64 = String(Base64.encode(buf, BASE_64_FLAG))
writeObject(name, b64)
}
@@ -414,10 +414,47 @@ class DatabaseOutputKDBX(private val mDatabaseKDBX: DatabaseKDBX,
@Throws(IllegalArgumentException::class, IllegalStateException::class, IOException::class)
private fun writeUuid(name: String, uuid: UUID) {
- val data = DatabaseInputOutputUtils.uuidToBytes(uuid)
+ val data = uuidTo16Bytes(uuid)
writeObject(name, String(Base64.encode(data, BASE_64_FLAG)))
}
+ @Throws(IllegalArgumentException::class, IllegalStateException::class, IOException::class)
+ private fun writeBinary(binary : BinaryAttachment) {
+ val binaryLength = binary.length()
+ if (binaryLength > 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)
+ }
+ } else {
+ // Force binary compression from database (compression was harmonized during import)
+ if (mDatabaseKDBX.compressionAlgorithm === CompressionAlgorithm.GZip) {
+ xml.attribute(null, DatabaseKDBXXML.AttrCompressed, DatabaseKDBXXML.ValTrue)
+ }
+
+ // Force decompression in this specific case
+ val binaryInputStream = if (mDatabaseKDBX.compressionAlgorithm == CompressionAlgorithm.None
+ && binary.isCompressed == true) {
+ GZIPInputStream(binary.getInputDataStream())
+ } else {
+ binary.getInputDataStream()
+ }
+
+ // Write the XML
+ binaryInputStream.readBytes(BUFFER_SIZE_BYTES) { buffer ->
+ val charArray = String(Base64.encode(buffer, BASE_64_FLAG)).toCharArray()
+ xml.text(charArray, 0, charArray.size)
+ }
+ }
+ }
+ }
+
@Throws(IllegalArgumentException::class, IllegalStateException::class, IOException::class)
private fun writeMetaBinaries() {
xml.startTag(null, DatabaseKDBXXML.ElemBinaries)
@@ -425,34 +462,7 @@ class DatabaseOutputKDBX(private val mDatabaseKDBX: DatabaseKDBX,
mDatabaseKDBX.binaryPool.doForEachBinary { key, binary ->
xml.startTag(null, DatabaseKDBXXML.ElemBinary)
xml.attribute(null, DatabaseKDBXXML.AttrId, key.toString())
-
- // Force binary compression from database (compression was harmonized during import)
- xml.attribute(null, DatabaseKDBXXML.AttrCompressed,
- if (mDatabaseKDBX.compressionAlgorithm === CompressionAlgorithm.GZip) {
- DatabaseKDBXXML.ValTrue
- } else {
- DatabaseKDBXXML.ValFalse
- }
- )
-
- // Force decompression in this specific case
- val binaryInputStream = if (mDatabaseKDBX.compressionAlgorithm == CompressionAlgorithm.None
- && binary.isCompressed == true) {
- GZIPInputStream(binary.getInputDataStream())
- } else {
- binary.getInputDataStream()
- }
-
- // Write the XML
- readFromStream(binaryInputStream, BUFFER_SIZE_BYTES,
- object : ReadBytes {
- override fun read(buffer: ByteArray) {
- val charArray = String(Base64.encode(buffer, BASE_64_FLAG)).toCharArray()
- xml.text(charArray, 0, charArray.size)
- }
- }
- )
-
+ writeBinary(binary)
xml.endTag(null, DatabaseKDBXXML.ElemBinary)
}
@@ -561,32 +571,7 @@ class DatabaseOutputKDBX(private val mDatabaseKDBX: DatabaseKDBX,
if (ref != null) {
xml.attribute(null, DatabaseKDBXXML.AttrRef, ref.toString())
} else {
- val binaryLength = binary.length()
- if (binaryLength > 0) {
-
- if (binary.isProtected) {
- xml.attribute(null, DatabaseKDBXXML.AttrProtected, DatabaseKDBXXML.ValTrue)
-
- readFromStream(binary.getInputDataStream(), BUFFER_SIZE_BYTES,
- object : ReadBytes {
- override fun read(buffer: ByteArray) {
- 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)
- }
- })
- } else {
- readFromStream(binary.getInputDataStream(), BUFFER_SIZE_BYTES,
- object : ReadBytes {
- override fun read(buffer: ByteArray) {
- val charArray = String(Base64.encode(buffer, BASE_64_FLAG)).toCharArray()
- xml.text(charArray, 0, charArray.size)
- }
- }
- )
- }
- }
+ writeBinary(binary)
}
xml.endTag(null, DatabaseKDBXXML.ElemValue)
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/file/output/EntryOutputKDB.kt b/app/src/main/java/com/kunzisoft/keepass/database/file/output/EntryOutputKDB.kt
index 2429cedaf..c5c99d1c6 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/file/output/EntryOutputKDB.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/file/output/EntryOutputKDB.kt
@@ -1,30 +1,32 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.file.output
+import com.kunzisoft.keepass.database.element.database.DatabaseKDB
import com.kunzisoft.keepass.database.element.entry.EntryKDB
-import com.kunzisoft.keepass.stream.LEDataOutputStream
-import com.kunzisoft.keepass.utils.DatabaseInputOutputUtils
-
+import com.kunzisoft.keepass.database.file.output.GroupOutputKDB.Companion.GROUPID_FIELD_SIZE
+import com.kunzisoft.keepass.stream.*
+import com.kunzisoft.keepass.utils.StringDatabaseKDBUtils
import java.io.IOException
import java.io.OutputStream
+import java.nio.charset.Charset
class EntryOutputKDB
/**
@@ -47,53 +49,76 @@ class EntryOutputKDB
// UUID
mOutputStream.write(UUID_FIELD_TYPE)
mOutputStream.write(UUID_FIELD_SIZE)
- mOutputStream.write(DatabaseInputOutputUtils.uuidToBytes(mEntry.id))
+ mOutputStream.write(uuidTo16Bytes(mEntry.id))
// Group ID
mOutputStream.write(GROUPID_FIELD_TYPE)
- mOutputStream.write(LONG_FOUR)
- mOutputStream.write(LEDataOutputStream.writeIntBuf(mEntry.parent!!.id))
+ mOutputStream.write(GROUPID_FIELD_SIZE)
+ mOutputStream.write(intTo4Bytes(mEntry.parent!!.id))
// Image ID
mOutputStream.write(IMAGEID_FIELD_TYPE)
- mOutputStream.write(LONG_FOUR)
- mOutputStream.write(LEDataOutputStream.writeIntBuf(mEntry.icon.iconId))
+ mOutputStream.write(IMAGEID_FIELD_SIZE)
+ mOutputStream.write(intTo4Bytes(mEntry.icon.iconId))
// Title
//byte[] title = mEntry.title.getBytes("UTF-8");
mOutputStream.write(TITLE_FIELD_TYPE)
- length += DatabaseInputOutputUtils.writeCString(mEntry.title, mOutputStream).toLong()
+ length += StringDatabaseKDBUtils.writeStringToBytes(mEntry.title, mOutputStream).toLong()
// URL
mOutputStream.write(URL_FIELD_TYPE)
- length += DatabaseInputOutputUtils.writeCString(mEntry.url, mOutputStream).toLong()
+ length += StringDatabaseKDBUtils.writeStringToBytes(mEntry.url, mOutputStream).toLong()
// Username
mOutputStream.write(USERNAME_FIELD_TYPE)
- length += DatabaseInputOutputUtils.writeCString(mEntry.username, mOutputStream).toLong()
+ length += StringDatabaseKDBUtils.writeStringToBytes(mEntry.username, mOutputStream).toLong()
// Password
mOutputStream.write(PASSWORD_FIELD_TYPE)
- length += DatabaseInputOutputUtils.writePassword(mEntry.password, mOutputStream).toLong()
+ length += writePassword(mEntry.password, mOutputStream).toLong()
// Additional
mOutputStream.write(ADDITIONAL_FIELD_TYPE)
- length += DatabaseInputOutputUtils.writeCString(mEntry.notes, mOutputStream).toLong()
+ length += StringDatabaseKDBUtils.writeStringToBytes(mEntry.notes, mOutputStream).toLong()
// Create date
- writeDate(CREATE_FIELD_TYPE, DatabaseInputOutputUtils.writeCDate(mEntry.creationTime.date))
+ writeDate(CREATE_FIELD_TYPE, dateTo5Bytes(mEntry.creationTime.date))
// Modification date
- writeDate(MOD_FIELD_TYPE, DatabaseInputOutputUtils.writeCDate(mEntry.lastModificationTime.date))
+ writeDate(MOD_FIELD_TYPE, dateTo5Bytes(mEntry.lastModificationTime.date))
// Access date
- writeDate(ACCESS_FIELD_TYPE, DatabaseInputOutputUtils.writeCDate(mEntry.lastAccessTime.date))
+ writeDate(ACCESS_FIELD_TYPE, dateTo5Bytes(mEntry.lastAccessTime.date))
// Expiration date
- writeDate(EXPIRE_FIELD_TYPE, DatabaseInputOutputUtils.writeCDate(mEntry.expiryTime.date))
+ writeDate(EXPIRE_FIELD_TYPE, dateTo5Bytes(mEntry.expiryTime.date))
+
+ // Binary description
+ mOutputStream.write(BINARY_DESC_FIELD_TYPE)
+ length += StringDatabaseKDBUtils.writeStringToBytes(mEntry.binaryDescription, mOutputStream).toLong()
// Binary
- writeBinary(mEntry.binaryData)
+ mOutputStream.write(BINARY_DATA_FIELD_TYPE)
+ val binaryData = mEntry.binaryData
+ val binaryDataLength = binaryData?.length() ?: 0
+ val binaryDataLengthRightSize = if (binaryDataLength <= Int.MAX_VALUE) {
+ binaryDataLength.toInt()
+ } else {
+ 0 // TODO if length > UInt.maxvalue show exception
+ }
+ // Write data length
+ mOutputStream.write(intTo4Bytes(binaryDataLengthRightSize))
+ // Write data
+ if (binaryDataLength > 0) {
+ binaryData?.getInputDataStream().use { inputStream ->
+ inputStream?.readBytes(DatabaseKDB.BUFFER_SIZE_BYTES) { buffer ->
+ length += buffer.size
+ mOutputStream.write(buffer)
+ }
+ inputStream?.close()
+ }
+ }
// End
mOutputStream.write(END_FIELD_TYPE)
@@ -112,39 +137,40 @@ class EntryOutputKDB
}
@Throws(IOException::class)
- private fun writeBinary(data: ByteArray?) {
- mOutputStream.write(BINARY_DESC_FIELD_TYPE)
- length += DatabaseInputOutputUtils.writeCString(mEntry.binaryDesc, mOutputStream).toLong()
-
- val dataLen: Int = data?.size ?: 0
- mOutputStream.write(BINARY_DATA_FIELD_TYPE)
- length += DatabaseInputOutputUtils.writeBytes(data, dataLen, mOutputStream)
+ private fun writePassword(str: String, os: OutputStream): Int {
+ val initial = str.toByteArray(Charset.forName("UTF-8"))
+ val length = initial.size + 1
+ os.write(intTo4Bytes(length))
+ os.write(initial)
+ os.write(0x00)
+ return length
}
companion object {
// Constants
- val UUID_FIELD_TYPE:ByteArray = LEDataOutputStream.writeUShortBuf(1)
- val GROUPID_FIELD_TYPE:ByteArray = LEDataOutputStream.writeUShortBuf(2)
- val IMAGEID_FIELD_TYPE:ByteArray = LEDataOutputStream.writeUShortBuf(3)
- val TITLE_FIELD_TYPE:ByteArray = LEDataOutputStream.writeUShortBuf(4)
- val URL_FIELD_TYPE:ByteArray = LEDataOutputStream.writeUShortBuf(5)
- val USERNAME_FIELD_TYPE:ByteArray = LEDataOutputStream.writeUShortBuf(6)
- val PASSWORD_FIELD_TYPE:ByteArray = LEDataOutputStream.writeUShortBuf(7)
- val ADDITIONAL_FIELD_TYPE:ByteArray = LEDataOutputStream.writeUShortBuf(8)
- val CREATE_FIELD_TYPE:ByteArray = LEDataOutputStream.writeUShortBuf(9)
- val MOD_FIELD_TYPE:ByteArray = LEDataOutputStream.writeUShortBuf(10)
- val ACCESS_FIELD_TYPE:ByteArray = LEDataOutputStream.writeUShortBuf(11)
- val EXPIRE_FIELD_TYPE:ByteArray = LEDataOutputStream.writeUShortBuf(12)
- val BINARY_DESC_FIELD_TYPE:ByteArray = LEDataOutputStream.writeUShortBuf(13)
- val BINARY_DATA_FIELD_TYPE:ByteArray = LEDataOutputStream.writeUShortBuf(14)
- val END_FIELD_TYPE:ByteArray = LEDataOutputStream.writeUShortBuf(0xFFFF)
- val LONG_FOUR:ByteArray = LEDataOutputStream.writeIntBuf(4)
- val UUID_FIELD_SIZE:ByteArray = LEDataOutputStream.writeIntBuf(16)
- val DATE_FIELD_SIZE:ByteArray = LEDataOutputStream.writeIntBuf(5)
- val IMAGEID_FIELD_SIZE:ByteArray = LONG_FOUR
- val LEVEL_FIELD_SIZE:ByteArray = LONG_FOUR
- val FLAGS_FIELD_SIZE:ByteArray = LONG_FOUR
- val ZERO_FIELD_SIZE:ByteArray = LEDataOutputStream.writeIntBuf(0)
+ val UUID_FIELD_TYPE:ByteArray = uShortTo2Bytes(1)
+ val GROUPID_FIELD_TYPE:ByteArray = uShortTo2Bytes(2)
+ val IMAGEID_FIELD_TYPE:ByteArray = uShortTo2Bytes(3)
+ val TITLE_FIELD_TYPE:ByteArray = uShortTo2Bytes(4)
+ val URL_FIELD_TYPE:ByteArray = uShortTo2Bytes(5)
+ val USERNAME_FIELD_TYPE:ByteArray = uShortTo2Bytes(6)
+ val PASSWORD_FIELD_TYPE:ByteArray = uShortTo2Bytes(7)
+ val ADDITIONAL_FIELD_TYPE:ByteArray = uShortTo2Bytes(8)
+ val CREATE_FIELD_TYPE:ByteArray = uShortTo2Bytes(9)
+ val MOD_FIELD_TYPE:ByteArray = uShortTo2Bytes(10)
+ val ACCESS_FIELD_TYPE:ByteArray = uShortTo2Bytes(11)
+ val EXPIRE_FIELD_TYPE:ByteArray = uShortTo2Bytes(12)
+ val BINARY_DESC_FIELD_TYPE:ByteArray = uShortTo2Bytes(13)
+ val BINARY_DATA_FIELD_TYPE:ByteArray = uShortTo2Bytes(14)
+ val END_FIELD_TYPE:ByteArray = uShortTo2Bytes(0xFFFF)
+
+ val LONG_FOUR:ByteArray = intTo4Bytes(4)
+ val UUID_FIELD_SIZE:ByteArray = intTo4Bytes(16)
+ val DATE_FIELD_SIZE:ByteArray = intTo4Bytes(5)
+ val IMAGEID_FIELD_SIZE:ByteArray = intTo4Bytes(4)
+ val LEVEL_FIELD_SIZE:ByteArray = intTo4Bytes(4)
+ val FLAGS_FIELD_SIZE:ByteArray = intTo4Bytes(4)
+ val ZERO_FIELD_SIZE:ByteArray = intTo4Bytes(0)
val ZERO_FIVE:ByteArray = byteArrayOf(0x00, 0x00, 0x00, 0x00, 0x00)
}
}
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/file/output/GroupOutputKDB.kt b/app/src/main/java/com/kunzisoft/keepass/database/file/output/GroupOutputKDB.kt
index 34c488bf0..b0b054e47 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/file/output/GroupOutputKDB.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/file/output/GroupOutputKDB.kt
@@ -1,28 +1,29 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.file.output
import com.kunzisoft.keepass.database.element.group.GroupKDB
-import com.kunzisoft.keepass.stream.LEDataOutputStream
-import com.kunzisoft.keepass.utils.DatabaseInputOutputUtils
-
+import com.kunzisoft.keepass.stream.dateTo5Bytes
+import com.kunzisoft.keepass.stream.intTo4Bytes
+import com.kunzisoft.keepass.stream.uShortTo2Bytes
+import com.kunzisoft.keepass.utils.StringDatabaseKDBUtils
import java.io.IOException
import java.io.OutputStream
@@ -38,46 +39,46 @@ class GroupOutputKDB (private val mGroup: GroupKDB, private val mOutputStream: O
// Group ID
mOutputStream.write(GROUPID_FIELD_TYPE)
mOutputStream.write(GROUPID_FIELD_SIZE)
- mOutputStream.write(LEDataOutputStream.writeIntBuf(mGroup.id))
+ mOutputStream.write(intTo4Bytes(mGroup.id))
// Name
mOutputStream.write(NAME_FIELD_TYPE)
- DatabaseInputOutputUtils.writeCString(mGroup.title, mOutputStream)
+ StringDatabaseKDBUtils.writeStringToBytes(mGroup.title, mOutputStream)
// Create date
mOutputStream.write(CREATE_FIELD_TYPE)
mOutputStream.write(DATE_FIELD_SIZE)
- mOutputStream.write(DatabaseInputOutputUtils.writeCDate(mGroup.creationTime.date))
+ mOutputStream.write(dateTo5Bytes(mGroup.creationTime.date))
// Modification date
mOutputStream.write(MOD_FIELD_TYPE)
mOutputStream.write(DATE_FIELD_SIZE)
- mOutputStream.write(DatabaseInputOutputUtils.writeCDate(mGroup.lastModificationTime.date))
+ mOutputStream.write(dateTo5Bytes(mGroup.lastModificationTime.date))
// Access date
mOutputStream.write(ACCESS_FIELD_TYPE)
mOutputStream.write(DATE_FIELD_SIZE)
- mOutputStream.write(DatabaseInputOutputUtils.writeCDate(mGroup.lastAccessTime.date))
+ mOutputStream.write(dateTo5Bytes(mGroup.lastAccessTime.date))
// Expiration date
mOutputStream.write(EXPIRE_FIELD_TYPE)
mOutputStream.write(DATE_FIELD_SIZE)
- mOutputStream.write(DatabaseInputOutputUtils.writeCDate(mGroup.expiryTime.date))
+ mOutputStream.write(dateTo5Bytes(mGroup.expiryTime.date))
// Image ID
mOutputStream.write(IMAGEID_FIELD_TYPE)
mOutputStream.write(IMAGEID_FIELD_SIZE)
- mOutputStream.write(LEDataOutputStream.writeIntBuf(mGroup.icon.iconId))
+ mOutputStream.write(intTo4Bytes(mGroup.icon.iconId))
// Level
mOutputStream.write(LEVEL_FIELD_TYPE)
mOutputStream.write(LEVEL_FIELD_SIZE)
- mOutputStream.write(LEDataOutputStream.writeUShortBuf(mGroup.level))
+ mOutputStream.write(uShortTo2Bytes(mGroup.level))
// Flags
mOutputStream.write(FLAGS_FIELD_TYPE)
mOutputStream.write(FLAGS_FIELD_SIZE)
- mOutputStream.write(LEDataOutputStream.writeIntBuf(mGroup.flags))
+ mOutputStream.write(intTo4Bytes(mGroup.flags))
// End
mOutputStream.write(END_FIELD_TYPE)
@@ -86,23 +87,22 @@ class GroupOutputKDB (private val mGroup: GroupKDB, private val mOutputStream: O
companion object {
// Constants
- val GROUPID_FIELD_TYPE: ByteArray = LEDataOutputStream.writeUShortBuf(1)
- val NAME_FIELD_TYPE:ByteArray = LEDataOutputStream.writeUShortBuf(2)
- val CREATE_FIELD_TYPE:ByteArray = LEDataOutputStream.writeUShortBuf(3)
- val MOD_FIELD_TYPE:ByteArray = LEDataOutputStream.writeUShortBuf(4)
- val ACCESS_FIELD_TYPE:ByteArray = LEDataOutputStream.writeUShortBuf(5)
- val EXPIRE_FIELD_TYPE:ByteArray = LEDataOutputStream.writeUShortBuf(6)
- val IMAGEID_FIELD_TYPE:ByteArray = LEDataOutputStream.writeUShortBuf(7)
- val LEVEL_FIELD_TYPE:ByteArray = LEDataOutputStream.writeUShortBuf(8)
- val FLAGS_FIELD_TYPE:ByteArray = LEDataOutputStream.writeUShortBuf(9)
- val END_FIELD_TYPE:ByteArray = LEDataOutputStream.writeUShortBuf(0xFFFF)
- val LONG_FOUR:ByteArray = LEDataOutputStream.writeIntBuf(4)
- val GROUPID_FIELD_SIZE:ByteArray = LONG_FOUR
- val DATE_FIELD_SIZE:ByteArray = LEDataOutputStream.writeIntBuf(5)
- val IMAGEID_FIELD_SIZE:ByteArray = LONG_FOUR
- val LEVEL_FIELD_SIZE:ByteArray = LEDataOutputStream.writeIntBuf(2)
- val FLAGS_FIELD_SIZE:ByteArray = LONG_FOUR
- val ZERO_FIELD_SIZE:ByteArray = LEDataOutputStream.writeIntBuf(0)
- }
+ val GROUPID_FIELD_TYPE: ByteArray = uShortTo2Bytes(1)
+ val NAME_FIELD_TYPE:ByteArray = uShortTo2Bytes(2)
+ val CREATE_FIELD_TYPE:ByteArray = uShortTo2Bytes(3)
+ val MOD_FIELD_TYPE:ByteArray = uShortTo2Bytes(4)
+ val ACCESS_FIELD_TYPE:ByteArray = uShortTo2Bytes(5)
+ val EXPIRE_FIELD_TYPE:ByteArray = uShortTo2Bytes(6)
+ val IMAGEID_FIELD_TYPE:ByteArray = uShortTo2Bytes(7)
+ val LEVEL_FIELD_TYPE:ByteArray = uShortTo2Bytes(8)
+ val FLAGS_FIELD_TYPE:ByteArray = uShortTo2Bytes(9)
+ val END_FIELD_TYPE:ByteArray = uShortTo2Bytes(0xFFFF)
+ val GROUPID_FIELD_SIZE:ByteArray = intTo4Bytes(4)
+ val DATE_FIELD_SIZE:ByteArray = intTo4Bytes(5)
+ val IMAGEID_FIELD_SIZE:ByteArray = intTo4Bytes(4)
+ val LEVEL_FIELD_SIZE:ByteArray = intTo4Bytes(2)
+ val FLAGS_FIELD_SIZE:ByteArray = intTo4Bytes(4)
+ val ZERO_FIELD_SIZE:ByteArray = intTo4Bytes(0)
+ }
}
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/search/EntryKDBXSearchHandler.kt b/app/src/main/java/com/kunzisoft/keepass/database/search/EntryKDBXSearchHandler.kt
index 6fbf3ffb0..ce851b195 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/search/EntryKDBXSearchHandler.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/search/EntryKDBXSearchHandler.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.search
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/search/SearchHelper.kt b/app/src/main/java/com/kunzisoft/keepass/database/search/SearchHelper.kt
index 881e701ad..929df37cb 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/search/SearchHelper.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/search/SearchHelper.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.search
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/search/SearchParameters.kt b/app/src/main/java/com/kunzisoft/keepass/database/search/SearchParameters.kt
index 361bedc11..f003e56cc 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/search/SearchParameters.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/search/SearchParameters.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.search
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/search/SearchParametersKDBX.kt b/app/src/main/java/com/kunzisoft/keepass/database/search/SearchParametersKDBX.kt
index c3dac8cd6..dae9c7716 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/search/SearchParametersKDBX.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/search/SearchParametersKDBX.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.search
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/search/UuidUtil.java b/app/src/main/java/com/kunzisoft/keepass/database/search/UuidUtil.java
index b3119ca01..325618cae 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/search/UuidUtil.java
+++ b/app/src/main/java/com/kunzisoft/keepass/database/search/UuidUtil.java
@@ -1,34 +1,34 @@
/*
- * Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.search;
-import com.kunzisoft.keepass.utils.DatabaseInputOutputUtils;
-
import java.util.UUID;
+import static com.kunzisoft.keepass.stream.StreamBytesUtilsKt.uuidTo16Bytes;
+
public class UuidUtil {
public static String toHexString(UUID uuid) {
if (uuid == null) { return null; }
- byte[] buf = DatabaseInputOutputUtils.INSTANCE.uuidToBytes(uuid);
+ byte[] buf = uuidTo16Bytes(uuid);
int len = buf.length;
if (len == 0) { return ""; }
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/search/iterator/EntrySearchStringIterator.kt b/app/src/main/java/com/kunzisoft/keepass/database/search/iterator/EntrySearchStringIterator.kt
index d98d5a65e..62435b552 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/search/iterator/EntrySearchStringIterator.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/search/iterator/EntrySearchStringIterator.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.search.iterator
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/search/iterator/EntrySearchStringIteratorKDB.kt b/app/src/main/java/com/kunzisoft/keepass/database/search/iterator/EntrySearchStringIteratorKDB.kt
index 7fcc2c4e2..7510e4b73 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/search/iterator/EntrySearchStringIteratorKDB.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/search/iterator/EntrySearchStringIteratorKDB.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.search.iterator
diff --git a/app/src/main/java/com/kunzisoft/keepass/database/search/iterator/EntrySearchStringIteratorKDBX.kt b/app/src/main/java/com/kunzisoft/keepass/database/search/iterator/EntrySearchStringIteratorKDBX.kt
index 0b0896308..3f10975fa 100644
--- a/app/src/main/java/com/kunzisoft/keepass/database/search/iterator/EntrySearchStringIteratorKDBX.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/database/search/iterator/EntrySearchStringIteratorKDBX.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.database.search.iterator
diff --git a/app/src/main/java/com/kunzisoft/keepass/education/Education.kt b/app/src/main/java/com/kunzisoft/keepass/education/Education.kt
index ba4f3d35b..63cbe7211 100644
--- a/app/src/main/java/com/kunzisoft/keepass/education/Education.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/education/Education.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.education
import android.app.Activity
diff --git a/app/src/main/java/com/kunzisoft/keepass/education/EntryActivityEducation.kt b/app/src/main/java/com/kunzisoft/keepass/education/EntryActivityEducation.kt
index 853e8b0e6..728f1967d 100644
--- a/app/src/main/java/com/kunzisoft/keepass/education/EntryActivityEducation.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/education/EntryActivityEducation.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.education
import android.app.Activity
diff --git a/app/src/main/java/com/kunzisoft/keepass/education/EntryEditActivityEducation.kt b/app/src/main/java/com/kunzisoft/keepass/education/EntryEditActivityEducation.kt
index ad4190a7f..c6f77a47e 100644
--- a/app/src/main/java/com/kunzisoft/keepass/education/EntryEditActivityEducation.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/education/EntryEditActivityEducation.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.education
import android.app.Activity
diff --git a/app/src/main/java/com/kunzisoft/keepass/education/FileDatabaseSelectActivityEducation.kt b/app/src/main/java/com/kunzisoft/keepass/education/FileDatabaseSelectActivityEducation.kt
index 00d759d72..686a74d17 100644
--- a/app/src/main/java/com/kunzisoft/keepass/education/FileDatabaseSelectActivityEducation.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/education/FileDatabaseSelectActivityEducation.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.education
import android.app.Activity
diff --git a/app/src/main/java/com/kunzisoft/keepass/education/GroupActivityEducation.kt b/app/src/main/java/com/kunzisoft/keepass/education/GroupActivityEducation.kt
index e4cde8545..cb7d414e6 100644
--- a/app/src/main/java/com/kunzisoft/keepass/education/GroupActivityEducation.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/education/GroupActivityEducation.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.education
import android.app.Activity
diff --git a/app/src/main/java/com/kunzisoft/keepass/education/PasswordActivityEducation.kt b/app/src/main/java/com/kunzisoft/keepass/education/PasswordActivityEducation.kt
index 2b1fdcd6f..e74303fbf 100644
--- a/app/src/main/java/com/kunzisoft/keepass/education/PasswordActivityEducation.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/education/PasswordActivityEducation.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.education
import android.app.Activity
diff --git a/app/src/main/java/com/kunzisoft/keepass/icons/IconDrawableFactory.kt b/app/src/main/java/com/kunzisoft/keepass/icons/IconDrawableFactory.kt
index 0bdb44f14..d8a696e98 100644
--- a/app/src/main/java/com/kunzisoft/keepass/icons/IconDrawableFactory.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/icons/IconDrawableFactory.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.icons
diff --git a/app/src/main/java/com/kunzisoft/keepass/icons/IconPack.kt b/app/src/main/java/com/kunzisoft/keepass/icons/IconPack.kt
index 3018c7d92..997777188 100644
--- a/app/src/main/java/com/kunzisoft/keepass/icons/IconPack.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/icons/IconPack.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.icons
diff --git a/app/src/main/java/com/kunzisoft/keepass/icons/IconPackChooser.kt b/app/src/main/java/com/kunzisoft/keepass/icons/IconPackChooser.kt
index 73d8579cb..f38321554 100644
--- a/app/src/main/java/com/kunzisoft/keepass/icons/IconPackChooser.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/icons/IconPackChooser.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2018 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.icons
diff --git a/app/src/main/java/com/kunzisoft/keepass/magikeyboard/KeyboardLauncherActivity.kt b/app/src/main/java/com/kunzisoft/keepass/magikeyboard/KeyboardLauncherActivity.kt
index 2828960a2..ce52e0b06 100644
--- a/app/src/main/java/com/kunzisoft/keepass/magikeyboard/KeyboardLauncherActivity.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/magikeyboard/KeyboardLauncherActivity.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.magikeyboard
import android.os.Bundle
diff --git a/app/src/main/java/com/kunzisoft/keepass/magikeyboard/MagikIME.kt b/app/src/main/java/com/kunzisoft/keepass/magikeyboard/MagikIME.kt
index 83690fdf9..177489855 100644
--- a/app/src/main/java/com/kunzisoft/keepass/magikeyboard/MagikIME.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/magikeyboard/MagikIME.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.magikeyboard
@@ -90,17 +90,10 @@ class MagikIME : InputMethodService(), KeyboardView.OnKeyboardActionListener {
keyboard = Keyboard(this, R.xml.keyboard_password)
keyboardEntry = Keyboard(this, R.xml.keyboard_password_entry)
- if (!Database.getInstance().loaded)
- removeEntryInfo()
- assignKeyboardView()
- keyboardView?.setOnKeyboardActionListener(this)
- keyboardView?.isPreviewEnabled = false
-
val context = baseContext
val popupFieldsView = LayoutInflater.from(context)
.inflate(R.layout.keyboard_popup_fields, FrameLayout(context))
- dismissCustomKeys()
popupCustomKeys = PopupWindow(context).apply {
width = WindowManager.LayoutParams.WRAP_CONTENT
height = WindowManager.LayoutParams.WRAP_CONTENT
@@ -114,6 +107,7 @@ class MagikIME : InputMethodService(), KeyboardView.OnKeyboardActionListener {
fieldsAdapter?.onItemClickListener = object : FieldsAdapter.OnItemClickListener {
override fun onItemClick(item: Field) {
currentInputConnection.commitText(entryInfoKey?.getGeneratedFieldValue(item.name) , 1)
+ goNextAutomatically()
}
}
recyclerView.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(this, androidx.recyclerview.widget.LinearLayoutManager.HORIZONTAL, true)
@@ -122,6 +116,12 @@ class MagikIME : InputMethodService(), KeyboardView.OnKeyboardActionListener {
val closeView = popupFieldsView.findViewById(R.id.keyboard_popup_close)
closeView.setOnClickListener { popupCustomKeys?.dismiss() }
+ if (!Database.getInstance().loaded)
+ removeEntryInfo()
+ assignKeyboardView()
+ keyboardView?.setOnKeyboardActionListener(this)
+ keyboardView?.isPreviewEnabled = false
+
return rootKeyboardView
}
@@ -235,31 +235,41 @@ class MagikIME : InputMethodService(), KeyboardView.OnKeyboardActionListener {
}
KEY_USERNAME -> {
if (entryInfoKey != null) {
- inputConnection.commitText(entryInfoKey!!.username, 1)
+ currentInputConnection.commitText(entryInfoKey!!.username, 1)
}
+ goNextAutomatically()
}
KEY_PASSWORD -> {
if (entryInfoKey != null) {
- inputConnection.commitText(entryInfoKey!!.password, 1)
+ currentInputConnection.commitText(entryInfoKey!!.password, 1)
}
+ goNextAutomatically()
}
KEY_URL -> {
if (entryInfoKey != null) {
- inputConnection.commitText(entryInfoKey!!.url, 1)
+ currentInputConnection.commitText(entryInfoKey!!.url, 1)
}
+ goNextAutomatically()
}
KEY_FIELDS -> {
if (entryInfoKey != null) {
- fieldsAdapter?.fields = entryInfoKey!!.customFields
- fieldsAdapter?.notifyDataSetChanged()
+ fieldsAdapter?.apply {
+ setFields(entryInfoKey!!.customFields)
+ notifyDataSetChanged()
+ }
}
popupCustomKeys?.showAtLocation(keyboardView, Gravity.END or Gravity.TOP, 0, 0)
}
Keyboard.KEYCODE_DELETE -> inputConnection.deleteSurroundingText(1, 0)
- Keyboard.KEYCODE_DONE -> inputConnection.sendKeyEvent(KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER))
+ Keyboard.KEYCODE_DONE -> inputConnection.performEditorAction(EditorInfo.IME_ACTION_GO)
}// TODO Unlock key
}
+ private fun goNextAutomatically() {
+ if (PreferencesUtil.isAutoGoActionEnable(this))
+ currentInputConnection.performEditorAction(EditorInfo.IME_ACTION_GO)
+ }
+
override fun onPress(primaryCode: Int) {
val audioManager = getSystemService(Context.AUDIO_SERVICE) as AudioManager?
if (audioManager != null)
diff --git a/app/src/main/java/com/kunzisoft/keepass/model/EntryAttachment.kt b/app/src/main/java/com/kunzisoft/keepass/model/EntryAttachment.kt
new file mode 100644
index 000000000..7b3b2833f
--- /dev/null
+++ b/app/src/main/java/com/kunzisoft/keepass/model/EntryAttachment.kt
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
+package com.kunzisoft.keepass.model
+
+import android.os.Parcel
+import android.os.Parcelable
+import com.kunzisoft.keepass.database.element.security.BinaryAttachment
+import com.kunzisoft.keepass.utils.readEnum
+import com.kunzisoft.keepass.utils.writeEnum
+
+data class EntryAttachment(var name: String,
+ var binaryAttachment: BinaryAttachment,
+ var downloadState: AttachmentState = AttachmentState.NULL,
+ var downloadProgression: Int = 0) : Parcelable {
+
+ constructor(parcel: Parcel) : this(
+ parcel.readString() ?: "",
+ parcel.readParcelable(BinaryAttachment::class.java.classLoader) ?: BinaryAttachment(),
+ parcel.readEnum() ?: AttachmentState.NULL,
+ parcel.readInt())
+
+ override fun writeToParcel(parcel: Parcel, flags: Int) {
+ parcel.writeString(name)
+ parcel.writeParcelable(binaryAttachment, flags)
+ parcel.writeEnum(downloadState)
+ parcel.writeInt(downloadProgression)
+ }
+
+ override fun describeContents(): Int {
+ return 0
+ }
+
+ companion object CREATOR : Parcelable.Creator {
+ override fun createFromParcel(parcel: Parcel): EntryAttachment {
+ return EntryAttachment(parcel)
+ }
+
+ override fun newArray(size: Int): Array {
+ return arrayOfNulls(size)
+ }
+ }
+}
+
+enum class AttachmentState {
+ NULL, START, IN_PROGRESS, COMPLETE, ERROR
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/kunzisoft/keepass/model/EntryInfo.kt b/app/src/main/java/com/kunzisoft/keepass/model/EntryInfo.kt
index 26866973e..b33fd5326 100644
--- a/app/src/main/java/com/kunzisoft/keepass/model/EntryInfo.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/model/EntryInfo.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.model
import android.os.Parcel
diff --git a/app/src/main/java/com/kunzisoft/keepass/model/Field.kt b/app/src/main/java/com/kunzisoft/keepass/model/Field.kt
index 9695db421..edf8c0950 100644
--- a/app/src/main/java/com/kunzisoft/keepass/model/Field.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/model/Field.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.model
import android.os.Parcel
diff --git a/app/src/main/java/com/kunzisoft/keepass/model/OtpModel.kt b/app/src/main/java/com/kunzisoft/keepass/model/OtpModel.kt
index b5cf65274..106375784 100644
--- a/app/src/main/java/com/kunzisoft/keepass/model/OtpModel.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/model/OtpModel.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.model
import android.os.Parcel
diff --git a/app/src/main/java/com/kunzisoft/keepass/notifications/AttachmentFileNotificationService.kt b/app/src/main/java/com/kunzisoft/keepass/notifications/AttachmentFileNotificationService.kt
new file mode 100644
index 000000000..97fd1860b
--- /dev/null
+++ b/app/src/main/java/com/kunzisoft/keepass/notifications/AttachmentFileNotificationService.kt
@@ -0,0 +1,233 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
+package com.kunzisoft.keepass.notifications
+
+import android.app.PendingIntent
+import android.content.Intent
+import android.net.Uri
+import android.os.Binder
+import android.os.IBinder
+import android.util.Log
+import androidx.documentfile.provider.DocumentFile
+import com.kunzisoft.keepass.R
+import com.kunzisoft.keepass.model.AttachmentState
+import com.kunzisoft.keepass.model.EntryAttachment
+import com.kunzisoft.keepass.tasks.AttachmentFileAsyncTask
+import java.util.*
+import kotlin.collections.HashMap
+
+
+class AttachmentFileNotificationService: LockNotificationService() {
+
+ override val notificationId: Int = 10000
+
+ private var mActionTaskBinder = ActionTaskBinder()
+ private var mActionTaskListeners = LinkedList()
+
+ inner class ActionTaskBinder: Binder() {
+
+ fun getService(): AttachmentFileNotificationService = this@AttachmentFileNotificationService
+
+ fun addActionTaskListener(actionTaskListener: ActionTaskListener) {
+ mActionTaskListeners.add(actionTaskListener)
+
+ downloadFileUris.forEach(object : (Map.Entry) -> Unit {
+ override fun invoke(entry: Map.Entry) {
+ entry.value.attachmentTask?.onUpdate = { uri, attachment, notificationIdAttach ->
+ newNotification(uri, attachment, notificationIdAttach)
+ mActionTaskListeners.forEach { actionListener ->
+ actionListener.onAttachmentProgress(entry.key, attachment)
+ }
+ }
+ }
+ })
+
+ }
+
+ fun removeActionTaskListener(actionTaskListener: ActionTaskListener) {
+ downloadFileUris.forEach(object : (Map.Entry) -> Unit {
+ override fun invoke(entry: Map.Entry) {
+ entry.value.attachmentTask?.onUpdate = null
+ }
+ })
+
+ mActionTaskListeners.remove(actionTaskListener)
+ }
+ }
+
+ interface ActionTaskListener {
+ fun onAttachmentProgress(fileUri: Uri, attachment: EntryAttachment)
+ }
+
+ override fun onBind(intent: Intent): IBinder? {
+ return mActionTaskBinder
+ }
+
+ override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
+
+ val downloadFileUri: Uri? = if (intent?.hasExtra(DOWNLOAD_FILE_URI_KEY) == true) {
+ intent.getParcelableExtra(DOWNLOAD_FILE_URI_KEY)
+ } else null
+
+ when(intent?.action) {
+ ACTION_ATTACHMENT_FILE_START_DOWNLOAD -> {
+ if (downloadFileUri != null
+ && intent.hasExtra(ATTACHMENT_KEY)) {
+
+ val nextNotificationId = (downloadFileUris.values.maxBy { it.notificationId }
+ ?.notificationId ?: notificationId) + 1
+
+ val entryAttachment: EntryAttachment = intent.getParcelableExtra(ATTACHMENT_KEY)
+ val attachmentNotification = AttachmentNotification(nextNotificationId, entryAttachment)
+ downloadFileUris[downloadFileUri] = attachmentNotification
+ try {
+ AttachmentFileAsyncTask(downloadFileUri,
+ attachmentNotification,
+ contentResolver).apply {
+ onUpdate = { uri, attachment, notificationIdAttach ->
+ newNotification(uri, attachment, notificationIdAttach)
+ mActionTaskListeners.forEach { actionListener ->
+ actionListener.onAttachmentProgress(downloadFileUri, attachment)
+ }
+ }
+ }.execute()
+ } catch (e: Exception) {
+ Log.e(TAG, "Unable to download $downloadFileUri", e)
+ }
+ }
+ }
+ else -> {
+ if (downloadFileUri != null) {
+ downloadFileUris[downloadFileUri]?.notificationId?.let {
+ notificationManager?.cancel(it)
+ downloadFileUris.remove(downloadFileUri)
+ }
+ }
+ if (downloadFileUris.isEmpty()) {
+ stopSelf()
+ }
+ }
+ }
+
+ return START_REDELIVER_INTENT
+ }
+
+ fun checkCurrentAttachmentProgress() {
+ downloadFileUris.forEach(object : (Map.Entry) -> Unit {
+ override fun invoke(entry: Map.Entry) {
+ mActionTaskListeners.forEach { actionListener ->
+ actionListener.onAttachmentProgress(entry.key, entry.value.entryAttachment)
+ }
+ }
+ })
+ }
+
+ private fun newNotification(downloadFileUri: Uri,
+ entryAttachment: EntryAttachment,
+ notificationIdAttachment: Int) {
+
+ val pendingContentIntent = PendingIntent.getActivity(this,
+ 0,
+ Intent().apply {
+ action = Intent.ACTION_VIEW
+ setDataAndType(downloadFileUri, contentResolver.getType(downloadFileUri))
+ addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
+ }, PendingIntent.FLAG_CANCEL_CURRENT)
+
+ val pendingDeleteIntent = PendingIntent.getService(this,
+ 0,
+ Intent(this, AttachmentFileNotificationService::class.java).apply {
+ // No action to delete the service
+ putExtra(DOWNLOAD_FILE_URI_KEY, downloadFileUri)
+ }, PendingIntent.FLAG_CANCEL_CURRENT)
+
+ val fileName = DocumentFile.fromSingleUri(this, downloadFileUri)?.name ?: ""
+
+ val builder = buildNewNotification().apply {
+ setSmallIcon(R.drawable.ic_file_download_white_24dp)
+ setContentTitle(getString(R.string.download_attachment, fileName))
+ setAutoCancel(false)
+ when (entryAttachment.downloadState) {
+ AttachmentState.NULL, AttachmentState.START -> {
+ setContentText(getString(R.string.download_initialization))
+ setOngoing(true)
+ }
+ AttachmentState.IN_PROGRESS -> {
+ if (entryAttachment.downloadProgression > 100) {
+ setContentText(getString(R.string.download_finalization))
+ } else {
+ setProgress(100, entryAttachment.downloadProgression, false)
+ setContentText(getString(R.string.download_progression, entryAttachment.downloadProgression))
+ }
+ setOngoing(true)
+ }
+ AttachmentState.COMPLETE, AttachmentState.ERROR -> {
+ setContentText(getString(R.string.download_complete))
+ setContentIntent(pendingContentIntent)
+ setDeleteIntent(pendingDeleteIntent)
+ setOngoing(false)
+ }
+ }
+ }
+ notificationManager?.notify(notificationIdAttachment, builder.build())
+ }
+
+ override fun onDestroy() {
+ downloadFileUris.forEach(object : (Map.Entry) -> Unit {
+ override fun invoke(entry: Map.Entry) {
+ entry.value.attachmentTask?.onUpdate = null
+ notificationManager?.cancel(entry.value.notificationId)
+ }
+ })
+
+ super.onDestroy()
+ }
+
+ data class AttachmentNotification(var notificationId: Int,
+ var entryAttachment: EntryAttachment,
+ var attachmentTask: AttachmentFileAsyncTask? = null) {
+ override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (javaClass != other?.javaClass) return false
+
+ other as AttachmentNotification
+
+ if (notificationId != other.notificationId) return false
+
+ return true
+ }
+
+ override fun hashCode(): Int {
+ return notificationId
+ }
+ }
+
+ companion object {
+ private val TAG = AttachmentFileNotificationService::javaClass.name
+
+ const val ACTION_ATTACHMENT_FILE_START_DOWNLOAD = "ACTION_ATTACHMENT_FILE_START_DOWNLOAD"
+
+ const val DOWNLOAD_FILE_URI_KEY = "DOWNLOAD_FILE_URI_KEY"
+ const val ATTACHMENT_KEY = "ATTACHMENT_KEY"
+
+ private val downloadFileUris = HashMap()
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/kunzisoft/keepass/notifications/ClipboardEntryNotificationField.kt b/app/src/main/java/com/kunzisoft/keepass/notifications/ClipboardEntryNotificationField.kt
index 064c8b4a0..2f4b6e2db 100644
--- a/app/src/main/java/com/kunzisoft/keepass/notifications/ClipboardEntryNotificationField.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/notifications/ClipboardEntryNotificationField.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.notifications
diff --git a/app/src/main/java/com/kunzisoft/keepass/notifications/ClipboardEntryNotificationService.kt b/app/src/main/java/com/kunzisoft/keepass/notifications/ClipboardEntryNotificationService.kt
index 4c20e6b53..4309f58a7 100644
--- a/app/src/main/java/com/kunzisoft/keepass/notifications/ClipboardEntryNotificationService.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/notifications/ClipboardEntryNotificationService.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.notifications
diff --git a/app/src/main/java/com/kunzisoft/keepass/notifications/DatabaseOpenNotificationService.kt b/app/src/main/java/com/kunzisoft/keepass/notifications/DatabaseOpenNotificationService.kt
index 13fd168d4..43b7fb035 100644
--- a/app/src/main/java/com/kunzisoft/keepass/notifications/DatabaseOpenNotificationService.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/notifications/DatabaseOpenNotificationService.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.notifications
import android.app.PendingIntent
diff --git a/app/src/main/java/com/kunzisoft/keepass/notifications/DatabaseTaskNotificationService.kt b/app/src/main/java/com/kunzisoft/keepass/notifications/DatabaseTaskNotificationService.kt
index f727cfa94..28e29acb0 100644
--- a/app/src/main/java/com/kunzisoft/keepass/notifications/DatabaseTaskNotificationService.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/notifications/DatabaseTaskNotificationService.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.notifications
import android.content.Intent
@@ -9,6 +28,8 @@ import android.os.IBinder
import com.kunzisoft.keepass.R
import com.kunzisoft.keepass.app.database.CipherDatabaseEntity
import com.kunzisoft.keepass.database.action.*
+import com.kunzisoft.keepass.database.action.history.DeleteEntryHistoryDatabaseRunnable
+import com.kunzisoft.keepass.database.action.history.RestoreEntryHistoryDatabaseRunnable
import com.kunzisoft.keepass.database.action.node.*
import com.kunzisoft.keepass.database.element.*
import com.kunzisoft.keepass.database.element.node.Node
@@ -107,6 +128,8 @@ class DatabaseTaskNotificationService : NotificationService(), ProgressTaskUpdat
ACTION_DATABASE_COPY_NODES_TASK -> buildDatabaseCopyNodesActionTask(intent)
ACTION_DATABASE_MOVE_NODES_TASK -> buildDatabaseMoveNodesActionTask(intent)
ACTION_DATABASE_DELETE_NODES_TASK -> buildDatabaseDeleteNodesActionTask(intent)
+ ACTION_DATABASE_RESTORE_ENTRY_HISTORY -> buildDatabaseRestoreEntryHistoryActionTask(intent)
+ ACTION_DATABASE_DELETE_ENTRY_HISTORY -> buildDatabaseDeleteEntryHistoryActionTask(intent)
ACTION_DATABASE_UPDATE_COMPRESSION_TASK -> buildDatabaseUpdateCompressionActionTask(intent)
ACTION_DATABASE_UPDATE_NAME_TASK,
ACTION_DATABASE_UPDATE_DESCRIPTION_TASK,
@@ -409,6 +432,42 @@ class DatabaseTaskNotificationService : NotificationService(), ProgressTaskUpdat
}
}
+ private fun buildDatabaseRestoreEntryHistoryActionTask(intent: Intent): ActionRunnable? {
+ return if (intent.hasExtra(ENTRY_ID_KEY)
+ && intent.hasExtra(ENTRY_HISTORY_POSITION_KEY)
+ && intent.hasExtra(SAVE_DATABASE_KEY)
+ ) {
+ val database = Database.getInstance()
+ database.getEntryById(intent.getParcelableExtra(ENTRY_ID_KEY))?.let { mainEntry ->
+ RestoreEntryHistoryDatabaseRunnable(this,
+ database,
+ mainEntry,
+ intent.getIntExtra(ENTRY_HISTORY_POSITION_KEY, -1),
+ intent.getBooleanExtra(SAVE_DATABASE_KEY, false))
+ }
+ } else {
+ null
+ }
+ }
+
+ private fun buildDatabaseDeleteEntryHistoryActionTask(intent: Intent): ActionRunnable? {
+ return if (intent.hasExtra(ENTRY_ID_KEY)
+ && intent.hasExtra(ENTRY_HISTORY_POSITION_KEY)
+ && intent.hasExtra(SAVE_DATABASE_KEY)
+ ) {
+ val database = Database.getInstance()
+ database.getEntryById(intent.getParcelableExtra(ENTRY_ID_KEY))?.let { mainEntry ->
+ DeleteEntryHistoryDatabaseRunnable(this,
+ database,
+ mainEntry,
+ intent.getIntExtra(ENTRY_HISTORY_POSITION_KEY, -1),
+ intent.getBooleanExtra(SAVE_DATABASE_KEY, false))
+ }
+ } else {
+ null
+ }
+ }
+
private fun buildDatabaseUpdateCompressionActionTask(intent: Intent): ActionRunnable? {
return if (intent.hasExtra(OLD_ELEMENT_KEY)
&& intent.hasExtra(NEW_ELEMENT_KEY)
@@ -503,6 +562,8 @@ class DatabaseTaskNotificationService : NotificationService(), ProgressTaskUpdat
const val ACTION_DATABASE_COPY_NODES_TASK = "ACTION_DATABASE_COPY_NODES_TASK"
const val ACTION_DATABASE_MOVE_NODES_TASK = "ACTION_DATABASE_MOVE_NODES_TASK"
const val ACTION_DATABASE_DELETE_NODES_TASK = "ACTION_DATABASE_DELETE_NODES_TASK"
+ const val ACTION_DATABASE_RESTORE_ENTRY_HISTORY = "ACTION_DATABASE_RESTORE_ENTRY_HISTORY"
+ const val ACTION_DATABASE_DELETE_ENTRY_HISTORY = "ACTION_DATABASE_DELETE_ENTRY_HISTORY"
const val ACTION_DATABASE_UPDATE_NAME_TASK = "ACTION_DATABASE_UPDATE_NAME_TASK"
const val ACTION_DATABASE_UPDATE_DESCRIPTION_TASK = "ACTION_DATABASE_UPDATE_DESCRIPTION_TASK"
const val ACTION_DATABASE_UPDATE_DEFAULT_USERNAME_TASK = "ACTION_DATABASE_UPDATE_DEFAULT_USERNAME_TASK"
@@ -532,6 +593,7 @@ class DatabaseTaskNotificationService : NotificationService(), ProgressTaskUpdat
const val GROUPS_ID_KEY = "GROUPS_ID_KEY"
const val ENTRIES_ID_KEY = "ENTRIES_ID_KEY"
const val PARENT_ID_KEY = "PARENT_ID_KEY"
+ const val ENTRY_HISTORY_POSITION_KEY = "ENTRY_HISTORY_POSITION_KEY"
const val SAVE_DATABASE_KEY = "SAVE_DATABASE_KEY"
const val OLD_NODES_KEY = "OLD_NODES_KEY"
const val NEW_NODES_KEY = "NEW_NODES_KEY"
diff --git a/app/src/main/java/com/kunzisoft/keepass/notifications/KeyboardEntryNotificationService.kt b/app/src/main/java/com/kunzisoft/keepass/notifications/KeyboardEntryNotificationService.kt
index ec4d87b03..f01b795b0 100644
--- a/app/src/main/java/com/kunzisoft/keepass/notifications/KeyboardEntryNotificationService.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/notifications/KeyboardEntryNotificationService.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.notifications
import android.app.PendingIntent
diff --git a/app/src/main/java/com/kunzisoft/keepass/notifications/LockNotificationService.kt b/app/src/main/java/com/kunzisoft/keepass/notifications/LockNotificationService.kt
index 99f6fdae3..d447aac18 100644
--- a/app/src/main/java/com/kunzisoft/keepass/notifications/LockNotificationService.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/notifications/LockNotificationService.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.notifications
import android.content.BroadcastReceiver
diff --git a/app/src/main/java/com/kunzisoft/keepass/notifications/NotificationService.kt b/app/src/main/java/com/kunzisoft/keepass/notifications/NotificationService.kt
index a3a1c6e31..b93102399 100644
--- a/app/src/main/java/com/kunzisoft/keepass/notifications/NotificationService.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/notifications/NotificationService.kt
@@ -74,7 +74,7 @@ abstract class NotificationService : Service() {
companion object {
const val CHANNEL_ID_KEEPASS = "com.kunzisoft.keepass.notification.channel"
- const val CHANNEL_NAME_KEEPASS = "KeePass DX notification"
+ const val CHANNEL_NAME_KEEPASS = "KeePassDX notification"
const val GROUP_KEEPASS = "GROUP_KEEPASS"
const val SUMMARY_ID = 0
}
diff --git a/app/src/main/java/com/kunzisoft/keepass/otp/OtpElement.kt b/app/src/main/java/com/kunzisoft/keepass/otp/OtpElement.kt
index 2b094666b..b46f83ae9 100644
--- a/app/src/main/java/com/kunzisoft/keepass/otp/OtpElement.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/otp/OtpElement.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.otp
import com.kunzisoft.keepass.model.OtpModel
diff --git a/app/src/main/java/com/kunzisoft/keepass/otp/OtpEntryFields.kt b/app/src/main/java/com/kunzisoft/keepass/otp/OtpEntryFields.kt
index 73bfba63d..6fd8e8e7a 100644
--- a/app/src/main/java/com/kunzisoft/keepass/otp/OtpEntryFields.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/otp/OtpEntryFields.kt
@@ -1,17 +1,17 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify it under the terms of the GNU
+ * KeePassDX is free software: you can redistribute it and/or modify it under the terms of the GNU
* General Public License as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
+ * KeePassDX is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with KeePass DX. If not,
+ * You should have received a copy of the GNU General Public License along with KeePassDX. If not,
* see .
*
* This code is based on KeePassXC code
diff --git a/app/src/main/java/com/kunzisoft/keepass/otp/TokenCalculator.java b/app/src/main/java/com/kunzisoft/keepass/otp/TokenCalculator.java
index a790710b0..6f8ad8297 100644
--- a/app/src/main/java/com/kunzisoft/keepass/otp/TokenCalculator.java
+++ b/app/src/main/java/com/kunzisoft/keepass/otp/TokenCalculator.java
@@ -1,17 +1,17 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify it under the terms of the GNU
+ * KeePassDX is free software: you can redistribute it and/or modify it under the terms of the GNU
* General Public License as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
+ * KeePassDX is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with KeePass DX. If not,
+ * You should have received a copy of the GNU General Public License along with KeePassDX. If not,
* see .
*
* This code is based on andOTP code
diff --git a/app/src/main/java/com/kunzisoft/keepass/password/PasswordGenerator.kt b/app/src/main/java/com/kunzisoft/keepass/password/PasswordGenerator.kt
index fc722c115..b52658add 100644
--- a/app/src/main/java/com/kunzisoft/keepass/password/PasswordGenerator.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/password/PasswordGenerator.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.password
diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/MagikIMESettings.kt b/app/src/main/java/com/kunzisoft/keepass/settings/MagikIMESettings.kt
index e1a86f783..67f8df4cf 100644
--- a/app/src/main/java/com/kunzisoft/keepass/settings/MagikIMESettings.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/settings/MagikIMESettings.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.settings
diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/MagikIMESettingsFragment.kt b/app/src/main/java/com/kunzisoft/keepass/settings/MagikIMESettingsFragment.kt
index 522711bae..594c59c28 100644
--- a/app/src/main/java/com/kunzisoft/keepass/settings/MagikIMESettingsFragment.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/settings/MagikIMESettingsFragment.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.settings
diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/MainPreferenceFragment.kt b/app/src/main/java/com/kunzisoft/keepass/settings/MainPreferenceFragment.kt
index 18ee9eae9..3f1b0860d 100644
--- a/app/src/main/java/com/kunzisoft/keepass/settings/MainPreferenceFragment.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/settings/MainPreferenceFragment.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.settings
diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/NestedAppSettingsFragment.kt b/app/src/main/java/com/kunzisoft/keepass/settings/NestedAppSettingsFragment.kt
index a2c7d3928..067b026c2 100644
--- a/app/src/main/java/com/kunzisoft/keepass/settings/NestedAppSettingsFragment.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/settings/NestedAppSettingsFragment.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.settings
import android.content.ActivityNotFoundException
diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/NestedDatabaseSettingsFragment.kt b/app/src/main/java/com/kunzisoft/keepass/settings/NestedDatabaseSettingsFragment.kt
index 3daefa0f2..bb52f4ca2 100644
--- a/app/src/main/java/com/kunzisoft/keepass/settings/NestedDatabaseSettingsFragment.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/settings/NestedDatabaseSettingsFragment.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.settings
import android.graphics.Color
diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/NestedSettingsFragment.kt b/app/src/main/java/com/kunzisoft/keepass/settings/NestedSettingsFragment.kt
index 2ebd4c605..a1f02c25a 100644
--- a/app/src/main/java/com/kunzisoft/keepass/settings/NestedSettingsFragment.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/settings/NestedSettingsFragment.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.settings
diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/PreferencesUtil.kt b/app/src/main/java/com/kunzisoft/keepass/settings/PreferencesUtil.kt
index c5097fc1e..f8cb09b1f 100644
--- a/app/src/main/java/com/kunzisoft/keepass/settings/PreferencesUtil.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/settings/PreferencesUtil.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.settings
@@ -28,11 +28,6 @@ import java.util.*
object PreferencesUtil {
- fun showReadOnlyWarning(context: Context): Boolean {
- val prefs = PreferenceManager.getDefaultSharedPreferences(context)
- return prefs.getBoolean(context.getString(R.string.show_read_only_warning), true)
- }
-
fun rememberKeyFiles(context: Context): Boolean {
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
return prefs.getBoolean(context.getString(R.string.keyfile_key),
@@ -57,6 +52,12 @@ object PreferencesUtil {
context.resources.getBoolean(R.bool.list_groups_show_number_entries_default))
}
+ fun showExpiredEntries(context: Context): Boolean {
+ val prefs = PreferenceManager.getDefaultSharedPreferences(context)
+ return ! prefs.getBoolean(context.getString(R.string.hide_expired_entries_key),
+ context.resources.getBoolean(R.bool.hide_expired_entries_default))
+ }
+
/**
* Retrieve the text size in % (1 for 100%)
*/
@@ -272,6 +273,12 @@ object PreferencesUtil {
context.resources.getBoolean(R.bool.keyboard_notification_entry_default))
}
+ fun isAutoGoActionEnable(context: Context): Boolean {
+ val prefs = PreferenceManager.getDefaultSharedPreferences(context)
+ return prefs.getBoolean(context.getString(R.string.keyboard_auto_go_action_key),
+ context.resources.getBoolean(R.bool.keyboard_auto_go_action_default))
+ }
+
fun isKeyboardVibrationEnable(context: Context): Boolean {
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
return prefs.getBoolean(context.getString(R.string.keyboard_key_vibrate_key),
diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/SettingsActivity.kt b/app/src/main/java/com/kunzisoft/keepass/settings/SettingsActivity.kt
index e03b2ce05..81e8ad6c7 100644
--- a/app/src/main/java/com/kunzisoft/keepass/settings/SettingsActivity.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/settings/SettingsActivity.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.settings
diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/SettingsAdvancedUnlockActivity.kt b/app/src/main/java/com/kunzisoft/keepass/settings/SettingsAdvancedUnlockActivity.kt
index 308248d96..de177f29a 100644
--- a/app/src/main/java/com/kunzisoft/keepass/settings/SettingsAdvancedUnlockActivity.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/settings/SettingsAdvancedUnlockActivity.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.settings
import android.os.Bundle
diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/SettingsAutofillActivity.kt b/app/src/main/java/com/kunzisoft/keepass/settings/SettingsAutofillActivity.kt
index 38786a320..934a785f1 100644
--- a/app/src/main/java/com/kunzisoft/keepass/settings/SettingsAutofillActivity.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/settings/SettingsAutofillActivity.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.settings
diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preference/DialogColorPreference.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preference/DialogColorPreference.kt
index a94fc8912..0a4b3ebcc 100644
--- a/app/src/main/java/com/kunzisoft/keepass/settings/preference/DialogColorPreference.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/settings/preference/DialogColorPreference.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.settings.preference
import android.content.Context
diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preference/DialogListExplanationPreference.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preference/DialogListExplanationPreference.kt
index 093df1368..c0a028bbe 100644
--- a/app/src/main/java/com/kunzisoft/keepass/settings/preference/DialogListExplanationPreference.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/settings/preference/DialogListExplanationPreference.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.settings.preference
import android.content.Context
diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preference/IconPackListPreference.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preference/IconPackListPreference.kt
index 4a80d473b..bc90cac3d 100644
--- a/app/src/main/java/com/kunzisoft/keepass/settings/preference/IconPackListPreference.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/settings/preference/IconPackListPreference.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.settings.preference
import android.content.Context
diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preference/InputKdfNumberPreference.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preference/InputKdfNumberPreference.kt
index 14516d174..9a8376f02 100644
--- a/app/src/main/java/com/kunzisoft/keepass/settings/preference/InputKdfNumberPreference.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/settings/preference/InputKdfNumberPreference.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.settings.preference
diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preference/InputNumberPreference.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preference/InputNumberPreference.kt
index 866912fd8..be27d4d65 100644
--- a/app/src/main/java/com/kunzisoft/keepass/settings/preference/InputNumberPreference.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/settings/preference/InputNumberPreference.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.settings.preference
diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preference/InputTextPreference.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preference/InputTextPreference.kt
index 71a21642d..a8e18a750 100644
--- a/app/src/main/java/com/kunzisoft/keepass/settings/preference/InputTextPreference.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/settings/preference/InputTextPreference.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.settings.preference
import android.content.Context
diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DatabaseColorPreferenceDialogFragmentCompat.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DatabaseColorPreferenceDialogFragmentCompat.kt
index ce4837f1e..53642f5aa 100644
--- a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DatabaseColorPreferenceDialogFragmentCompat.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DatabaseColorPreferenceDialogFragmentCompat.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.settings.preferencedialogfragment
diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DatabaseDataCompressionPreferenceDialogFragmentCompat.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DatabaseDataCompressionPreferenceDialogFragmentCompat.kt
index 3e75acb7c..5ad8641de 100644
--- a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DatabaseDataCompressionPreferenceDialogFragmentCompat.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DatabaseDataCompressionPreferenceDialogFragmentCompat.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.settings.preferencedialogfragment
diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DatabaseDefaultUsernamePreferenceDialogFragmentCompat.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DatabaseDefaultUsernamePreferenceDialogFragmentCompat.kt
index 9b3fcfeb2..8b1c122eb 100644
--- a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DatabaseDefaultUsernamePreferenceDialogFragmentCompat.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DatabaseDefaultUsernamePreferenceDialogFragmentCompat.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.settings.preferencedialogfragment
diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DatabaseDescriptionPreferenceDialogFragmentCompat.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DatabaseDescriptionPreferenceDialogFragmentCompat.kt
index 261b3a2c6..7117383fc 100644
--- a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DatabaseDescriptionPreferenceDialogFragmentCompat.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DatabaseDescriptionPreferenceDialogFragmentCompat.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.settings.preferencedialogfragment
diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DatabaseEncryptionAlgorithmPreferenceDialogFragmentCompat.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DatabaseEncryptionAlgorithmPreferenceDialogFragmentCompat.kt
index 083e52ee7..aa2451749 100644
--- a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DatabaseEncryptionAlgorithmPreferenceDialogFragmentCompat.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DatabaseEncryptionAlgorithmPreferenceDialogFragmentCompat.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.settings.preferencedialogfragment
diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DatabaseKeyDerivationPreferenceDialogFragmentCompat.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DatabaseKeyDerivationPreferenceDialogFragmentCompat.kt
index 0066b687b..c8c8ee91b 100644
--- a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DatabaseKeyDerivationPreferenceDialogFragmentCompat.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DatabaseKeyDerivationPreferenceDialogFragmentCompat.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.settings.preferencedialogfragment
diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DatabaseNamePreferenceDialogFragmentCompat.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DatabaseNamePreferenceDialogFragmentCompat.kt
index 8ff01749b..424ce1064 100644
--- a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DatabaseNamePreferenceDialogFragmentCompat.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DatabaseNamePreferenceDialogFragmentCompat.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.settings.preferencedialogfragment
diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DatabaseSavePreferenceDialogFragmentCompat.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DatabaseSavePreferenceDialogFragmentCompat.kt
index a0287c115..71b22bdc6 100644
--- a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DatabaseSavePreferenceDialogFragmentCompat.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/DatabaseSavePreferenceDialogFragmentCompat.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.settings.preferencedialogfragment
diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/InputPreferenceDialogFragmentCompat.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/InputPreferenceDialogFragmentCompat.kt
index bf60fd0ef..1db7c8e49 100644
--- a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/InputPreferenceDialogFragmentCompat.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/InputPreferenceDialogFragmentCompat.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.settings.preferencedialogfragment
diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/MaxHistoryItemsPreferenceDialogFragmentCompat.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/MaxHistoryItemsPreferenceDialogFragmentCompat.kt
index 70183b1c0..371b7588c 100644
--- a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/MaxHistoryItemsPreferenceDialogFragmentCompat.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/MaxHistoryItemsPreferenceDialogFragmentCompat.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.settings.preferencedialogfragment
diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/MaxHistorySizePreferenceDialogFragmentCompat.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/MaxHistorySizePreferenceDialogFragmentCompat.kt
index 2967e6731..1719b54cf 100644
--- a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/MaxHistorySizePreferenceDialogFragmentCompat.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/MaxHistorySizePreferenceDialogFragmentCompat.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.settings.preferencedialogfragment
diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/MemoryUsagePreferenceDialogFragmentCompat.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/MemoryUsagePreferenceDialogFragmentCompat.kt
index 06b70e0cb..b05be4f28 100644
--- a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/MemoryUsagePreferenceDialogFragmentCompat.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/MemoryUsagePreferenceDialogFragmentCompat.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.settings.preferencedialogfragment
diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/ParallelismPreferenceDialogFragmentCompat.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/ParallelismPreferenceDialogFragmentCompat.kt
index e391a77ab..33fbf1cff 100644
--- a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/ParallelismPreferenceDialogFragmentCompat.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/ParallelismPreferenceDialogFragmentCompat.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.settings.preferencedialogfragment
diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/RoundsPreferenceDialogFragmentCompat.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/RoundsPreferenceDialogFragmentCompat.kt
index c7cf2c2fa..9bbe70f48 100644
--- a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/RoundsPreferenceDialogFragmentCompat.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/RoundsPreferenceDialogFragmentCompat.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.settings.preferencedialogfragment
diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/adapter/ListRadioItemAdapter.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/adapter/ListRadioItemAdapter.kt
index 00ece0107..a9992269f 100644
--- a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/adapter/ListRadioItemAdapter.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/adapter/ListRadioItemAdapter.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.settings.preferencedialogfragment.adapter
diff --git a/app/src/main/java/com/kunzisoft/keepass/stream/CopyInputStream.java b/app/src/main/java/com/kunzisoft/keepass/stream/CopyInputStream.java
deleted file mode 100644
index e9d9c73c9..000000000
--- a/app/src/main/java/com/kunzisoft/keepass/stream/CopyInputStream.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
- *
- * This file is part of KeePass DX.
- *
- * KeePass DX is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * KeePass DX is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
- *
- */
-package com.kunzisoft.keepass.stream;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-/**
- * This class copies everything pulled through its input stream into the
- * output stream.
- */
-public class CopyInputStream extends InputStream {
- private InputStream is;
- private OutputStream os;
-
- public CopyInputStream(InputStream is, OutputStream os) {
- this.is = is;
- this.os = os;
- }
-
- @Override
- public int available() throws IOException {
- return is.available();
- }
-
- @Override
- public void close() throws IOException {
- is.close();
- os.close();
- }
-
- @Override
- public void mark(int readlimit) {
- is.mark(readlimit);
- }
-
- @Override
- public boolean markSupported() {
- return is.markSupported();
- }
-
- @Override
- public int read() throws IOException {
- int data = is.read();
-
- if (data != -1) {
- os.write(data);
- }
-
- return data;
- }
-
- @Override
- public int read(byte[] b, int offset, int length) throws IOException {
- int len = is.read(b, offset, length);
-
- if (len != -1) {
- os.write(b, offset, len);
- }
-
- return len;
- }
-
- @Override
- public int read(byte[] b) throws IOException {
- int len = is.read(b);
-
- if (len != -1) {
- os.write(b, 0, len);
- }
-
- return len;
- }
-
- @Override
- public synchronized void reset() throws IOException {
- is.reset();
- }
-
- @Override
- public long skip(long byteCount) throws IOException {
- return is.skip(byteCount);
- }
-
-}
diff --git a/app/src/main/java/com/kunzisoft/keepass/stream/CopyInputStream.kt b/app/src/main/java/com/kunzisoft/keepass/stream/CopyInputStream.kt
new file mode 100644
index 000000000..e4d4b6da3
--- /dev/null
+++ b/app/src/main/java/com/kunzisoft/keepass/stream/CopyInputStream.kt
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
+package com.kunzisoft.keepass.stream
+
+import java.io.IOException
+import java.io.InputStream
+import java.io.OutputStream
+
+/**
+ * This class copies everything pulled through its input stream into the
+ * output stream.
+ */
+class CopyInputStream(private val inputStream: InputStream,
+ private val outputStream: OutputStream) : InputStream() {
+
+ @Throws(IOException::class)
+ override fun available(): Int {
+ return inputStream.available()
+ }
+
+ @Throws(IOException::class)
+ override fun close() {
+ inputStream.close()
+ outputStream.close()
+ }
+
+ override fun mark(readlimit: Int) {
+ inputStream.mark(readlimit)
+ }
+
+ override fun markSupported(): Boolean {
+ return inputStream.markSupported()
+ }
+
+ @Throws(IOException::class)
+ override fun read(): Int {
+ val data = inputStream.read()
+
+ if (data != -1) {
+ outputStream.write(data)
+ }
+
+ return data
+ }
+
+ @Throws(IOException::class)
+ override fun read(b: ByteArray, offset: Int, length: Int): Int {
+ val len = inputStream.read(b, offset, length)
+
+ if (len != -1) {
+ outputStream.write(b, offset, len)
+ }
+
+ return len
+ }
+
+ @Throws(IOException::class)
+ override fun read(b: ByteArray): Int {
+ val len = inputStream.read(b)
+
+ if (len != -1) {
+ outputStream.write(b, 0, len)
+ }
+
+ return len
+ }
+
+ @Synchronized
+ @Throws(IOException::class)
+ override fun reset() {
+ inputStream.reset()
+ }
+
+ @Throws(IOException::class)
+ override fun skip(byteCount: Long): Long {
+ return inputStream.skip(byteCount)
+ }
+
+}
diff --git a/app/src/main/java/com/kunzisoft/keepass/stream/CountInputStream.java b/app/src/main/java/com/kunzisoft/keepass/stream/CountInputStream.java
deleted file mode 100644
index de507a964..000000000
--- a/app/src/main/java/com/kunzisoft/keepass/stream/CountInputStream.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
- *
- * This file is part of KeePass DX.
- *
- * KeePass DX is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * KeePass DX is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
- *
- */
-package com.kunzisoft.keepass.stream;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-public class CountInputStream extends InputStream {
- InputStream is;
- long bytes = 0;
-
- public CountInputStream(InputStream is) {
- this.is = is;
- }
-
- @Override
- public int available() throws IOException {
- return is.available();
- }
-
- @Override
- public void close() throws IOException {
- is.close();
- }
-
- @Override
- public void mark(int readlimit) {
- is.mark(readlimit);
- }
-
- @Override
- public boolean markSupported() {
- return is.markSupported();
- }
-
- @Override
- public int read() throws IOException {
- bytes++;
- return is.read();
- }
-
- @Override
- public int read(byte[] buffer, int offset, int length) throws IOException {
- bytes += length;
- return is.read(buffer, offset, length);
- }
-
- @Override
- public int read(byte[] buffer) throws IOException {
- bytes += buffer.length;
- return is.read(buffer);
- }
-
- @Override
- public synchronized void reset() throws IOException {
- is.reset();
- }
-
- @Override
- public long skip(long byteCount) throws IOException {
- bytes += byteCount;
- return is.skip(byteCount);
- }
-
-}
diff --git a/app/src/main/java/com/kunzisoft/keepass/stream/CountOutputStream.java b/app/src/main/java/com/kunzisoft/keepass/stream/CountOutputStream.java
deleted file mode 100644
index 0ca655b05..000000000
--- a/app/src/main/java/com/kunzisoft/keepass/stream/CountOutputStream.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
- *
- * This file is part of KeePass DX.
- *
- * KeePass DX is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * KeePass DX is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
- *
- */
-package com.kunzisoft.keepass.stream;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-public class CountOutputStream extends OutputStream {
- OutputStream os;
- long bytes = 0;
-
- public CountOutputStream(OutputStream os) {
- this.os = os;
- }
-
-
- @Override
- public void close() throws IOException {
- os.close();
- }
-
- @Override
- public void flush() throws IOException {
- os.flush();
- }
-
-
- @Override
- public void write(byte[] buffer, int offset, int count) throws IOException {
- bytes += count;
- os.write(buffer, offset, count);
- }
-
- @Override
- public void write(byte[] buffer) throws IOException {
- bytes += buffer.length;
- os.write(buffer);
- }
-
- @Override
- public void write(int oneByte) throws IOException {
- bytes++;
- os.write(oneByte);
- }
-}
diff --git a/app/src/main/java/com/kunzisoft/keepass/stream/HashedBlockInputStream.kt b/app/src/main/java/com/kunzisoft/keepass/stream/HashedBlockInputStream.kt
index 10877dfac..ad5015de1 100644
--- a/app/src/main/java/com/kunzisoft/keepass/stream/HashedBlockInputStream.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/stream/HashedBlockInputStream.kt
@@ -1,36 +1,34 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.stream
-import com.kunzisoft.keepass.utils.DatabaseInputOutputUtils
-
import java.io.IOException
import java.io.InputStream
import java.security.MessageDigest
import java.security.NoSuchAlgorithmException
-import java.util.Arrays
+import java.util.*
class HashedBlockInputStream(inputStream: InputStream) : InputStream() {
- private val baseStream: LEDataInputStream = LEDataInputStream(inputStream)
+ private val baseStream: LittleEndianDataInputStream = LittleEndianDataInputStream(inputStream)
private var bufferPos = 0
private var buffer: ByteArray = ByteArray(0)
private var bufferIndex: Long = 0
@@ -88,11 +86,11 @@ class HashedBlockInputStream(inputStream: InputStream) : InputStream() {
bufferIndex++
val storedHash = baseStream.readBytes(32)
- if (storedHash == null || storedHash.size != HASH_SIZE) {
+ if (storedHash.size != HASH_SIZE) {
throw IOException("Invalid data format")
}
- val bufferSize = LEDataInputStream.readInt(baseStream)
+ val bufferSize = baseStream.readBytes4ToInt()
if (bufferSize < 0) {
throw IOException("Invalid data format")
}
@@ -146,7 +144,7 @@ class HashedBlockInputStream(inputStream: InputStream) : InputStream() {
if (!readHashedBlock()) return -1
}
- val output = DatabaseInputOutputUtils.readUByte(buffer, bufferPos)
+ val output = byteToUInt(buffer[bufferPos])
bufferPos++
return output
diff --git a/app/src/main/java/com/kunzisoft/keepass/stream/HashedBlockOutputStream.java b/app/src/main/java/com/kunzisoft/keepass/stream/HashedBlockOutputStream.java
deleted file mode 100644
index ab88a4a5d..000000000
--- a/app/src/main/java/com/kunzisoft/keepass/stream/HashedBlockOutputStream.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
- *
- * This file is part of KeePass DX.
- *
- * KeePass DX is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * KeePass DX is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
- *
- */
-package com.kunzisoft.keepass.stream;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-
-public class HashedBlockOutputStream extends OutputStream {
-
- private final static int DEFAULT_BUFFER_SIZE = 1024 * 1024;
-
- private LEDataOutputStream baseStream;
- private int bufferPos = 0;
- private byte[] buffer;
- private long bufferIndex = 0;
-
- public HashedBlockOutputStream(OutputStream os) {
- init(os, DEFAULT_BUFFER_SIZE);
- }
-
- public HashedBlockOutputStream(OutputStream os, int bufferSize) {
- if ( bufferSize <= 0 ) {
- bufferSize = DEFAULT_BUFFER_SIZE;
- }
-
- init(os, bufferSize);
- }
-
- private void init(OutputStream os, int bufferSize) {
- baseStream = new LEDataOutputStream(os);
- buffer = new byte[bufferSize];
-
- }
-
- @Override
- public void write(int oneByte) throws IOException {
- byte[] buf = new byte[1];
- buf[0] = (byte)oneByte;
- write(buf, 0, 1);
- }
-
- @Override
- public void close() throws IOException {
- if ( bufferPos != 0 ) {
- // Write remaining buffered amount
- WriteHashedBlock();
- }
-
- // Write terminating block
- WriteHashedBlock();
-
- flush();
- baseStream.close();
- }
-
- @Override
- public void flush() throws IOException {
- baseStream.flush();
- }
-
- @Override
- public void write(byte[] b, int offset, int count) throws IOException {
- while ( count > 0 ) {
- if ( bufferPos == buffer.length ) {
- WriteHashedBlock();
- }
-
- int copyLen = Math.min(buffer.length - bufferPos, count);
-
- System.arraycopy(b, offset, buffer, bufferPos, copyLen);
-
- offset += copyLen;
- bufferPos += copyLen;
-
- count -= copyLen;
- }
- }
-
- private void WriteHashedBlock() throws IOException {
- baseStream.writeUInt(bufferIndex);
- bufferIndex++;
-
- if ( bufferPos > 0 ) {
- MessageDigest md = null;
- try {
- md = MessageDigest.getInstance("SHA-256");
- } catch (NoSuchAlgorithmException e) {
- throw new IOException("SHA-256 not implemented here.");
- }
-
- byte[] hash;
- md.update(buffer, 0, bufferPos);
- hash = md.digest();
- /*
- if ( bufferPos == buffer.length) {
- hash = md.digest(buffer);
- } else {
- byte[] b = new byte[bufferPos];
- System.arraycopy(buffer, 0, b, 0, bufferPos);
- hash = md.digest(b);
- }
- */
-
- baseStream.write(hash);
-
- } else {
- // Write 32-bits of zeros
- baseStream.writeLong(0L);
- baseStream.writeLong(0L);
- baseStream.writeLong(0L);
- baseStream.writeLong(0L);
- }
-
- baseStream.writeInt(bufferPos);
-
- if ( bufferPos > 0 ) {
- baseStream.write(buffer, 0, bufferPos);
- }
-
- bufferPos = 0;
-
- }
-
- @Override
- public void write(byte[] buffer) throws IOException {
- write(buffer, 0, buffer.length);
- }
-
-}
diff --git a/app/src/main/java/com/kunzisoft/keepass/stream/HashedBlockOutputStream.kt b/app/src/main/java/com/kunzisoft/keepass/stream/HashedBlockOutputStream.kt
new file mode 100644
index 000000000..ea0f2d7ed
--- /dev/null
+++ b/app/src/main/java/com/kunzisoft/keepass/stream/HashedBlockOutputStream.kt
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
+package com.kunzisoft.keepass.stream
+
+import java.io.IOException
+import java.io.OutputStream
+import java.security.MessageDigest
+import java.security.NoSuchAlgorithmException
+
+class HashedBlockOutputStream : OutputStream {
+
+ private var baseStream: LittleEndianDataOutputStream? = null
+ private var bufferPos = 0
+ private var buffer: ByteArray? = null
+ private var bufferIndex: Long = 0
+
+ constructor(os: OutputStream) {
+ init(os, DEFAULT_BUFFER_SIZE)
+ }
+
+ constructor(os: OutputStream, bufferSize: Int) {
+ var currentBufferSize = bufferSize
+ if (currentBufferSize <= 0) {
+ currentBufferSize = DEFAULT_BUFFER_SIZE
+ }
+
+ init(os, currentBufferSize)
+ }
+
+ private fun init(os: OutputStream, bufferSize: Int) {
+ baseStream = LittleEndianDataOutputStream(os)
+ buffer = ByteArray(bufferSize)
+
+ }
+
+ @Throws(IOException::class)
+ override fun write(oneByte: Int) {
+ val buf = ByteArray(1)
+ buf[0] = oneByte.toByte()
+ write(buf, 0, 1)
+ }
+
+ @Throws(IOException::class)
+ override fun close() {
+ if (bufferPos != 0) {
+ // Write remaining buffered amount
+ WriteHashedBlock()
+ }
+
+ // Write terminating block
+ WriteHashedBlock()
+
+ flush()
+ baseStream!!.close()
+ }
+
+ @Throws(IOException::class)
+ override fun flush() {
+ baseStream!!.flush()
+ }
+
+ @Throws(IOException::class)
+ override fun write(b: ByteArray, offset: Int, count: Int) {
+ var currentOffset = offset
+ var counter = count
+ while (counter > 0) {
+ if (bufferPos == buffer!!.size) {
+ WriteHashedBlock()
+ }
+
+ val copyLen = Math.min(buffer!!.size - bufferPos, counter)
+
+ System.arraycopy(b, currentOffset, buffer, bufferPos, copyLen)
+
+ currentOffset += copyLen
+ bufferPos += copyLen
+
+ counter -= copyLen
+ }
+ }
+
+ @Throws(IOException::class)
+ private fun WriteHashedBlock() {
+ baseStream!!.writeUInt(bufferIndex)
+ bufferIndex++
+
+ if (bufferPos > 0) {
+ var md: MessageDigest? = null
+ try {
+ md = MessageDigest.getInstance("SHA-256")
+ } catch (e: NoSuchAlgorithmException) {
+ throw IOException("SHA-256 not implemented here.")
+ }
+
+ val hash: ByteArray
+ md!!.update(buffer, 0, bufferPos)
+ hash = md.digest()
+ /*
+ if ( bufferPos == buffer.length) {
+ hash = md.digest(buffer);
+ } else {
+ byte[] b = new byte[bufferPos];
+ System.arraycopy(buffer, 0, b, 0, bufferPos);
+ hash = md.digest(b);
+ }
+ */
+
+ baseStream!!.write(hash)
+
+ } else {
+ // Write 32-bits of zeros
+ baseStream!!.writeLong(0L)
+ baseStream!!.writeLong(0L)
+ baseStream!!.writeLong(0L)
+ baseStream!!.writeLong(0L)
+ }
+
+ baseStream!!.writeInt(bufferPos)
+
+ if (bufferPos > 0) {
+ baseStream!!.write(buffer!!, 0, bufferPos)
+ }
+
+ bufferPos = 0
+
+ }
+
+ @Throws(IOException::class)
+ override fun write(buffer: ByteArray) {
+ write(buffer, 0, buffer.size)
+ }
+}
diff --git a/app/src/main/java/com/kunzisoft/keepass/stream/HmacBlockInputStream.kt b/app/src/main/java/com/kunzisoft/keepass/stream/HmacBlockInputStream.kt
index 93d244271..3365fb402 100644
--- a/app/src/main/java/com/kunzisoft/keepass/stream/HmacBlockInputStream.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/stream/HmacBlockInputStream.kt
@@ -1,38 +1,35 @@
/*
* Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.stream
-import com.kunzisoft.keepass.utils.DatabaseInputOutputUtils
-
import java.io.IOException
import java.io.InputStream
import java.security.InvalidKeyException
import java.security.NoSuchAlgorithmException
-import java.util.Arrays
-
+import java.util.*
import javax.crypto.Mac
import javax.crypto.spec.SecretKeySpec
class HmacBlockInputStream(baseStream: InputStream, private val verify: Boolean, private val key: ByteArray) : InputStream() {
- private val baseStream: LEDataInputStream = LEDataInputStream(baseStream)
+ private val baseStream: LittleEndianDataInputStream = LittleEndianDataInputStream(baseStream)
private var buffer: ByteArray = ByteArray(0)
private var bufferPos = 0
private var blockIndex: Long = 0
@@ -46,7 +43,7 @@ class HmacBlockInputStream(baseStream: InputStream, private val verify: Boolean,
if (!readSafeBlock()) return -1
}
- val output = DatabaseInputOutputUtils.readUByte(buffer, bufferPos)
+ val output = byteToUInt(buffer[bufferPos])
bufferPos++
return output
@@ -91,23 +88,23 @@ class HmacBlockInputStream(baseStream: InputStream, private val verify: Boolean,
if (endOfStream) return false
val storedHmac = baseStream.readBytes(32)
- if (storedHmac == null || storedHmac.size != 32) {
+ if (storedHmac.size != 32) {
throw IOException("File corrupted")
}
- val pbBlockIndex = LEDataOutputStream.writeLongBuf(blockIndex)
+ val pbBlockIndex = longTo8Bytes(blockIndex)
val pbBlockSize = baseStream.readBytes(4)
- if (pbBlockSize == null || pbBlockSize.size != 4) {
+ if (pbBlockSize.size != 4) {
throw IOException("File corrupted")
}
- val blockSize = LEDataInputStream.readInt(pbBlockSize, 0)
+ val blockSize = bytes4ToInt(pbBlockSize)
bufferPos = 0
buffer = baseStream.readBytes(blockSize)
if (verify) {
val cmpHmac: ByteArray
- val blockKey = HmacBlockStream.GetHmacKey64(key, blockIndex)
+ val blockKey = HmacBlockStream.getHmacKey64(key, blockIndex)
val hmac: Mac
try {
hmac = Mac.getInstance("HmacSHA256")
diff --git a/app/src/main/java/com/kunzisoft/keepass/stream/HmacBlockOutputStream.java b/app/src/main/java/com/kunzisoft/keepass/stream/HmacBlockOutputStream.java
deleted file mode 100644
index ba00ed9ff..000000000
--- a/app/src/main/java/com/kunzisoft/keepass/stream/HmacBlockOutputStream.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright 2017 Brian Pellin.
- *
- * This file is part of KeePassDroid.
- *
- * KeePassDroid is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * KeePassDroid is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with KeePassDroid. If not, see .
- *
- */
-package com.kunzisoft.keepass.stream;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.security.InvalidKeyException;
-import java.security.NoSuchAlgorithmException;
-
-import javax.crypto.Mac;
-import javax.crypto.spec.SecretKeySpec;
-
-public class HmacBlockOutputStream extends OutputStream {
- private static final int DEFAULT_BUFFER_SIZE = 1024 * 1024;
- private LEDataOutputStream baseStream;
- private byte[] key;
-
- private byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
- private int bufferPos = 0;
- private long blockIndex = 0;
-
- public HmacBlockOutputStream(OutputStream os, byte[] key) {
- this.baseStream = new LEDataOutputStream(os);
- this.key = key;
- }
-
- @Override
- public void close() throws IOException {
- if (bufferPos == 0) {
- WriteSafeBlock();
- } else {
- WriteSafeBlock();
- WriteSafeBlock();
- }
-
- baseStream.flush();;
- baseStream.close();
- }
-
- @Override
- public void flush() throws IOException {
- baseStream.flush();
- }
-
- @Override
- public void write(byte[] outBuffer) throws IOException {
- write(outBuffer, 0, outBuffer.length);
- }
-
- @Override
- public void write(byte[] outBuffer, int offset, int count) throws IOException {
- while (count > 0) {
- if (bufferPos == buffer.length) {
- WriteSafeBlock();
- }
-
- int copy = Math.min(buffer.length - bufferPos, count);
- assert(copy > 0);
-
- System.arraycopy(outBuffer, offset, buffer, bufferPos, copy);
- offset += copy;
- bufferPos += copy;
-
- count -= copy;
- }
- }
-
- @Override
- public void write(int oneByte) throws IOException {
- byte[] outByte = new byte[1];
- write(outByte, 0, 1);
- }
-
- private void WriteSafeBlock() throws IOException {
- byte[] bufBlockIndex = LEDataOutputStream.writeLongBuf(blockIndex);
- byte[] blockSizeBuf = LEDataOutputStream.writeIntBuf(bufferPos);
-
- byte[] blockHmac;
- byte[] blockKey = HmacBlockStream.GetHmacKey64(key, blockIndex);
-
- Mac hmac;
- try {
- hmac = Mac.getInstance("HmacSHA256");
- SecretKeySpec signingKey = new SecretKeySpec(blockKey, "HmacSHA256");
- hmac.init(signingKey);
- } catch (NoSuchAlgorithmException e) {
- throw new IOException("Invalid Hmac");
- } catch (InvalidKeyException e) {
- throw new IOException("Invalid HMAC");
- }
-
- hmac.update(bufBlockIndex);
- hmac.update(blockSizeBuf);
-
- if (bufferPos > 0) {
- hmac.update(buffer, 0, bufferPos);
- }
-
- blockHmac = hmac.doFinal();
-
- baseStream.write(blockHmac);
- baseStream.write(blockSizeBuf);
-
- if (bufferPos > 0) {
- baseStream.write(buffer, 0, bufferPos);
- }
-
- blockIndex++;
- bufferPos = 0;
- }
-}
diff --git a/app/src/main/java/com/kunzisoft/keepass/stream/HmacBlockOutputStream.kt b/app/src/main/java/com/kunzisoft/keepass/stream/HmacBlockOutputStream.kt
new file mode 100644
index 000000000..a1dd11740
--- /dev/null
+++ b/app/src/main/java/com/kunzisoft/keepass/stream/HmacBlockOutputStream.kt
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
+package com.kunzisoft.keepass.stream
+
+import java.io.IOException
+import java.io.OutputStream
+import java.security.InvalidKeyException
+import java.security.NoSuchAlgorithmException
+
+import javax.crypto.Mac
+import javax.crypto.spec.SecretKeySpec
+
+class HmacBlockOutputStream(outputStream: OutputStream,
+ private val key: ByteArray)
+ : OutputStream() {
+
+ private val baseStream: LittleEndianDataOutputStream = LittleEndianDataOutputStream(outputStream)
+
+ private val buffer = ByteArray(DEFAULT_BUFFER_SIZE)
+ private var bufferPos = 0
+ private var blockIndex: Long = 0
+
+ @Throws(IOException::class)
+ override fun close() {
+ if (bufferPos == 0) {
+ writeSafeBlock()
+ } else {
+ writeSafeBlock()
+ writeSafeBlock()
+ }
+
+ baseStream.flush()
+ baseStream.close()
+ }
+
+ @Throws(IOException::class)
+ override fun flush() {
+ baseStream.flush()
+ }
+
+ @Throws(IOException::class)
+ override fun write(outBuffer: ByteArray) {
+ write(outBuffer, 0, outBuffer.size)
+ }
+
+ @Throws(IOException::class)
+ override fun write(outBuffer: ByteArray, offset: Int, count: Int) {
+ var currentOffset = offset
+ var counter = count
+ while (counter > 0) {
+ if (bufferPos == buffer.size) {
+ writeSafeBlock()
+ }
+
+ val copy = (buffer.size - bufferPos).coerceAtMost(counter)
+ System.arraycopy(outBuffer, currentOffset, buffer, bufferPos, copy)
+ currentOffset += copy
+ bufferPos += copy
+
+ counter -= copy
+ }
+ }
+
+ @Throws(IOException::class)
+ override fun write(oneByte: Int) {
+ val outByte = ByteArray(1)
+ write(outByte, 0, 1)
+ }
+
+ @Throws(IOException::class)
+ private fun writeSafeBlock() {
+ val bufBlockIndex = longTo8Bytes(blockIndex)
+ val blockSizeBuf = intTo4Bytes(bufferPos)
+
+ val blockHmac: ByteArray
+ val blockKey = HmacBlockStream.getHmacKey64(key, blockIndex)
+
+ val hmac: Mac
+ try {
+ hmac = Mac.getInstance("HmacSHA256")
+ val signingKey = SecretKeySpec(blockKey, "HmacSHA256")
+ hmac.init(signingKey)
+ } catch (e: NoSuchAlgorithmException) {
+ throw IOException("Invalid Hmac")
+ } catch (e: InvalidKeyException) {
+ throw IOException("Invalid HMAC")
+ }
+
+ hmac.update(bufBlockIndex)
+ hmac.update(blockSizeBuf)
+
+ if (bufferPos > 0) {
+ hmac.update(buffer, 0, bufferPos)
+ }
+
+ blockHmac = hmac.doFinal()
+
+ baseStream.write(blockHmac)
+ baseStream.write(blockSizeBuf)
+
+ if (bufferPos > 0) {
+ baseStream.write(buffer, 0, bufferPos)
+ }
+
+ blockIndex++
+ bufferPos = 0
+ }
+}
diff --git a/app/src/main/java/com/kunzisoft/keepass/stream/HmacBlockStream.java b/app/src/main/java/com/kunzisoft/keepass/stream/HmacBlockStream.java
deleted file mode 100644
index 3ccbd47eb..000000000
--- a/app/src/main/java/com/kunzisoft/keepass/stream/HmacBlockStream.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
- *
- * This file is part of KeePass DX.
- *
- * KeePass DX is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * KeePass DX is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
- *
- */
-package com.kunzisoft.keepass.stream;
-
-import java.io.IOException;
-import java.security.DigestOutputStream;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-
-public class HmacBlockStream {
- public static byte[] GetHmacKey64(byte[] key, long blockIndex) {
- MessageDigest hash;
- try {
- hash = MessageDigest.getInstance("SHA-512");
- } catch (NoSuchAlgorithmException e) {
- throw new RuntimeException(e);
- }
-
- NullOutputStream nos = new NullOutputStream();
- DigestOutputStream dos = new DigestOutputStream(nos, hash);
- LEDataOutputStream leos = new LEDataOutputStream(dos);
-
- try {
- leos.writeLong(blockIndex);
- leos.write(key);
- leos.close();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
-
- byte[] hashKey = hash.digest();
- assert(hashKey.length == 64);
-
- return hashKey;
- }
-
-}
diff --git a/app/src/main/java/com/kunzisoft/keepass/stream/HmacBlockStream.kt b/app/src/main/java/com/kunzisoft/keepass/stream/HmacBlockStream.kt
new file mode 100644
index 000000000..27c0e7c2b
--- /dev/null
+++ b/app/src/main/java/com/kunzisoft/keepass/stream/HmacBlockStream.kt
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
+package com.kunzisoft.keepass.stream
+
+import java.io.IOException
+import java.security.DigestOutputStream
+import java.security.MessageDigest
+import java.security.NoSuchAlgorithmException
+
+object HmacBlockStream {
+ fun getHmacKey64(key: ByteArray, blockIndex: Long): ByteArray {
+ val hash: MessageDigest
+ try {
+ hash = MessageDigest.getInstance("SHA-512")
+ } catch (e: NoSuchAlgorithmException) {
+ throw RuntimeException(e)
+ }
+
+ val nos = NullOutputStream()
+ val dos = DigestOutputStream(nos, hash)
+ val leos = LittleEndianDataOutputStream(dos)
+
+ try {
+ leos.writeLong(blockIndex)
+ leos.write(key)
+ leos.close()
+ } catch (e: IOException) {
+ throw RuntimeException(e)
+ }
+
+ //assert(hashKey.length == 64);
+ return hash.digest()
+ }
+}
diff --git a/app/src/main/java/com/kunzisoft/keepass/stream/LEDataInputStream.java b/app/src/main/java/com/kunzisoft/keepass/stream/LEDataInputStream.java
deleted file mode 100644
index ead0413de..000000000
--- a/app/src/main/java/com/kunzisoft/keepass/stream/LEDataInputStream.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
- *
- * This file is part of KeePass DX.
- *
- * KeePass DX is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * KeePass DX is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
- *
- */
-package com.kunzisoft.keepass.stream;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Arrays;
-import java.util.UUID;
-
-
-/**
- * Little endian version of the DataInputStream
- * @author bpellin
- */
-public class LEDataInputStream extends InputStream {
-
- private static final long INT_TO_LONG_MASK = 0xffffffffL;
-
- private InputStream baseStream;
-
- public LEDataInputStream(InputStream inputStream) {
- baseStream = inputStream;
- }
-
- /**
- * Read a 32-bit value and return it as a long, so that it can
- * be interpreted as an unsigned integer.
- */
- public long readUInt() throws IOException {
- return readInt(baseStream) & INT_TO_LONG_MASK;
- }
-
- public int readInt() throws IOException {
- return readInt(baseStream);
- }
-
- public long readLong() throws IOException {
- byte[] buf = readBytes(8);
- return readLong(buf, 0);
- }
-
- @Override
- public int available() throws IOException {
- return baseStream.available();
- }
-
- @Override
- public void close() throws IOException {
- baseStream.close();
- }
-
- @Override
- public void mark(int readlimit) {
- baseStream.mark(readlimit);
- }
-
- @Override
- public boolean markSupported() {
- return baseStream.markSupported();
- }
-
- @Override
- public int read() throws IOException {
- return baseStream.read();
- }
-
- @Override
- public int read(byte[] b, int offset, int length) throws IOException {
- return baseStream.read(b, offset, length);
- }
-
- @Override
- public int read(byte[] b) throws IOException {
- // TODO Auto-generated method stub
- return super.read(b);
- }
-
- @Override
- public synchronized void reset() throws IOException {
- baseStream.reset();
- }
-
- @Override
- public long skip(long n) throws IOException {
- return baseStream.skip(n);
- }
-
- public byte[] readBytes(int length) throws IOException {
- // TODO Exception max length < buffer size
- byte[] buf = new byte[length];
-
- int count = 0;
- while ( count < length ) {
- int read = read(buf, count, length - count);
-
- // Reached end
- if ( read == -1 ) {
- // Stop early
- byte[] early = new byte[count];
- System.arraycopy(buf, 0, early, 0, count);
- return early;
- }
-
- count += read;
- }
-
- return buf;
- }
-
- public void readBytes(int length, ReadBytes readBytes) throws IOException {
- int bufferSize = 256 * 3; // TODO Buffer size
- byte[] buffer = new byte[bufferSize];
-
- int offset = 0;
- int read = 0;
- while ( offset < length && read != -1) {
-
- // To reduce the buffer for the last bytes reads
- if (length - offset < bufferSize) {
- bufferSize = length - offset;
- buffer = new byte[bufferSize];
- }
- read = read(buffer, 0, bufferSize);
-
- // To get only the bytes read
- byte[] optimizedBuffer;
- if (read >= 0 && buffer.length > read) {
- optimizedBuffer = Arrays.copyOf(buffer, read);
- } else {
- optimizedBuffer = buffer;
- }
- readBytes.read(optimizedBuffer);
- offset += read;
- }
- }
-
- public int readUShort() throws IOException {
- byte[] buf = new byte[2];
- baseStream.read(buf, 0, 2);
- return readUShort(buf, 0);
- }
-
- /**
- * Read an unsigned 16-bit value.
- */
- public static int readUShort( byte[] buf, int offset ) {
- return (buf[offset] & 0xFF) + ((buf[offset + 1] & 0xFF) << 8);
- }
-
- public static long readLong(byte[] buf, int offset ) {
- return ((long)buf[offset] & 0xFF) + (((long)buf[offset + 1] & 0xFF) << 8)
- + (((long)buf[offset + 2] & 0xFF) << 16) + (((long)buf[offset + 3] & 0xFF) << 24)
- + (((long)buf[offset + 4] & 0xFF) << 32) + (((long)buf[offset + 5] & 0xFF) << 40)
- + (((long)buf[offset + 6] & 0xFF) << 48) + (((long)buf[offset + 7] & 0xFF) << 56);
- }
-
- public static long readUInt(byte[] buf, int offset ) {
- return (readInt(buf, offset) & INT_TO_LONG_MASK);
- }
-
- public static int readInt(InputStream is) throws IOException {
- byte[] buf = new byte[4];
- is.read(buf, 0, 4);
- return readInt(buf, 0);
- }
-
- /**
- * Read a 32-bit value.
- */
- public static int readInt(byte[] buf, int offset ) {
- return (buf[offset] & 0xFF) + ((buf[offset + 1] & 0xFF) << 8) + ((buf[offset + 2] & 0xFF) << 16)
- + ((buf[offset + 3] & 0xFF) << 24);
- }
-
- public static UUID readUuid( byte[] buf, int offset ) {
- long lsb = 0;
- for (int i = 15; i >= 8; i--) {
- lsb = (lsb << 8) | (buf[i + offset] & 0xff);
- }
-
- long msb = 0;
- for (int i = 7; i >= 0; i--) {
- msb = (msb << 8) | (buf[i + offset] & 0xff);
- }
-
- return new UUID(msb, lsb);
- }
-}
diff --git a/app/src/main/java/com/kunzisoft/keepass/stream/LEDataOutputStream.java b/app/src/main/java/com/kunzisoft/keepass/stream/LEDataOutputStream.java
deleted file mode 100644
index bb4cf26eb..000000000
--- a/app/src/main/java/com/kunzisoft/keepass/stream/LEDataOutputStream.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
- *
- * This file is part of KeePass DX.
- *
- * KeePass DX is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * KeePass DX is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
- *
- */
-package com.kunzisoft.keepass.stream;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-
-/** Little Endian version of the DataOutputStream
- * @author bpellin
- *
- */
-public class LEDataOutputStream extends OutputStream {
-
- private OutputStream baseStream;
-
- public LEDataOutputStream(OutputStream out) {
- baseStream = out;
- }
-
- public void writeUInt(long uint) throws IOException {
- baseStream.write(LEDataOutputStream.writeIntBuf((int) uint));
- }
-
- @Override
- public void close() throws IOException {
- baseStream.close();
- }
-
- @Override
- public void flush() throws IOException {
- baseStream.flush();
- }
-
- @Override
- public void write(byte[] buffer, int offset, int count) throws IOException {
- baseStream.write(buffer, offset, count);
- }
-
- @Override
- public void write(byte[] buffer) throws IOException {
- baseStream.write(buffer);
- }
-
- @Override
- public void write(int oneByte) throws IOException {
- baseStream.write(oneByte);
- }
-
- public void writeLong(long val) throws IOException {
- byte[] buf = new byte[8];
-
- writeLong(val, buf, 0);
- baseStream.write(buf);
- }
-
- public void writeInt(int val) throws IOException {
- byte[] buf = new byte[4];
- writeInt(val, buf, 0);
-
- baseStream.write(buf);
- }
-
- public void writeUShort(int val) throws IOException {
- byte[] buf = new byte[2];
- writeUShort(val, buf, 0);
- baseStream.write(buf);
- }
-
- public static byte[] writeIntBuf(int val) {
- byte[] buf = new byte[4];
- writeInt(val, buf, 0);
-
- return buf;
- }
-
- public static byte[] writeUShortBuf(int val) {
- byte[] buf = new byte[2];
-
- writeUShort(val, buf, 0);
-
- return buf;
- }
-
- /** Write an unsigned 16-bit value
- *
- * @param val
- * @param buf
- * @param offset
- */
- public static void writeUShort(int val, byte[] buf, int offset) {
- buf[offset + 0] = (byte)(val & 0x00FF);
- buf[offset + 1] = (byte)((val & 0xFF00) >> 8);
- }
-
- /**
- * Write a 32-bit value.
- *
- * @param val
- * @param buf
- * @param offset
- */
- public static void writeInt( int val, byte[] buf, int offset ) {
- buf[offset + 0] = (byte)(val & 0xFF);
- buf[offset + 1] = (byte)((val >>> 8) & 0xFF);
- buf[offset + 2] = (byte)((val >>> 16) & 0xFF);
- buf[offset + 3] = (byte)((val >>> 24) & 0xFF);
- }
-
- public static byte[] writeLongBuf(long val) {
- byte[] buf = new byte[8];
- writeLong(val, buf, 0);
- return buf;
- }
-
- public static void writeLong( long val, byte[] buf, int offset ) {
- buf[offset + 0] = (byte)(val & 0xFF);
- buf[offset + 1] = (byte)((val >>> 8) & 0xFF);
- buf[offset + 2] = (byte)((val >>> 16) & 0xFF);
- buf[offset + 3] = (byte)((val >>> 24) & 0xFF);
- buf[offset + 4] = (byte)((val >>> 32) & 0xFF);
- buf[offset + 5] = (byte)((val >>> 40) & 0xFF);
- buf[offset + 6] = (byte)((val >>> 48) & 0xFF);
- buf[offset + 7] = (byte)((val >>> 56) & 0xFF);
- }
-
-}
diff --git a/app/src/main/java/com/kunzisoft/keepass/stream/LittleEndianDataInputStream.kt b/app/src/main/java/com/kunzisoft/keepass/stream/LittleEndianDataInputStream.kt
new file mode 100644
index 000000000..c880109f3
--- /dev/null
+++ b/app/src/main/java/com/kunzisoft/keepass/stream/LittleEndianDataInputStream.kt
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
+package com.kunzisoft.keepass.stream
+
+import java.io.IOException
+import java.io.InputStream
+
+/**
+ * Little endian version of the DataInputStream
+ */
+class LittleEndianDataInputStream(private val baseStream: InputStream) : InputStream() {
+
+ /**
+ * Read a 32-bit value and return it as a long, so that it can
+ * be interpreted as an unsigned integer.
+ */
+ @Throws(IOException::class)
+ fun readUInt(): Long {
+ return baseStream.readBytes4ToUInt()
+ }
+
+ @Throws(IOException::class)
+ fun readInt(): Int {
+ return baseStream.readBytes4ToInt()
+ }
+
+ @Throws(IOException::class)
+ fun readUShort(): Int {
+ val buf = ByteArray(2)
+ if (baseStream.read(buf, 0, 2) != 2)
+ throw IOException("Unable to read UShort value")
+ return bytes2ToUShort(buf)
+ }
+
+ @Throws(IOException::class)
+ override fun available(): Int {
+ return baseStream.available()
+ }
+
+ @Throws(IOException::class)
+ override fun close() {
+ baseStream.close()
+ }
+
+ override fun mark(readlimit: Int) {
+ baseStream.mark(readlimit)
+ }
+
+ override fun markSupported(): Boolean {
+ return baseStream.markSupported()
+ }
+
+ @Throws(IOException::class)
+ override fun read(): Int {
+ return baseStream.read()
+ }
+
+ @Throws(IOException::class)
+ override fun read(b: ByteArray, offset: Int, length: Int): Int {
+ return baseStream.read(b, offset, length)
+ }
+
+ @Throws(IOException::class)
+ override fun read(b: ByteArray): Int {
+ return baseStream.read(b)
+ }
+
+ @Synchronized
+ @Throws(IOException::class)
+ override fun reset() {
+ baseStream.reset()
+ }
+
+ @Throws(IOException::class)
+ override fun skip(n: Long): Long {
+ return baseStream.skip(n)
+ }
+
+ @Throws(IOException::class)
+ fun readBytes(length: Int): ByteArray {
+ // TODO Exception max length < buffer size
+ val buf = ByteArray(length)
+
+ var count = 0
+ while (count < length) {
+ val read = read(buf, count, length - count)
+
+ // Reached end
+ if (read == -1) {
+ // Stop early
+ val early = ByteArray(count)
+ System.arraycopy(buf, 0, early, 0, count)
+ return early
+ }
+
+ count += read
+ }
+
+ return buf
+ }
+}
diff --git a/app/src/main/java/com/kunzisoft/keepass/stream/LittleEndianDataOutputStream.kt b/app/src/main/java/com/kunzisoft/keepass/stream/LittleEndianDataOutputStream.kt
new file mode 100644
index 000000000..577e68ba0
--- /dev/null
+++ b/app/src/main/java/com/kunzisoft/keepass/stream/LittleEndianDataOutputStream.kt
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2019 Brian Pellin, Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
+package com.kunzisoft.keepass.stream
+
+import java.io.IOException
+import java.io.OutputStream
+
+
+/**
+ * Little Endian version of the DataOutputStream
+ * @author bpellin
+ */
+class LittleEndianDataOutputStream(private val baseStream: OutputStream) : OutputStream() {
+
+ @Throws(IOException::class)
+ fun writeUInt(uint: Long) { // TODO UInt
+ baseStream.write(intTo4Bytes(uint.toInt()))
+ }
+
+ @Throws(IOException::class)
+ override fun close() {
+ baseStream.close()
+ }
+
+ @Throws(IOException::class)
+ override fun flush() {
+ baseStream.flush()
+ }
+
+ @Throws(IOException::class)
+ override fun write(buffer: ByteArray, offset: Int, count: Int) {
+ baseStream.write(buffer, offset, count)
+ }
+
+ @Throws(IOException::class)
+ override fun write(buffer: ByteArray) {
+ baseStream.write(buffer)
+ }
+
+ @Throws(IOException::class)
+ override fun write(oneByte: Int) {
+ baseStream.write(oneByte)
+ }
+
+ @Throws(IOException::class)
+ fun writeLong(value: Long) {
+ baseStream.write(longTo8Bytes(value))
+ }
+
+ @Throws(IOException::class)
+ fun writeInt(value: Int) {
+ baseStream.write(intTo4Bytes(value))
+ }
+
+ @Throws(IOException::class)
+ fun writeUShort(value: Int) {
+ baseStream.write(uShortTo2Bytes(value))
+ }
+}
diff --git a/app/src/main/java/com/kunzisoft/keepass/stream/MacOutputStream.java b/app/src/main/java/com/kunzisoft/keepass/stream/MacOutputStream.java
deleted file mode 100644
index abff8df7f..000000000
--- a/app/src/main/java/com/kunzisoft/keepass/stream/MacOutputStream.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright 2017 Brian Pellin.
- *
- * This file is part of KeePassDroid.
- *
- * KeePassDroid is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * KeePassDroid is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with KeePassDroid. If not, see .
- *
- */
-package com.kunzisoft.keepass.stream;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-import javax.crypto.Mac;
-
-public class MacOutputStream extends OutputStream {
- private Mac mac;
- private OutputStream os;
-
- public MacOutputStream(OutputStream os, Mac mac) {
- this.mac = mac;
- this.os = os;
- }
-
- @Override
- public void flush() throws IOException {
- os.flush();
- }
-
- @Override
- public void close() throws IOException {
- os.close();
- }
-
- @Override
- public void write(int oneByte) throws IOException {
- mac.update((byte) oneByte);
- os.write(oneByte);
- }
-
- @Override
- public void write(byte[] buffer, int offset, int count) throws IOException {
- mac.update(buffer, offset, count);
- os.write(buffer, offset, count);
- }
-
- @Override
- public void write(byte[] buffer) throws IOException {
- mac.update(buffer, 0, buffer.length);
- os.write(buffer);
- }
-
- public byte[] getMac() {
- return mac.doFinal();
- }
-}
diff --git a/app/src/main/java/com/kunzisoft/keepass/stream/MacOutputStream.kt b/app/src/main/java/com/kunzisoft/keepass/stream/MacOutputStream.kt
new file mode 100644
index 000000000..4dc570891
--- /dev/null
+++ b/app/src/main/java/com/kunzisoft/keepass/stream/MacOutputStream.kt
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
+package com.kunzisoft.keepass.stream
+
+import java.io.IOException
+import java.io.OutputStream
+
+import javax.crypto.Mac
+
+class MacOutputStream(private val outputStream: OutputStream,
+ private val mMac: Mac) : OutputStream() {
+
+ @Throws(IOException::class)
+ override fun flush() {
+ outputStream.flush()
+ }
+
+ @Throws(IOException::class)
+ override fun close() {
+ outputStream.close()
+ }
+
+ @Throws(IOException::class)
+ override fun write(oneByte: Int) {
+ mMac.update(oneByte.toByte())
+ outputStream.write(oneByte)
+ }
+
+ @Throws(IOException::class)
+ override fun write(buffer: ByteArray, offset: Int, count: Int) {
+ mMac.update(buffer, offset, count)
+ outputStream.write(buffer, offset, count)
+ }
+
+ @Throws(IOException::class)
+ override fun write(buffer: ByteArray) {
+ mMac.update(buffer, 0, buffer.size)
+ outputStream.write(buffer)
+ }
+
+ val mac: ByteArray
+ get() = mMac.doFinal()
+}
diff --git a/app/src/main/java/com/kunzisoft/keepass/stream/NullOutputStream.java b/app/src/main/java/com/kunzisoft/keepass/stream/NullOutputStream.java
deleted file mode 100644
index 12eef13e3..000000000
--- a/app/src/main/java/com/kunzisoft/keepass/stream/NullOutputStream.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
- *
- * This file is part of KeePass DX.
- *
- * KeePass DX is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * KeePass DX is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
- *
- */
-package com.kunzisoft.keepass.stream;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-public class NullOutputStream extends OutputStream {
-
- @Override
- public void close() throws IOException {
- super.close();
- }
-
- @Override
- public void flush() throws IOException {
- super.flush();
- }
-
- @Override
- public void write(byte[] buffer, int offset, int count) throws IOException {
- super.write(buffer, offset, count);
- }
-
- @Override
- public void write(byte[] buffer) throws IOException {
- super.write(buffer);
- }
-
- @Override
- public void write(int oneByte) throws IOException {
- }
-
-}
diff --git a/app/src/main/java/com/kunzisoft/keepass/stream/NullOutputStream.kt b/app/src/main/java/com/kunzisoft/keepass/stream/NullOutputStream.kt
new file mode 100644
index 000000000..c343f56d0
--- /dev/null
+++ b/app/src/main/java/com/kunzisoft/keepass/stream/NullOutputStream.kt
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
+package com.kunzisoft.keepass.stream
+
+import java.io.IOException
+import java.io.OutputStream
+
+class NullOutputStream : OutputStream() {
+
+ @Throws(IOException::class)
+ override fun close() {
+ super.close()
+ }
+
+ @Throws(IOException::class)
+ override fun flush() {
+ super.flush()
+ }
+
+ @Throws(IOException::class)
+ override fun write(buffer: ByteArray, offset: Int, count: Int) {
+ super.write(buffer, offset, count)
+ }
+
+ @Throws(IOException::class)
+ override fun write(buffer: ByteArray) {
+ super.write(buffer)
+ }
+
+ @Throws(IOException::class)
+ override fun write(oneByte: Int) {
+ }
+
+}
diff --git a/app/src/main/java/com/kunzisoft/keepass/stream/RandomFileOutputStream.java b/app/src/main/java/com/kunzisoft/keepass/stream/RandomFileOutputStream.java
deleted file mode 100644
index 06ce4f594..000000000
--- a/app/src/main/java/com/kunzisoft/keepass/stream/RandomFileOutputStream.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
- *
- * This file is part of KeePass DX.
- *
- * KeePass DX is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * KeePass DX is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
- *
- */
-package com.kunzisoft.keepass.stream;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.RandomAccessFile;
-
-public class RandomFileOutputStream extends OutputStream {
-
- RandomAccessFile mFile;
-
- RandomFileOutputStream(RandomAccessFile file) {
- mFile = file;
- }
-
- @Override
- public void close() throws IOException {
- super.close();
-
- mFile.close();
- }
-
- @Override
- public void write(byte[] buffer, int offset, int count) throws IOException {
- super.write(buffer, offset, count);
-
- mFile.write(buffer, offset, count);
- }
-
- @Override
- public void write(byte[] buffer) throws IOException {
- super.write(buffer);
-
- mFile.write(buffer);
- }
-
- @Override
- public void write(int oneByte) throws IOException {
- mFile.write(oneByte);
- }
-
- public void seek(long pos) throws IOException {
- mFile.seek(pos);
- }
-
-}
diff --git a/app/src/main/java/com/kunzisoft/keepass/stream/RandomFileOutputStream.kt b/app/src/main/java/com/kunzisoft/keepass/stream/RandomFileOutputStream.kt
new file mode 100644
index 000000000..14f0a2186
--- /dev/null
+++ b/app/src/main/java/com/kunzisoft/keepass/stream/RandomFileOutputStream.kt
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
+package com.kunzisoft.keepass.stream
+
+import java.io.IOException
+import java.io.OutputStream
+import java.io.RandomAccessFile
+
+class RandomFileOutputStream internal constructor(private val mFile: RandomAccessFile) : OutputStream() {
+
+ @Throws(IOException::class)
+ override fun close() {
+ super.close()
+
+ mFile.close()
+ }
+
+ @Throws(IOException::class)
+ override fun write(buffer: ByteArray, offset: Int, count: Int) {
+ super.write(buffer, offset, count)
+
+ mFile.write(buffer, offset, count)
+ }
+
+ @Throws(IOException::class)
+ override fun write(buffer: ByteArray) {
+ super.write(buffer)
+
+ mFile.write(buffer)
+ }
+
+ @Throws(IOException::class)
+ override fun write(oneByte: Int) {
+ mFile.write(oneByte)
+ }
+
+ @Throws(IOException::class)
+ fun seek(pos: Long) {
+ mFile.seek(pos)
+ }
+
+}
diff --git a/app/src/main/java/com/kunzisoft/keepass/stream/ReadBytes.kt b/app/src/main/java/com/kunzisoft/keepass/stream/ReadBytes.kt
deleted file mode 100644
index 3c03dabd4..000000000
--- a/app/src/main/java/com/kunzisoft/keepass/stream/ReadBytes.kt
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.kunzisoft.keepass.stream
-
-import java.io.IOException
-import java.io.InputStream
-
-interface ReadBytes {
- /**
- * Called after each buffer fill
- * @param buffer filled
- */
- @Throws(IOException::class)
- fun read(buffer: ByteArray)
-}
-
-@Throws(IOException::class)
-fun readFromStream(inputStream: InputStream, bufferSize: Int, readBytes: ReadBytes) {
- val buffer = ByteArray(bufferSize)
- var read = 0
- while (read != -1) {
- read = inputStream.read(buffer, 0, buffer.size)
- if (read != -1) {
- val optimizedBuffer: ByteArray = if (buffer.size == read) {
- buffer
- } else {
- buffer.copyOf(read)
- }
- readBytes.read(optimizedBuffer)
- }
- }
-}
diff --git a/app/src/main/java/com/kunzisoft/keepass/stream/StreamBytesUtils.kt b/app/src/main/java/com/kunzisoft/keepass/stream/StreamBytesUtils.kt
new file mode 100644
index 000000000..d645c45f8
--- /dev/null
+++ b/app/src/main/java/com/kunzisoft/keepass/stream/StreamBytesUtils.kt
@@ -0,0 +1,285 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
+package com.kunzisoft.keepass.stream
+
+import com.kunzisoft.keepass.database.element.DateInstant
+import com.kunzisoft.keepass.utils.StringDatabaseKDBUtils.bytesToString
+import java.io.IOException
+import java.io.InputStream
+import java.util.*
+
+/**
+ * Read all data of stream and invoke [readBytes] each time the buffer is full or no more data to read.
+ */
+@Throws(IOException::class)
+fun InputStream.readBytes(bufferSize: Int, readBytes: (bytesRead: ByteArray) -> Unit) {
+ val buffer = ByteArray(bufferSize)
+ var read = 0
+ while (read != -1) {
+ read = this.read(buffer, 0, buffer.size)
+ if (read != -1) {
+ val optimizedBuffer: ByteArray = if (buffer.size == read) {
+ buffer
+ } else {
+ buffer.copyOf(read)
+ }
+ readBytes.invoke(optimizedBuffer)
+ }
+ }
+}
+
+/**
+ * Read number of bytes defined by [length] and invoke [readBytes] each time the buffer is full or no more data to read.
+ */
+@Throws(IOException::class)
+fun InputStream.readBytes(length: Int, bufferSize: Int, readBytes: (bytesRead: ByteArray) -> Unit) {
+ var bufferLength = bufferSize
+ var buffer = ByteArray(bufferLength)
+
+ var offset = 0
+ var read = 0
+ while (offset < length && read != -1) {
+
+ // To reduce the buffer for the last bytes reads
+ if (length - offset < bufferLength) {
+ bufferLength = length - offset
+ buffer = ByteArray(bufferLength)
+ }
+ read = this.read(buffer, 0, bufferLength)
+
+ // To get only the bytes read
+ val optimizedBuffer: ByteArray = if (read >= 0 && buffer.size > read) {
+ buffer.copyOf(read)
+ } else {
+ buffer
+ }
+ readBytes.invoke(optimizedBuffer)
+ offset += read
+ }
+}
+
+/**
+ * Read a 32-bit value and return it as a long, so that it can
+ * be interpreted as an unsigned integer.
+ */
+@Throws(IOException::class)
+fun InputStream.readBytes4ToUInt(): Long {
+ return readBytes4ToInt().toLong() and INT_TO_LONG_MASK
+}
+
+@Throws(IOException::class)
+fun InputStream.readBytes4ToInt(): Int {
+ return bytes4ToInt(readBytesLength(4))
+}
+
+@Throws(IOException::class)
+fun InputStream.readBytes2ToUShort(): Int {
+ return bytes2ToUShort(readBytesLength(2))
+}
+
+@Throws(IOException::class)
+fun InputStream.readBytes5ToDate(): DateInstant {
+ return bytes5ToDate(readBytesLength(5))
+}
+
+@Throws(IOException::class)
+fun InputStream.readBytes16ToUuid(): UUID {
+ return bytes16ToUuid(readBytesLength(16))
+}
+
+@Throws(IOException::class)
+fun InputStream.readBytesToString(length: Int, replaceCRLF: Boolean = true): String {
+ return bytesToString(this.readBytesLength(length), replaceCRLF)
+}
+
+@Throws(IOException::class)
+fun InputStream.readBytesLength(length: Int): ByteArray {
+ val buf = ByteArray(length)
+ // WARNING this.read(buf, 0, length) Doesn't work
+ for (i in 0 until length) {
+ buf[i] = this.read().toByte()
+ }
+ return buf
+}
+
+/**
+ * Read an unsigned 16-bit value.
+ */
+fun bytes2ToUShort(buf: ByteArray): Int {
+ return ((buf[0].toInt() and 0xFF)
+ + (buf[1].toInt() and 0xFF shl 8))
+}
+
+/**
+ * Read a 64 bit long
+ */
+fun bytes64ToLong(buf: ByteArray): Long {
+ return ((buf[0].toLong() and 0xFF)
+ + (buf[1].toLong() and 0xFF shl 8)
+ + (buf[2].toLong() and 0xFF shl 16)
+ + (buf[3].toLong() and 0xFF shl 24)
+ + (buf[4].toLong() and 0xFF shl 32)
+ + (buf[5].toLong() and 0xFF shl 40)
+ + (buf[6].toLong() and 0xFF shl 48)
+ + (buf[7].toLong() and 0xFF shl 56))
+}
+
+
+private const val INT_TO_LONG_MASK: Long = 0xffffffffL
+
+fun bytes4ToUInt(buf: ByteArray): Long {
+ return bytes4ToInt(buf).toLong() and INT_TO_LONG_MASK
+}
+
+/**
+ * Read a 32-bit value.
+ */
+fun bytes4ToInt(buf: ByteArray): Int {
+ return ((buf[0].toInt() and 0xFF)
+ + (buf[1].toInt() and 0xFF shl 8)
+ + (buf[2].toInt() and 0xFF shl 16)
+ + (buf[3].toInt() and 0xFF shl 24))
+}
+
+fun bytes16ToUuid(buf: ByteArray): UUID {
+ var lsb: Long = 0
+ for (i in 15 downTo 8) {
+ lsb = lsb shl 8 or (buf[i].toLong() and 0xff)
+ }
+
+ var msb: Long = 0
+ for (i in 7 downTo 0) {
+ msb = msb shl 8 or (buf[i].toLong() and 0xff)
+ }
+
+ return UUID(msb, lsb)
+}
+
+/**
+ * Unpack date from 5 byte format. The five bytes at 'offset' are unpacked
+ * to a java.util.Date instance.
+ */
+fun bytes5ToDate(buf: ByteArray, calendar: Calendar = Calendar.getInstance()): DateInstant {
+ val dateSize = 5
+ val cDate = ByteArray(dateSize)
+ System.arraycopy(buf, 0, cDate, 0, dateSize)
+
+ val readOffset = 0
+ val dw1 = byteToUInt(cDate[readOffset])
+ val dw2 = byteToUInt(cDate[readOffset + 1])
+ val dw3 = byteToUInt(cDate[readOffset + 2])
+ val dw4 = byteToUInt(cDate[readOffset + 3])
+ val dw5 = byteToUInt(cDate[readOffset + 4])
+
+ // Unpack 5 byte structure to date and time
+ val year = dw1 shl 6 or (dw2 shr 2)
+ val month = dw2 and 0x00000003 shl 2 or (dw3 shr 6)
+
+ val day = dw3 shr 1 and 0x0000001F
+ val hour = dw3 and 0x00000001 shl 4 or (dw4 shr 4)
+ val minute = dw4 and 0x0000000F shl 2 or (dw5 shr 6)
+ val second = dw5 and 0x0000003F
+
+ // File format is a 1 based month, java Calendar uses a zero based month
+ // File format is a 1 based day, java Calendar uses a 1 based day
+ calendar.set(year, month - 1, day, hour, minute, second)
+
+ return DateInstant(calendar.time)
+}
+
+/**
+ * Convert an unsigned Integer to byte
+ */
+fun uIntToByte(value: Int): Byte {
+ return (value and 0xFF).toByte()
+}
+
+/**
+ * Write a 32-bit value.
+ */
+fun intTo4Bytes(value: Int): ByteArray {
+ val buf = ByteArray(4)
+ for (i in 0 until 4) {
+ buf[i] = (value.ushr(8 * i) and 0xFF).toByte()
+ }
+ return buf
+}
+
+/**
+ * Write an unsigned 16-bit value
+ */
+fun uShortTo2Bytes(value: Int): ByteArray {
+ val buf = ByteArray(2)
+ buf[0] = (value and 0x00FF).toByte()
+ buf[1] = (value and 0xFF00 shr 8).toByte()
+ return buf
+}
+
+fun longTo8Bytes(value: Long): ByteArray {
+ val buf = ByteArray(8)
+ for (i in 0 until 8) {
+ buf[i] = (value.ushr(8 * i) and 0xFF).toByte()
+ }
+ return buf
+}
+
+fun uuidTo16Bytes(uuid: UUID): ByteArray {
+ val buf = ByteArray(16)
+ for (i in 0 until 8) {
+ buf[i] = (uuid.mostSignificantBits.ushr(8 * i) and 0xFF).toByte()
+ }
+ for (i in 8 until 16) {
+ buf[i] = (uuid.leastSignificantBits.ushr(8 * i) and 0xFF).toByte()
+ }
+ return buf
+}
+
+fun dateTo5Bytes(date: Date?, calendar: Calendar = Calendar.getInstance()): ByteArray? {
+ if (date == null) {
+ return null
+ }
+
+ val buf = ByteArray(5)
+ calendar.time = date
+
+ val year = calendar.get(Calendar.YEAR)
+ // File format is a 1 based month, java Calendar uses a zero based month
+ val month = calendar.get(Calendar.MONTH) + 1
+ // File format is a 1 based day, java Calendar uses a 1 based day
+ val day = calendar.get(Calendar.DAY_OF_MONTH)
+ val hour = calendar.get(Calendar.HOUR_OF_DAY)
+ val minute = calendar.get(Calendar.MINUTE)
+ val second = calendar.get(Calendar.SECOND)
+
+ buf[0] = uIntToByte(year shr 6 and 0x0000003F)
+ buf[1] = uIntToByte(year and 0x0000003F shl 2 or (month shr 2 and 0x00000003))
+ buf[2] = (month and 0x00000003 shl 6
+ or (day and 0x0000001F shl 1) or (hour shr 4 and 0x00000001)).toByte()
+ buf[3] = (hour and 0x0000000F shl 4 or (minute shr 2 and 0x0000000F)).toByte()
+ buf[4] = (minute and 0x00000003 shl 6 or (second and 0x0000003F)).toByte()
+
+ return buf
+}
+
+
+/** Convert a byte to an unsigned byte */
+fun byteToUInt(byte: Byte): Int {
+ return byte.toInt() and 0xFF
+}
diff --git a/app/src/main/java/com/kunzisoft/keepass/tasks/ActionRunnable.kt b/app/src/main/java/com/kunzisoft/keepass/tasks/ActionRunnable.kt
index e75362079..0b5b4f09e 100644
--- a/app/src/main/java/com/kunzisoft/keepass/tasks/ActionRunnable.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/tasks/ActionRunnable.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.tasks
diff --git a/app/src/main/java/com/kunzisoft/keepass/tasks/AttachmentFileAsyncTask.kt b/app/src/main/java/com/kunzisoft/keepass/tasks/AttachmentFileAsyncTask.kt
new file mode 100644
index 000000000..1fafbb0ee
--- /dev/null
+++ b/app/src/main/java/com/kunzisoft/keepass/tasks/AttachmentFileAsyncTask.kt
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
+package com.kunzisoft.keepass.tasks
+
+import android.content.ContentResolver
+import android.net.Uri
+import android.os.AsyncTask
+import android.util.Log
+import com.kunzisoft.keepass.model.AttachmentState
+import com.kunzisoft.keepass.model.EntryAttachment
+import com.kunzisoft.keepass.notifications.AttachmentFileNotificationService
+
+class AttachmentFileAsyncTask(
+ private val fileUri: Uri,
+ private val attachmentNotification: AttachmentFileNotificationService.AttachmentNotification,
+ private val contentResolver: ContentResolver)
+ : AsyncTask() {
+
+ private val updateMinFrequency = 1000
+ private var previousSaveTime = System.currentTimeMillis()
+ var onUpdate: ((Uri, EntryAttachment, Int)->Unit)? = null
+
+ override fun onPreExecute() {
+ super.onPreExecute()
+ attachmentNotification.attachmentTask = this
+ attachmentNotification.entryAttachment.apply {
+ downloadState = AttachmentState.START
+ downloadProgression = 0
+ }
+ onUpdate?.invoke(fileUri, attachmentNotification.entryAttachment, attachmentNotification.notificationId)
+ }
+
+ override fun doInBackground(vararg params: Void?): Boolean {
+ try {
+ attachmentNotification.entryAttachment.apply {
+ downloadState = AttachmentState.IN_PROGRESS
+ binaryAttachment.download(fileUri, contentResolver, 1024) { percent ->
+ publishProgress(percent)
+ }
+ }
+ } catch (e: Exception) {
+ return false
+ }
+ return true
+ }
+
+ override fun onProgressUpdate(vararg values: Int?) {
+ super.onProgressUpdate(*values)
+ val percent = values[0] ?: 0
+
+ val currentTime = System.currentTimeMillis()
+ if (previousSaveTime + updateMinFrequency < currentTime) {
+ attachmentNotification.entryAttachment.apply {
+ downloadState = AttachmentState.IN_PROGRESS
+ downloadProgression = percent
+ }
+ onUpdate?.invoke(fileUri, attachmentNotification.entryAttachment, attachmentNotification.notificationId)
+ Log.d(TAG, "Download file $fileUri : $percent%")
+ previousSaveTime = currentTime
+ }
+ }
+
+ override fun onPostExecute(result: Boolean) {
+ super.onPostExecute(result)
+ attachmentNotification.attachmentTask = null
+ attachmentNotification.entryAttachment.apply {
+ downloadState = if (result) AttachmentState.COMPLETE else AttachmentState.ERROR
+ downloadProgression = 100
+ }
+ onUpdate?.invoke(fileUri, attachmentNotification.entryAttachment, attachmentNotification.notificationId)
+ }
+
+ companion object {
+ private val TAG = AttachmentFileAsyncTask::class.java.name
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/kunzisoft/keepass/tasks/AttachmentFileBinderManager.kt b/app/src/main/java/com/kunzisoft/keepass/tasks/AttachmentFileBinderManager.kt
new file mode 100644
index 000000000..5dcd2b8a5
--- /dev/null
+++ b/app/src/main/java/com/kunzisoft/keepass/tasks/AttachmentFileBinderManager.kt
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
+package com.kunzisoft.keepass.tasks
+
+import android.content.ComponentName
+import android.content.Context.BIND_ABOVE_CLIENT
+import android.content.Context.BIND_NOT_FOREGROUND
+import android.content.Intent
+import android.content.ServiceConnection
+import android.net.Uri
+import android.os.Bundle
+import android.os.IBinder
+import androidx.fragment.app.FragmentActivity
+import com.kunzisoft.keepass.model.EntryAttachment
+import com.kunzisoft.keepass.notifications.AttachmentFileNotificationService
+import com.kunzisoft.keepass.notifications.AttachmentFileNotificationService.Companion.ACTION_ATTACHMENT_FILE_START_DOWNLOAD
+
+class AttachmentFileBinderManager(private val activity: FragmentActivity) {
+
+ var onActionTaskListener: AttachmentFileNotificationService.ActionTaskListener? = null
+
+ private var mIntentTask = Intent(activity, AttachmentFileNotificationService::class.java)
+
+ private var mBinder: AttachmentFileNotificationService.ActionTaskBinder? = null
+
+ private var mServiceConnection: ServiceConnection? = null
+
+ private val mActionTaskListener = object: AttachmentFileNotificationService.ActionTaskListener {
+ override fun onAttachmentProgress(fileUri: Uri, attachment: EntryAttachment) {
+ onActionTaskListener?.onAttachmentProgress(fileUri, attachment)
+ }
+ }
+
+ @Synchronized
+ fun registerProgressTask() {
+ // Check if a service is currently running else do nothing
+ if (mServiceConnection == null) {
+ mServiceConnection = object : ServiceConnection {
+ override fun onServiceConnected(name: ComponentName?, serviceBinder: IBinder?) {
+ mBinder = (serviceBinder as AttachmentFileNotificationService.ActionTaskBinder).apply {
+ addActionTaskListener(mActionTaskListener)
+ }
+ mBinder?.getService()?.checkCurrentAttachmentProgress()
+ }
+
+ override fun onServiceDisconnected(name: ComponentName?) {
+ mBinder?.removeActionTaskListener(mActionTaskListener)
+ mBinder = null
+ }
+ }
+ }
+
+ mServiceConnection?.let {
+ activity.bindService(mIntentTask, it, BIND_NOT_FOREGROUND or BIND_ABOVE_CLIENT)
+ }
+ }
+
+ @Synchronized
+ fun unregisterProgressTask() {
+ onActionTaskListener = null
+
+ mBinder?.removeActionTaskListener(mActionTaskListener)
+ mBinder = null
+
+ mServiceConnection?.let {
+ activity.unbindService(it)
+ }
+ mServiceConnection = null
+ }
+
+ @Synchronized
+ private fun start(bundle: Bundle? = null, actionTask: String) {
+ activity.stopService(mIntentTask)
+ if (bundle != null)
+ mIntentTask.putExtras(bundle)
+ activity.runOnUiThread {
+ mIntentTask.action = actionTask
+ activity.startService(mIntentTask)
+ }
+ }
+
+ fun startDownloadAttachment(downloadFileUri: Uri,
+ entryAttachment: EntryAttachment) {
+ start(Bundle().apply {
+ putParcelable(AttachmentFileNotificationService.DOWNLOAD_FILE_URI_KEY, downloadFileUri)
+ putParcelable(AttachmentFileNotificationService.ATTACHMENT_KEY, entryAttachment)
+ }, ACTION_ATTACHMENT_FILE_START_DOWNLOAD)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/kunzisoft/keepass/tasks/ProgressTaskDialogFragment.kt b/app/src/main/java/com/kunzisoft/keepass/tasks/ProgressTaskDialogFragment.kt
index 583ff7f71..5312c348d 100644
--- a/app/src/main/java/com/kunzisoft/keepass/tasks/ProgressTaskDialogFragment.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/tasks/ProgressTaskDialogFragment.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.tasks
diff --git a/app/src/main/java/com/kunzisoft/keepass/tasks/ProgressTaskUpdater.kt b/app/src/main/java/com/kunzisoft/keepass/tasks/ProgressTaskUpdater.kt
index ad7499c52..b3fed4b9f 100644
--- a/app/src/main/java/com/kunzisoft/keepass/tasks/ProgressTaskUpdater.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/tasks/ProgressTaskUpdater.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.tasks
diff --git a/app/src/main/java/com/kunzisoft/keepass/timeout/ClipboardHelper.kt b/app/src/main/java/com/kunzisoft/keepass/timeout/ClipboardHelper.kt
index 1697c8e77..2ee394d49 100644
--- a/app/src/main/java/com/kunzisoft/keepass/timeout/ClipboardHelper.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/timeout/ClipboardHelper.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.timeout
@@ -37,10 +37,16 @@ import java.util.*
class ClipboardHelper(private val context: Context) {
- private val clipboardManager: ClipboardManager =
- context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
+ private var mClipboardManager: ClipboardManager? = null
+
private val mTimer = Timer()
+ private fun getClipboardManager(): ClipboardManager? {
+ if (mClipboardManager == null)
+ mClipboardManager = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager?
+ return mClipboardManager
+ }
+
@JvmOverloads
fun timeoutCopyToClipboard(text: String, toastString: String = "") {
if (toastString.isNotEmpty())
@@ -64,8 +70,8 @@ class ClipboardHelper(private val context: Context) {
}
fun getClipboard(context: Context): CharSequence {
- if (clipboardManager.hasPrimaryClip()) {
- val data = clipboardManager.primaryClip
+ if (getClipboardManager()?.hasPrimaryClip() == true) {
+ val data = getClipboardManager()?.primaryClip
if (data!!.itemCount > 0) {
val text = data.getItemAt(0).coerceToText(context)
if (text != null) {
@@ -84,7 +90,7 @@ class ClipboardHelper(private val context: Context) {
@Throws(ClipboardException::class)
fun copyToClipboard(label: String, value: String) {
try {
- clipboardManager.primaryClip = ClipData.newPlainText(label, value)
+ getClipboardManager()?.primaryClip = ClipData.newPlainText(label, value)
} catch (e: Exception) {
throw ClipboardException(e)
}
@@ -95,7 +101,7 @@ class ClipboardHelper(private val context: Context) {
@JvmOverloads
fun cleanClipboard(label: String = "") {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
- clipboardManager.clearPrimaryClip()
+ getClipboardManager()?.clearPrimaryClip()
} else {
copyToClipboard(label, "")
}
diff --git a/app/src/main/java/com/kunzisoft/keepass/timeout/TimeoutHelper.kt b/app/src/main/java/com/kunzisoft/keepass/timeout/TimeoutHelper.kt
index 26aaa412f..cb56119f5 100644
--- a/app/src/main/java/com/kunzisoft/keepass/timeout/TimeoutHelper.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/timeout/TimeoutHelper.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.timeout
diff --git a/app/src/main/java/com/kunzisoft/keepass/utils/BroadcastAction.kt b/app/src/main/java/com/kunzisoft/keepass/utils/BroadcastAction.kt
index 8b8f9d8b2..b3f1f4436 100644
--- a/app/src/main/java/com/kunzisoft/keepass/utils/BroadcastAction.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/utils/BroadcastAction.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.utils
const val DATABASE_START_TASK_ACTION = "com.kunzisoft.keepass.DATABASE_START_TASK_ACTION"
diff --git a/app/src/main/java/com/kunzisoft/keepass/utils/DatabaseInputOutputUtils.kt b/app/src/main/java/com/kunzisoft/keepass/utils/DatabaseInputOutputUtils.kt
deleted file mode 100644
index 1f65bba78..000000000
--- a/app/src/main/java/com/kunzisoft/keepass/utils/DatabaseInputOutputUtils.kt
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
- *
- * This file is part of KeePass DX.
- *
- * KeePass DX is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * KeePass DX is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
- *
- *
-KeePass for J2ME
-
-Copyright 2007 Naomaru Itoi
-
-This file was derived from
-
-Java clone of KeePass - A KeePass file viewer for Java
-Copyright 2006 Bill Zwicky
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; version 2
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-package com.kunzisoft.keepass.utils
-
-import com.kunzisoft.keepass.database.element.DateInstant
-import com.kunzisoft.keepass.stream.LEDataInputStream
-import com.kunzisoft.keepass.stream.LEDataOutputStream
-import java.io.IOException
-import java.io.OutputStream
-import java.nio.charset.Charset
-import java.util.*
-
-
-/**
- * Tools for slicing and dicing Java and KeePass data types.
- *
- * @author Bill Zwicky @pobox.com>
- */
-object DatabaseInputOutputUtils {
-
- var ULONG_MAX_VALUE: Long = -1
-
- private val defaultCharset = Charset.forName("UTF-8")
-
- private val CRLFbuf = byteArrayOf(0x0D, 0x0A)
- private val CRLF = String(CRLFbuf)
- private val SEP = System.getProperty("line.separator")
- private val REPLACE = SEP != CRLF
-
- /** Read an unsigned byte */
- fun readUByte(buf: ByteArray, offset: Int): Int {
- return buf[offset].toInt() and 0xFF
- }
-
- /**
- * Write an unsigned byte
- */
- fun writeUByte(`val`: Int, buf: ByteArray, offset: Int) {
- buf[offset] = (`val` and 0xFF).toByte()
- }
-
- fun writeUByte(`val`: Int): Byte {
- val buf = ByteArray(1)
-
- writeUByte(`val`, buf, 0)
-
- return buf[0]
- }
-
- /**
- * Return len of null-terminated string (i.e. distance to null)
- * within a byte buffer.
- */
- private fun strlen(buf: ByteArray, offset: Int): Int {
- var len = 0
- while (buf[offset + len].toInt() != 0)
- len++
- return len
- }
-
- fun readCString(buf: ByteArray, offset: Int): String {
- var jstring = String(buf, offset, strlen(buf, offset), defaultCharset)
-
- if (REPLACE) {
- jstring = jstring.replace(CRLF, SEP!!)
- }
-
- return jstring
- }
-
- @Throws(IOException::class)
- fun writeCString(string: String?, os: OutputStream): Int {
- var str = string
- if (str == null) {
- // Write out a null character
- os.write(LEDataOutputStream.writeIntBuf(1))
- os.write(0x00)
- return 0
- }
-
- if (REPLACE) {
- str = str.replace(SEP!!, CRLF)
- }
-
- val initial = str.toByteArray(defaultCharset)
-
- val length = initial.size + 1
- os.write(LEDataOutputStream.writeIntBuf(length))
- os.write(initial)
- os.write(0x00)
-
- return length
- }
-
- /**
- * Unpack date from 5 byte format. The five bytes at 'offset' are unpacked
- * to a java.util.Date instance.
- */
- fun readCDate(buf: ByteArray, offset: Int, calendar: Calendar = Calendar.getInstance()): DateInstant {
- val dateSize = 5
- val cDate = ByteArray(dateSize)
- System.arraycopy(buf, offset, cDate, 0, dateSize)
-
- val readOffset = 0
- val dw1 = readUByte(cDate, readOffset)
- val dw2 = readUByte(cDate, readOffset + 1)
- val dw3 = readUByte(cDate, readOffset + 2)
- val dw4 = readUByte(cDate, readOffset + 3)
- val dw5 = readUByte(cDate, readOffset + 4)
-
- // Unpack 5 byte structure to date and time
- val year = dw1 shl 6 or (dw2 shr 2)
- val month = dw2 and 0x00000003 shl 2 or (dw3 shr 6)
-
- val day = dw3 shr 1 and 0x0000001F
- val hour = dw3 and 0x00000001 shl 4 or (dw4 shr 4)
- val minute = dw4 and 0x0000000F shl 2 or (dw5 shr 6)
- val second = dw5 and 0x0000003F
-
- // File format is a 1 based month, java Calendar uses a zero based month
- // File format is a 1 based day, java Calendar uses a 1 based day
- calendar.set(year, month - 1, day, hour, minute, second)
-
- return DateInstant(calendar.time)
- }
-
- fun writeCDate(date: Date?, calendar: Calendar = Calendar.getInstance()): ByteArray? {
- if (date == null) {
- return null
- }
-
- val buf = ByteArray(5)
- calendar.time = date
-
- val year = calendar.get(Calendar.YEAR)
- // File format is a 1 based month, java Calendar uses a zero based month
- val month = calendar.get(Calendar.MONTH) + 1
- // File format is a 1 based day, java Calendar uses a 1 based day
- val day = calendar.get(Calendar.DAY_OF_MONTH)
- val hour = calendar.get(Calendar.HOUR_OF_DAY)
- val minute = calendar.get(Calendar.MINUTE)
- val second = calendar.get(Calendar.SECOND)
-
- buf[0] = writeUByte(year shr 6 and 0x0000003F)
- buf[1] = writeUByte(year and 0x0000003F shl 2 or (month shr 2 and 0x00000003))
- buf[2] = (month and 0x00000003 shl 6
- or (day and 0x0000001F shl 1) or (hour shr 4 and 0x00000001)).toByte()
- buf[3] = (hour and 0x0000000F shl 4 or (minute shr 2 and 0x0000000F)).toByte()
- buf[4] = (minute and 0x00000003 shl 6 or (second and 0x0000003F)).toByte()
-
- return buf
- }
-
- fun readPassword(buf: ByteArray, offset: Int): String {
- return String(buf, offset, strlen(buf, offset), defaultCharset)
- }
-
- @Throws(IOException::class)
- fun writePassword(str: String, os: OutputStream): Int {
- val initial = str.toByteArray(defaultCharset)
- val length = initial.size + 1
- os.write(LEDataOutputStream.writeIntBuf(length))
- os.write(initial)
- os.write(0x00)
- return length
- }
-
- fun readBytes(buf: ByteArray, offset: Int, len: Int): ByteArray {
- val binaryData = ByteArray(len)
- System.arraycopy(buf, offset, binaryData, 0, len)
- return binaryData
- }
-
- @Throws(IOException::class)
- fun writeBytes(data: ByteArray?, dataLen: Int, os: OutputStream): Int {
- os.write(LEDataOutputStream.writeIntBuf(dataLen))
- if (data != null) {
- os.write(data)
- }
- return dataLen
- }
-
- fun bytesToUuid(buf: ByteArray): UUID {
- return LEDataInputStream.readUuid(buf, 0)
- }
-
- fun uuidToBytes(uuid: UUID): ByteArray {
- val buf = ByteArray(16)
- LEDataOutputStream.writeLong(uuid.mostSignificantBits, buf, 0)
- LEDataOutputStream.writeLong(uuid.leastSignificantBits, buf, 8)
- return buf
- }
-}
diff --git a/app/src/main/java/com/kunzisoft/keepass/utils/ExternalFileManager.kt b/app/src/main/java/com/kunzisoft/keepass/utils/ExternalFileManager.kt
new file mode 100644
index 000000000..bb2114f1e
--- /dev/null
+++ b/app/src/main/java/com/kunzisoft/keepass/utils/ExternalFileManager.kt
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
+package com.kunzisoft.keepass.utils
+
+import android.app.Activity
+import android.content.Intent
+import android.content.pm.PackageManager
+import android.net.Uri
+import android.os.Build
+import androidx.fragment.app.FragmentActivity
+import com.kunzisoft.keepass.activities.dialogs.BrowserDialogFragment
+
+
+private var CREATE_FILE_REQUEST_CODE_DEFAULT = 3853
+private var fileRequestCodes = ArrayList()
+
+fun getUnusedCreateFileRequestCode(): Int {
+ val newCreateFileRequestCode = CREATE_FILE_REQUEST_CODE_DEFAULT++
+ fileRequestCodes.add(newCreateFileRequestCode)
+ return newCreateFileRequestCode
+}
+
+fun allowCreateDocumentByStorageAccessFramework(packageManager: PackageManager): Boolean {
+
+ return Intent(Intent.ACTION_CREATE_DOCUMENT).apply {
+ addCategory(Intent.CATEGORY_OPENABLE)
+ type = "application/x-keepass"
+ }.resolveActivity(packageManager) != null
+}
+
+fun createDocument(activity: FragmentActivity,
+ titleString: String,
+ typeString: String = "application/octet-stream"): Int? {
+
+ val idCode = getUnusedCreateFileRequestCode()
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
+ try {
+ activity.startActivityForResult(Intent(Intent.ACTION_CREATE_DOCUMENT).apply {
+ addCategory(Intent.CATEGORY_OPENABLE)
+ type = typeString
+ putExtra(Intent.EXTRA_TITLE, titleString)
+ }, idCode)
+ return idCode
+ } catch (e: Exception) {
+ BrowserDialogFragment().show(activity.supportFragmentManager, "browserDialog")
+ }
+ } else {
+ BrowserDialogFragment().show(activity.supportFragmentManager, "browserDialog")
+ }
+
+ return null
+}
+
+fun onCreateDocumentResult(requestCode: Int, resultCode: Int, data: Intent?,
+ action: (fileCreated: Uri?)->Unit) {
+ // Retrieve the created URI from the file manager
+ if (fileRequestCodes.contains(requestCode) && resultCode == Activity.RESULT_OK) {
+ action.invoke(data?.data)
+ fileRequestCodes.remove(requestCode)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/kunzisoft/keepass/utils/FileDatabaseInfo.kt b/app/src/main/java/com/kunzisoft/keepass/utils/FileDatabaseInfo.kt
index 4df403ac0..e5cb50942 100644
--- a/app/src/main/java/com/kunzisoft/keepass/utils/FileDatabaseInfo.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/utils/FileDatabaseInfo.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.utils
import android.content.Context
diff --git a/app/src/main/java/com/kunzisoft/keepass/utils/FileInfo.kt b/app/src/main/java/com/kunzisoft/keepass/utils/FileInfo.kt
index 4117539f8..4041f0422 100644
--- a/app/src/main/java/com/kunzisoft/keepass/utils/FileInfo.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/utils/FileInfo.kt
@@ -1,28 +1,28 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.utils
import android.content.Context
import android.net.Uri
+import android.text.format.Formatter
import androidx.documentfile.provider.DocumentFile
-import com.kunzisoft.keepass.R
import java.io.File
import java.io.Serializable
import java.text.DateFormat
@@ -84,7 +84,7 @@ open class FileInfo : Serializable {
}
fun getSizeString(): String {
- return (size.toString() + " " + context.getString(R.string.bytes))
+ return Formatter.formatFileSize(context, size)
}
companion object {
diff --git a/app/src/main/java/com/kunzisoft/keepass/utils/MenuUtil.kt b/app/src/main/java/com/kunzisoft/keepass/utils/MenuUtil.kt
index efd5d24a0..17106aec6 100644
--- a/app/src/main/java/com/kunzisoft/keepass/utils/MenuUtil.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/utils/MenuUtil.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2018 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.utils
diff --git a/app/src/main/java/com/kunzisoft/keepass/utils/ObjectNameResource.kt b/app/src/main/java/com/kunzisoft/keepass/utils/ObjectNameResource.kt
index 180568fd5..4bcc8eefb 100644
--- a/app/src/main/java/com/kunzisoft/keepass/utils/ObjectNameResource.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/utils/ObjectNameResource.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2018 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.utils
diff --git a/app/src/main/java/com/kunzisoft/keepass/utils/ParcelableUtil.kt b/app/src/main/java/com/kunzisoft/keepass/utils/ParcelableUtil.kt
index ada214fc3..afd6b3834 100644
--- a/app/src/main/java/com/kunzisoft/keepass/utils/ParcelableUtil.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/utils/ParcelableUtil.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.utils
diff --git a/app/src/main/java/com/kunzisoft/keepass/utils/SingletonHolder.kt b/app/src/main/java/com/kunzisoft/keepass/utils/SingletonHolder.kt
index 8e0b9aeaf..d9ea42e02 100644
--- a/app/src/main/java/com/kunzisoft/keepass/utils/SingletonHolder.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/utils/SingletonHolder.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.utils
open class SingletonHolderParameter(private val constructor: (A) -> T) {
diff --git a/app/src/main/java/com/kunzisoft/keepass/utils/StringDatabaseKDBUtils.kt b/app/src/main/java/com/kunzisoft/keepass/utils/StringDatabaseKDBUtils.kt
new file mode 100644
index 000000000..ca9141fdb
--- /dev/null
+++ b/app/src/main/java/com/kunzisoft/keepass/utils/StringDatabaseKDBUtils.kt
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
+
+package com.kunzisoft.keepass.utils
+
+import com.kunzisoft.keepass.stream.intTo4Bytes
+import java.io.IOException
+import java.io.OutputStream
+import java.nio.charset.Charset
+
+
+/**
+ * Tools for slicing and dicing Java and KeePass data types.
+ */
+object StringDatabaseKDBUtils {
+
+ private val defaultCharset = Charset.forName("UTF-8")
+
+ private val CRLFbuf = byteArrayOf(0x0D, 0x0A)
+ private val CRLF = String(CRLFbuf)
+ private val SEP = System.getProperty("line.separator")
+ private val REPLACE = SEP != CRLF
+
+ fun bytesToString(buf: ByteArray, replaceCRLF: Boolean = true): String {
+ // length of null-terminated string (i.e. distance to null) within a byte buffer.
+ var len = 0
+ while (buf[len].toInt() != 0) {
+ len++
+ }
+ // Get string
+ var jstring = String(buf, 0, len, defaultCharset)
+ if (replaceCRLF && REPLACE) {
+ jstring = jstring.replace(CRLF, SEP!!)
+ }
+ return jstring
+ }
+
+ @Throws(IOException::class)
+ fun writeStringToBytes(string: String?, os: OutputStream): Int {
+ var str = string
+ if (str == null) {
+ // Write out a null character
+ os.write(intTo4Bytes(1))
+ os.write(0x00)
+ return 0
+ }
+
+ if (REPLACE) {
+ str = str.replace(SEP!!, CRLF)
+ }
+
+ val initial = str.toByteArray(defaultCharset)
+
+ val length = initial.size + 1
+ os.write(intTo4Bytes(length))
+ os.write(initial)
+ os.write(0x00)
+
+ return length
+ }
+}
diff --git a/app/src/main/java/com/kunzisoft/keepass/utils/StringUtil.kt b/app/src/main/java/com/kunzisoft/keepass/utils/StringUtil.kt
index 901084595..bcaf91f7c 100644
--- a/app/src/main/java/com/kunzisoft/keepass/utils/StringUtil.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/utils/StringUtil.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.utils
diff --git a/app/src/main/java/com/kunzisoft/keepass/utils/UriUtil.kt b/app/src/main/java/com/kunzisoft/keepass/utils/UriUtil.kt
index c70b6630f..3ded3cb6c 100644
--- a/app/src/main/java/com/kunzisoft/keepass/utils/UriUtil.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/utils/UriUtil.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.utils
diff --git a/app/src/main/java/com/kunzisoft/keepass/utils/VariantDictionary.java b/app/src/main/java/com/kunzisoft/keepass/utils/VariantDictionary.java
index 477a026ec..8b10f4e0d 100644
--- a/app/src/main/java/com/kunzisoft/keepass/utils/VariantDictionary.java
+++ b/app/src/main/java/com/kunzisoft/keepass/utils/VariantDictionary.java
@@ -1,32 +1,36 @@
/*
* Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.utils;
-import com.kunzisoft.keepass.stream.LEDataInputStream;
-import com.kunzisoft.keepass.stream.LEDataOutputStream;
+import com.kunzisoft.keepass.stream.LittleEndianDataInputStream;
+import com.kunzisoft.keepass.stream.LittleEndianDataOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;
+import static com.kunzisoft.keepass.stream.StreamBytesUtilsKt.bytes4ToInt;
+import static com.kunzisoft.keepass.stream.StreamBytesUtilsKt.bytes4ToUInt;
+import static com.kunzisoft.keepass.stream.StreamBytesUtilsKt.bytes64ToLong;
+
public class VariantDictionary {
private static final int VdVersion = 0x0100;
private static final int VdmCritical = 0xFF00;
@@ -51,7 +55,6 @@ public class VariantDictionary {
this.type = type;
this.value = value;
}
-
}
private Object getValue(String name) {
@@ -87,7 +90,7 @@ public class VariantDictionary {
public void setByteArray(String name, byte[] value) { putType(VdType.ByteArray, name, value); }
public byte[] getByteArray(String name) { return (byte[])getValue(name); }
- public static VariantDictionary deserialize(LEDataInputStream lis) throws IOException {
+ public static VariantDictionary deserialize(LittleEndianDataInputStream lis) throws IOException {
VariantDictionary d = new VariantDictionary();
int version = lis.readUShort();
@@ -122,12 +125,12 @@ public class VariantDictionary {
switch (bType) {
case VdType.UInt32:
if (valueLen == 4) {
- d.setUInt32(name, LEDataInputStream.readUInt(valueBuf, 0));
+ d.setUInt32(name, bytes4ToUInt(valueBuf));
}
break;
case VdType.UInt64:
if (valueLen == 8) {
- d.setUInt64(name, LEDataInputStream.readLong(valueBuf, 0));
+ d.setUInt64(name, bytes64ToLong(valueBuf));
}
break;
case VdType.Bool:
@@ -137,12 +140,12 @@ public class VariantDictionary {
break;
case VdType.Int32:
if (valueLen == 4) {
- d.setInt32(name, LEDataInputStream.readInt(valueBuf, 0));
+ d.setInt32(name, bytes4ToInt(valueBuf));
}
break;
case VdType.Int64:
if (valueLen == 8) {
- d.setInt64(name, LEDataInputStream.readLong(valueBuf, 0));
+ d.setInt64(name, bytes64ToLong(valueBuf));
}
break;
case VdType.String:
@@ -152,7 +155,6 @@ public class VariantDictionary {
d.setByteArray(name, valueBuf);
break;
default:
- assert (false);
break;
}
}
@@ -160,9 +162,9 @@ public class VariantDictionary {
return d;
}
- public static void serialize(VariantDictionary d, LEDataOutputStream los) throws IOException{
+ public static void serialize(VariantDictionary d,
+ LittleEndianDataOutputStream los) throws IOException{
if (los == null) {
- assert(false);
return;
}
@@ -174,7 +176,6 @@ public class VariantDictionary {
try {
nameBuf = name.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
- assert(false);
throw new IOException("Couldn't encode parameter name.");
}
@@ -219,13 +220,11 @@ public class VariantDictionary {
los.write(buf);
break;
default:
- assert(false);
break;
}
}
los.write(VdType.None);
-
}
public void copyTo(VariantDictionary d) {
@@ -236,7 +235,7 @@ public class VariantDictionary {
dict.put(key, value);
}
}
-;
+
public int size() {
return dict.size();
}
diff --git a/app/src/main/java/com/kunzisoft/keepass/view/AddNodeButtonView.kt b/app/src/main/java/com/kunzisoft/keepass/view/AddNodeButtonView.kt
index ef0b425fd..4fdfbecdb 100644
--- a/app/src/main/java/com/kunzisoft/keepass/view/AddNodeButtonView.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/view/AddNodeButtonView.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.view
diff --git a/app/src/main/java/com/kunzisoft/keepass/view/AdvancedUnlockInfoView.kt b/app/src/main/java/com/kunzisoft/keepass/view/AdvancedUnlockInfoView.kt
index 366d730cc..5dc421bdb 100644
--- a/app/src/main/java/com/kunzisoft/keepass/view/AdvancedUnlockInfoView.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/view/AdvancedUnlockInfoView.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.view
import android.content.Context
diff --git a/app/src/main/java/com/kunzisoft/keepass/view/EntryContentsView.kt b/app/src/main/java/com/kunzisoft/keepass/view/EntryContentsView.kt
index fdfbff4a7..74f64fefd 100644
--- a/app/src/main/java/com/kunzisoft/keepass/view/EntryContentsView.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/view/EntryContentsView.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*/
package com.kunzisoft.keepass.view
@@ -32,13 +32,17 @@ import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.kunzisoft.keepass.R
+import com.kunzisoft.keepass.adapters.EntryAttachmentsAdapter
import com.kunzisoft.keepass.adapters.EntryHistoryAdapter
-import com.kunzisoft.keepass.database.element.Entry
import com.kunzisoft.keepass.database.element.DateInstant
+import com.kunzisoft.keepass.database.element.Entry
import com.kunzisoft.keepass.database.element.security.ProtectedString
+import com.kunzisoft.keepass.model.EntryAttachment
import com.kunzisoft.keepass.otp.OtpElement
import com.kunzisoft.keepass.otp.OtpType
import java.util.*
+import androidx.recyclerview.widget.SimpleItemAnimator
+
class EntryContentsView @JvmOverloads constructor(context: Context,
var attrs: AttributeSet? = null,
@@ -78,12 +82,16 @@ class EntryContentsView @JvmOverloads constructor(context: Context,
private val expiresImageView: ImageView
private val expiresDateView: TextView
- private val uuidView: TextView
+ private val attachmentsContainerView: View
+ private val attachmentsListView: RecyclerView
+ private val attachmentsAdapter = EntryAttachmentsAdapter(context)
private val historyContainerView: View
private val historyListView: RecyclerView
private val historyAdapter = EntryHistoryAdapter(context)
+ private val uuidView: TextView
+
val isUserNamePresent: Boolean
get() = userNameContainerView.visibility == View.VISIBLE
@@ -116,14 +124,20 @@ class EntryContentsView @JvmOverloads constructor(context: Context,
extrasContainerView = findViewById(R.id.extra_strings_container)
extrasView = findViewById(R.id.extra_strings)
+ attachmentsContainerView = findViewById(R.id.entry_attachments_container)
+ attachmentsListView = findViewById(R.id.entry_attachments_list)
+ attachmentsListView?.apply {
+ layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, true)
+ adapter = attachmentsAdapter
+ (itemAnimator as SimpleItemAnimator).supportsChangeAnimations = false
+ }
+
creationDateView = findViewById(R.id.entry_created)
modificationDateView = findViewById(R.id.entry_modified)
lastAccessDateView = findViewById(R.id.entry_accessed)
expiresImageView = findViewById(R.id.entry_expires_image)
expiresDateView = findViewById(R.id.entry_expires_date)
- uuidView = findViewById(R.id.entry_UUID)
-
historyContainerView = findViewById(R.id.entry_history_container)
historyListView = findViewById(R.id.entry_history_list)
historyListView?.apply {
@@ -131,6 +145,8 @@ class EntryContentsView @JvmOverloads constructor(context: Context,
adapter = historyAdapter
}
+ uuidView = findViewById(R.id.entry_UUID)
+
val attrColorAccent = intArrayOf(R.attr.colorAccent)
val taColorAccent = context.theme.obtainStyledAttributes(attrColorAccent)
colorAccent = taColorAccent.getColor(0, Color.BLACK)
@@ -332,6 +348,39 @@ class EntryContentsView @JvmOverloads constructor(context: Context,
uuidView.text = uuid.toString()
}
+ /* -------------
+ * Attachments
+ * -------------
+ */
+
+ fun showAttachments(show: Boolean) {
+ attachmentsContainerView.visibility = if (show) View.VISIBLE else View.GONE
+ }
+
+ fun refreshAttachments() {
+ attachmentsAdapter.notifyDataSetChanged()
+ }
+
+ fun assignAttachments(attachments: ArrayList) {
+ attachmentsAdapter.clear()
+ attachmentsAdapter.entryAttachmentsList.addAll(attachments)
+ }
+
+ fun updateAttachmentDownloadProgress(attachmentToDownload: EntryAttachment) {
+ attachmentsAdapter.updateProgress(attachmentToDownload)
+ }
+
+ fun onAttachmentClick(action: (attachment: EntryAttachment, position: Int)->Unit) {
+ attachmentsAdapter.onItemClickListener = { item, position ->
+ action.invoke(item, position)
+ }
+ }
+
+ /* -------------
+ * History
+ * -------------
+ */
+
fun showHistory(show: Boolean) {
historyContainerView.visibility = if (show) View.VISIBLE else View.GONE
}
diff --git a/app/src/main/java/com/kunzisoft/keepass/view/EntryCustomField.kt b/app/src/main/java/com/kunzisoft/keepass/view/EntryCustomField.kt
index 992660b5e..72c48d340 100644
--- a/app/src/main/java/com/kunzisoft/keepass/view/EntryCustomField.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/view/EntryCustomField.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.view
diff --git a/app/src/main/java/com/kunzisoft/keepass/view/EntryEditContentsView.kt b/app/src/main/java/com/kunzisoft/keepass/view/EntryEditContentsView.kt
index e92ca87ff..81a2f39b5 100644
--- a/app/src/main/java/com/kunzisoft/keepass/view/EntryEditContentsView.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/view/EntryEditContentsView.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.view
import android.content.Context
diff --git a/app/src/main/java/com/kunzisoft/keepass/view/EntryEditCustomField.kt b/app/src/main/java/com/kunzisoft/keepass/view/EntryEditCustomField.kt
index a023ff52e..7c67836f3 100644
--- a/app/src/main/java/com/kunzisoft/keepass/view/EntryEditCustomField.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/view/EntryEditCustomField.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.view
diff --git a/app/src/main/java/com/kunzisoft/keepass/view/MagikeyboardView.kt b/app/src/main/java/com/kunzisoft/keepass/view/MagikeyboardView.kt
index 3ec6d0604..86f2c0690 100644
--- a/app/src/main/java/com/kunzisoft/keepass/view/MagikeyboardView.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/view/MagikeyboardView.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.view
import android.content.Context
diff --git a/app/src/main/java/com/kunzisoft/keepass/view/ToolbarAction.kt b/app/src/main/java/com/kunzisoft/keepass/view/ToolbarAction.kt
index c55391f87..2e25e9192 100644
--- a/app/src/main/java/com/kunzisoft/keepass/view/ToolbarAction.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/view/ToolbarAction.kt
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2019 Jeremy Jamet / Kunzisoft.
+ *
+ * This file is part of KeePassDX.
+ *
+ * KeePassDX is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * KeePassDX is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KeePassDX. If not, see .
+ *
+ */
package com.kunzisoft.keepass.view
import android.content.Context
diff --git a/app/src/main/java/com/kunzisoft/keepass/view/ViewUtil.kt b/app/src/main/java/com/kunzisoft/keepass/view/ViewUtil.kt
index 610f531d1..1daec2536 100644
--- a/app/src/main/java/com/kunzisoft/keepass/view/ViewUtil.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/view/ViewUtil.kt
@@ -1,20 +1,20 @@
/*
* Copyright 2019 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
package com.kunzisoft.keepass.view
@@ -22,6 +22,7 @@ package com.kunzisoft.keepass.view
import android.animation.AnimatorSet
import android.animation.ValueAnimator
import android.graphics.Color
+import android.graphics.Paint
import android.graphics.Typeface
import android.text.method.PasswordTransformationMethod
import android.view.View
@@ -49,6 +50,13 @@ fun TextView.applyHiddenStyle(hide: Boolean) {
}
}
+fun TextView.strikeOut(strikeOut: Boolean) {
+ paintFlags = if (strikeOut)
+ paintFlags or Paint.STRIKE_THRU_TEXT_FLAG
+ else
+ paintFlags and Paint.STRIKE_THRU_TEXT_FLAG.inv()
+}
+
fun Snackbar.asError(): Snackbar {
this.view.apply {
setBackgroundColor(Color.RED)
diff --git a/app/src/main/jni/argon2/argon2_jni.c b/app/src/main/jni/argon2/argon2_jni.c
index 2f7c91b30..bf4d8c9c1 100644
--- a/app/src/main/jni/argon2/argon2_jni.c
+++ b/app/src/main/jni/argon2/argon2_jni.c
@@ -1,20 +1,20 @@
/*
- * Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
+ * Copyright 2020 Jeremy Jamet / Kunzisoft.
*
- * This file is part of KeePass DX.
+ * This file is part of KeePassDX.
*
- * KeePass DX is free software: you can redistribute it and/or modify
+ * KeePassDX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * KeePass DX is distributed in the hope that it will be useful,
+ * KeePassDX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with KeePass DX. If not, see .
+ * along with KeePassDX. If not, see .
*
*/
diff --git a/app/src/main/res/drawable-v21/foreground_progress_circle.xml b/app/src/main/res/drawable-v21/foreground_progress_circle.xml
new file mode 100644
index 000000000..521ee45fa
--- /dev/null
+++ b/app/src/main/res/drawable-v21/foreground_progress_circle.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/background_progress_circle.xml b/app/src/main/res/drawable/background_progress_circle.xml
new file mode 100644
index 000000000..95d7cb50a
--- /dev/null
+++ b/app/src/main/res/drawable/background_progress_circle.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/foreground_progress_circle.xml b/app/src/main/res/drawable/foreground_progress_circle.xml
new file mode 100644
index 000000000..a968913b1
--- /dev/null
+++ b/app/src/main/res/drawable/foreground_progress_circle.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_autorenew_white_24dp.xml b/app/src/main/res/drawable/ic_autorenew_white_24dp.xml
new file mode 100644
index 000000000..12fd45eab
--- /dev/null
+++ b/app/src/main/res/drawable/ic_autorenew_white_24dp.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_file_download_white_24dp.xml b/app/src/main/res/drawable/ic_file_download_white_24dp.xml
new file mode 100644
index 000000000..1a54e555b
--- /dev/null
+++ b/app/src/main/res/drawable/ic_file_download_white_24dp.xml
@@ -0,0 +1,7 @@
+
+
+
diff --git a/app/src/main/res/drawable/key_background.xml b/app/src/main/res/drawable/key_background.xml
index c51ec5a8a..ffcbdd58c 100644
--- a/app/src/main/res/drawable/key_background.xml
+++ b/app/src/main/res/drawable/key_background.xml
@@ -2,20 +2,20 @@
diff --git a/app/src/main/res/drawable/key_background_normal.xml b/app/src/main/res/drawable/key_background_normal.xml
index d8da0f8a1..c24861d79 100644
--- a/app/src/main/res/drawable/key_background_normal.xml
+++ b/app/src/main/res/drawable/key_background_normal.xml
@@ -2,20 +2,20 @@
.
+ along with KeePassDX. If not, see .
-->
+
.
+ along with KeePassDX. If not, see .
-->
.
+ along with KeePassDX. If not, see .
-->
.
+ along with KeePassDX. If not, see .
-->
-
+ tools:targetApi="o" >
-
+
-
+
-
+
-
-
+
-
+
+
+
+
+
-
\ No newline at end of file
+
+
diff --git a/app/src/main/res/layout/activity_file_selection.xml b/app/src/main/res/layout/activity_file_selection.xml
index dd9639e86..61ba82571 100644
--- a/app/src/main/res/layout/activity_file_selection.xml
+++ b/app/src/main/res/layout/activity_file_selection.xml
@@ -2,20 +2,20 @@
.
+ along with KeePassDX. If not, see .
-->
.
+ along with KeePassDX. If not, see .
-->
.
+ along with KeePassDX. If not, see .
-->
+
.
+ along with KeePassDX. If not, see .
-->
+
diff --git a/app/src/main/res/layout/fragment_generate_password.xml b/app/src/main/res/layout/fragment_generate_password.xml
index f5f94b6f2..ee09a11dc 100644
--- a/app/src/main/res/layout/fragment_generate_password.xml
+++ b/app/src/main/res/layout/fragment_generate_password.xml
@@ -2,20 +2,20 @@
.
+ along with KeePassDX. If not, see .
-->
.
+ along with KeePassDX. If not, see .
-->
+
+
diff --git a/app/src/main/res/layout/fragment_set_otp.xml b/app/src/main/res/layout/fragment_set_otp.xml
index 59674d439..6c2f7c649 100644
--- a/app/src/main/res/layout/fragment_set_otp.xml
+++ b/app/src/main/res/layout/fragment_set_otp.xml
@@ -1,4 +1,22 @@
+
.
+ along with KeePassDX. If not, see .
-->
+
diff --git a/app/src/main/res/layout/fragment_unavailable_feature.xml b/app/src/main/res/layout/fragment_unavailable_feature.xml
index fbf43e3c9..b23a28f27 100644
--- a/app/src/main/res/layout/fragment_unavailable_feature.xml
+++ b/app/src/main/res/layout/fragment_unavailable_feature.xml
@@ -1,4 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_entry_new_field.xml b/app/src/main/res/layout/item_entry_new_field.xml
index ed529a626..83ee7b0e4 100644
--- a/app/src/main/res/layout/item_entry_new_field.xml
+++ b/app/src/main/res/layout/item_entry_new_field.xml
@@ -2,20 +2,20 @@
.
+ along with KeePassDX. If not, see .
-->
.
+ along with KeePassDX. If not, see .
-->
+
.
+ along with KeePassDX. If not, see .
-->
.
+ along with KeePassDX. If not, see .
-->
.
+ along with KeePassDX. If not, see .
-->
.
+ along with KeePassDX. If not, see .
-->
+
-.
+-->
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/pref_dialog_input_color.xml b/app/src/main/res/layout/pref_dialog_input_color.xml
index 2c7f021a7..475b54703 100644
--- a/app/src/main/res/layout/pref_dialog_input_color.xml
+++ b/app/src/main/res/layout/pref_dialog_input_color.xml
@@ -2,20 +2,20 @@
.
+ along with KeePassDX. If not, see .
-->
.
+ along with KeePassDX. If not, see .
-->
.
+ along with KeePassDX. If not, see .
-->
+
+
+
+
.
+ along with KeePassDX. If not, see .
-->
-
-
-
+ android:layout_toStartOf="@+id/entry_password_action_image"
+ android:focusable="false"
+ style="@style/KeepassDXStyle.TextAppearance.TextEntryItem" />
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/view_entry_edit_contents.xml b/app/src/main/res/layout/view_entry_edit_contents.xml
index 9db6f41ff..98c4cbaf2 100644
--- a/app/src/main/res/layout/view_entry_edit_contents.xml
+++ b/app/src/main/res/layout/view_entry_edit_contents.xml
@@ -2,20 +2,20 @@
.
+ along with KeePassDX. If not, see .
-->
.
+ along with KeePassDX. If not, see .
-->
+ Verrouillez la base de données
Verrouillez votre base de données rapidement. Vous pouvez configurer l’application pour qu’elle la verrouille après un délai et lorsque l’écran s’éteint.
Tri des éléments
- Choisir comment les entrées et les groupes sont triés.
- Participer
- Aider à améliorer la stabilité, la sécurité et à ajouter des fonctionnalités.
+ Choisissez comment les entrées et les groupes sont triés.
+ Participez
+ Aidez à améliorer la stabilité, la sécurité et à ajouter des fonctionnalités.
Contrairement à beaucoup d’applications de gestion de mots de passe, cette application est sans publicité, libre sous licence copyleft et ne collecte pas de données personnelles sur ses serveurs, peu importe la version que vous utilisez.
- En achetant la version pro, vous accéderez à cette <strong>fonctionnalité visuelle</strong> et vous aiderez en particulier à <strong>la réalisation de projets communautaires.</strong>
+ Algorithms
Cette <strong>fonctionnalité visuelle</strong> est disponible grâce à votre générosité.
- Afin de garder notre liberté et de rester toujours actifs, nous comptons sur votre contribution.
-
+ Algorithms
Cette fonctionnalité est en cours de développement et nécessite votre contribution pour être bientôt disponible.
En achetant la version <strong>pro</strong>,
- En <strong>contribuant</strong>,
+ Algorithms
vous encouragez les développeurs à créer de nouvelles fonctionnalités et à corriger des bogues en fonction de vos remarques.
Merci beaucoup pour votre contribution.
Nous travaillons dur pour livrer cette fonctionnalité rapidement.
@@ -290,7 +287,7 @@
Twofish
ChaCha20
- AES KDF
+ Fonction de dérivation de clé AES
Argon2
- 5 secondes
@@ -313,105 +310,106 @@
- Thème Jour
- Thème Nuit
+ - Thème Noir
- Thème Foncé Classique
- Thème Ciel et Océan
- Thème Rouge Volcan
- Thème Pro Violet
- Ensemble d’icônes
- Ensemble d’icônes utilisés dans l’application
- Vous ne pouvez pas déplacer un groupe en lui-même.
+ Collection d’icônes
+ Collection d’icônes utilisées dans l’application
+ Vous ne pouvez pas déplacer un groupe dans lui-même.
Copier
Déplacer
Coller
Annuler
- Autoriser aucune clé maîtresse
- Activer le bouton « Ouvrir » si aucune identification n’est sélectionnée
+ N’autoriser aucune clé principale
+ Active le bouton « Ouvrir » si aucun identifiant n’est sélectionné
Protégé en écriture
Modifiable
Protégé en écriture
- Ouvrir votre base de données en lecture seule par défaut
- Protéger en écriture votre base de données
- Changer le mode d’ouverture pour la session.
-\n
-\n« Protégé en écriture » empêche les modifications involontaires de la base de données.
+ Ouvre la base de données en lecture seule par défaut
+ Protégez en écriture votre base de données
+ Changez le mode d’ouverture pour la session.
+\n
+\n« Protégé en écriture » empêche les modifications involontaires de la base de données.
\n« Modifiable » vous permet d’ajouter, de supprimer ou de modifier tous les éléments.
Modifier l’entrée
Impossible de charger votre base de données.
- Impossible de charger la clé. Essayer de diminuer la mémoire utilisée par la fonction de dérivation de clé.
+ Impossible de charger la clé. Veuillez essayer de diminuer l’utilisation mémoire de la fonction de dérivation de clé.
Afficher les noms d’utilisateur
- Afficher les noms d’utilisateur dans les listes des entrées
- Compiler %1$s
- Magikeyboard
- Magikeyboard (KeePass DX)
- Paramètres Magikeyboard
+ Afficher les noms d’utilisateur dans les listes d’entrées
+ Version du code exécutable %1$s
+ Magiclavier
+ Magiclavier (KeePass DX)
+ Paramètres Magiclavier
Entrée
Délai d’expiration
Délai d’expiration pour effacer l’entrée au clavier
- Info de notification
- Afficher une notification lorsqu’une entrée est disponible
+ Informations de notification
+ Affiche une notification lorsqu’une entrée est disponible
Entrée
- %1$s disponible sur Magikeyboard
+ %1$s disponible sur le Magiclavier
%1$s
Effacer à la fermeture
- Fermer la base de données lors de la fermeture de la notification
+ Ferme la base de données lors de la fermeture de la notification
Apparence
Thème du clavier
Touches
Vibrer au toucher
Son au toucher
Mode sélection
- Ne pas tuer l\'application…
- Appuyer sur \"Retour\" pour verouiller
- Verrouille la base de données lorsque l\'utilisateur clique sur le bouton Précédent de l\'écran racine
+ Veuillez ne pas tuer l’application…
+ Appuyer sur « Retour » pour verrouiller
+ Verrouille la base de données lorsque l’utilisateur clique sur le bouton retour de l’écran racine
Suppression à la fermeture
- Ferme la base de données lors de la fermeture de notification
+ Ferme la base de données lors de la fermeture de la notification
Corbeille
- Sélection d\'entrée
- Afficher les champs de saisie dans Magikeyboard lors de l\'affichage d\'une entrée
+ Sélection de l’entrée
+ Affiche les champs de saisie dans le Magiclavier lors de l’affichage d’une entrée
Supprimer le mot de passe
- Supprime le mot de passe entré après une tentative de connexion
+ Supprime le mot de passe saisi après une tentative de connexion
Ouvrir le fichier
Ajouter un nœud
Ajouter une entrée
Ajouter un groupe
- Icône de l\'entrée
- Enregistrer l\'entrée
- Générateur de mot de passe
+ Icône de l’entrée
+ Enregistrer l’entrée
+ Générateur de mots de passe
Longueur de mot de passe
Ajouter un champ
Supprimer un champ
UUID
- Afficher le nombre d\'entrées
- Afficher le nombre d\'entrées du groupe
- Enfants de noeud
- Information de fichier
- Case à cocher mot de passe
- Case à cocher fichier de clé
+ Afficher le nombre d’entrées
+ Afficher le nombre d’entrées dans un groupe
+ Enfants du nœud
+ Informations du fichier
+ Case à cocher du mot de passe
+ Case à cocher du fichier clé
Répéter le basculement de visibilité du mot de passe
Vous ne pouvez pas déplacer une entrée ici.
Vous ne pouvez pas copier une entrée ici.
Arrière-plan
Mise à jour
Fermer les champs
- Impossible de créer une base avec ce mot de passe et ce fichier de clé.
+ Impossible de créer une base de données avec ce mot de passe et ce fichier clé.
Déverrouillage avancé
Activer
Désactiver
Enregistrer la reconnaissance biométrique
- Stocker les informations d\'identification de la base de données avec des données biométriques
+ ATTENTION : L’utilisation de la reconnaissance biométrique ne vous dispense pas de connaître votre mot de passe principal.
Ouvrir la base de données avec la reconnaissance biométrique
- Extraire les informations d\'identification de la base de données avec des données biométriques
- Biométrique
- Ouvrir automatiquement la boite de dialogue biométrique
- Ouvrir automatiquement la boite de dialogue biométrique lorsqu\'une clé biométrique est définie pour une base de données
- Clé Maîtresse
+ Extraire les identifiants de la base de données avec les données biométriques
+ Biométrie
+ Ouvrir automatiquement l’invite biométrique
+ Ouvre automatiquement l’invite biométrique lorsqu’une clé biométrique est définie pour une base de données
+ Clé principale
Sécurité
Historique
- Configuration d\'un mot de passe à usage unique
+ Configuration d’un mot de passe à usage unique
Type OTP
Secret
- Période (Secondes)
+ Période (secondes)
Compteur
Chiffres
Algorithme
@@ -422,34 +420,44 @@
La clé secrète doit être au format Base32.
Le compteur doit être entre %1$d et %2$d.
La période doit être entre %1$d et %2$d secondes.
- Le token doit contenir de %1$d à %2$d chiffres.
+ Le jeton doit contenir de %1$d à %2$d chiffres.
%1$s avec le même UUID %2$s existe déjà.
- Création de base de données…
+ Création de la base de données…
Paramètres de sécurité
- Paramètres de clé maîtresse
- La base de données contient des UUID en double.
- En validant cette boîte de dialogue, KeePass DX corrigera le problème (en générant de nouveaux UUID pour les doublons) et continuera.
+ Paramètres de la clé maîtresse
+ La base de données contient des doublons d’UUID.
+ En validant cette boîte de dialogue, KeePassDX corrigera le problème (en générant de nouveaux UUID pour les doublons) et continuera.
Base de données ouverte
- Copier les champs de saisie à l\'aide du presse-papiers de votre appareil
+ Copie les champs d’une entrée à l’aide du presse-papier de votre appareil
Notification persistante
- Ajouter une notification lorsque la base de données est ouverte
- Utilisez le déverrouillage avancé pour ouvrir plus facilement une base de données
+ Ajoute une notification lorsque la base de données est ouverte
+ Utilise le déverrouillage avancé pour ouvrir plus facilement une base de données
Compression de données
La compression des données réduit la taille de la base de données.
- Eléments d\'historique max.
- Limiter le nombre d\'éléments d\'historique par entrée
- Taille de l\'historique max.
- Limiter la taille de l\'historique par entrée (en octets binaires)
+ Nombre maximum d’items
+ Limite le nombre d’items de l’historique par entrée
+ Taille maximum
+ Limite la taille de l’historique par entrée (en octets)
Recommander changement
- Recommander le changement de clé maîtresse (jours)
+ Recommande le changement de la clé principale (jours)
Forcer changement
- Force le changement de clé maîtresse (jours)
- Force changement la prochaine fois
- Force le changement de clé maîtresse la prochaine fois (une fois)
- Nom d\'utilisateur par défaut
- Couleur de base de données personnalisée
+ Force le changement de la clé principale (jours)
+ Forcer changement la prochaine fois
+ Force le changement de la clé principale la prochaine fois (une seule fois)
+ Nom d’utilisateur par défaut
+ Couleur de la base de données
Compression
Aucune
- GZip
- Paramètres clavier de l\'appareil
+ Gzip
+ Paramètres du clavier de l’appareil
+ Impossible d’enregistrer la base de données.
+ Enregistrer la base de données
+ Vider la corbeille
+ Exécution de la commande…
+ Êtes-vous sûr de vouloir supprimer définitivement les nœuds sélectionnés \?
+ Le magasin de clés n’est pas correctement initialisé.
+ Saisissez le mot de passe avant de cliquer sur le bouton biométrique.
+ Groupe de la corbeille
+ Enregistrement automatique de la base de données
+ Enregistre automatiquement la base de données après une action importante (uniquement en mode « Modifiable »)
\ No newline at end of file
diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml
index 3d1a2f4f9..3ddce2655 100644
--- a/app/src/main/res/values-gl/strings.xml
+++ b/app/src/main/res/values-gl/strings.xml
@@ -1,7 +1,7 @@
Comentarios:
Páxina inicial:
- KeePass DX é unha implementación para Android do xestor de contrasinais KeePass.
+ KeePassDX é unha implementación para Android do xestor de contrasinais KeePass.
Aceptar
Engadir entrada
Engadir grupo
diff --git a/app/src/main/res/values-hi/strings.xml b/app/src/main/res/values-hi/strings.xml
index 075c1405b..ae66459b0 100644
--- a/app/src/main/res/values-hi/strings.xml
+++ b/app/src/main/res/values-hi/strings.xml
@@ -24,13 +24,13 @@
क्लिपबोर्ड टाइमआउट
क्लिपबोर्ड में भंडारण की अवधि
अब क्लिपबोर्ड को साफ करने के लिए स्वाइप करें
- क्लिपबोर्ड पर% 1 $ s को कॉपी करने के लिए चयन करें
+ क्लिपबोर्ड पर %1$s को कॉपी करने के लिए चयन करें
डेटाबेस कुंजी पुनर्प्राप्त कर रहा है…
डेटाबेस
डेटाबेस सामग्री डिक्रिप्टिंग…
डिफ़ॉल्ट डेटाबेस के रूप में उपयोग करें
अंक
- KeePass DX © %1 $ डी Kunzisoft बिल्कुल कोई वारंटी के साथ आता है । यह लाइब्रे सॉफ्टवेयर है, और जीपीएल संस्करण 3 या बाद की शर्तों के तहत इसे पुनर्वितरित करने के लिए आपका स्वागत है।
+ KeePassDX © %1$d Kunzisoft बिल्कुल कोई वारंटी के साथ आता है । यह लाइब्रे सॉफ्टवेयर है, और जीपीएल संस्करण 3 या बाद की शर्तों के तहत इसे पुनर्वितरित करने के लिए आपका स्वागत है।
एक्सेस किया गया
रद्द करें
टिप्पणियाँ
@@ -45,7 +45,7 @@
शीर्षक
यू.आर.एल
उपयोगकर्ता का नाम
- KeePass DX में इस URI को संभाल नहीं सका।
+ KeePassDX में इस URI को संभाल नहीं सका।
फाइल नहीं बना सका:
डाटाबेस नहीं पढ़ सका।
सुनिश्चित करें कि रास्ता सही है।
diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml
index 1d3d2b3c3..dcb26a1b3 100644
--- a/app/src/main/res/values-hu/strings.xml
+++ b/app/src/main/res/values-hu/strings.xml
@@ -2,20 +2,20 @@
Visszajelzés
@@ -44,7 +44,7 @@
Adatbázis-tartalom titkosításának feloldása…
Használat alapértelmezett adatbázisként
Számok
- KeePass DX \u00A9 %1$d Kunzisoft. Ehhez a programhoz semmilyen garancia nem jár. Ez egy szabad szoftver, a GNU General Public License 3-as vagy későbbi verziójának feltételei mellett terjeszthető, illetve módosítható.
+ KeePassDX © %1$d Kunzisoft. Ehhez a programhoz semmilyen garancia nem jár. Ez egy szabad szoftver, a GNU General Public License 3-as vagy későbbi verziójának feltételei mellett terjeszthető, illetve módosítható.
Létező adatbázis megnyitása
Utolsó hozzáférés
Mégsem
@@ -59,8 +59,8 @@
Név
URL
Felhasználónév
- Az ARCFOUR adatfolyam-titkosítás nem támogatott.
- Ez az URI nem kezelhető a KeePass DX-ben.
+ Az Arcfour adatfolyam-titkosítás nem támogatott.
+ Ez az URI nem kezelhető a KeePassDX-ben.
Nem sikerült létrehozni a fájlt:
Az adatbázist nem lehet olvasni.
Győződjön meg róla, hogy az útvonal helyes.
@@ -123,8 +123,7 @@
Feldolgozás…
Védelem
Írásvédett
- A KeePass DX-nek írási engedélyre van szüksége, hogy bármit is módosíthasson az adatbázisban.
- Az Android KitKattől kezdődően, egyes eszközökön az alkalmazások nem írhatnak az SD kártyára.
+ A KeePassDX-nek írási engedélyre van szüksége, hogy bármit is módosíthasson az adatbázisban.
Előző fájlok előzményei
Az előző fájlnevek megjegyzése
Megjegyzi az adatbázis-kulcsfájlok helyét
@@ -224,8 +223,8 @@
Megjelenés
Általános
Automatikus kitöltés
- KeePass DX űrlapkitöltés
- Bejelentkezés a KeePass DX-szel
+ KeePassDX űrlapkitöltés
+ Bejelentkezés a KeePassDX-szel
Alapértelmezett automatikus kitöltési szolgáltatás beállítása
Automatikus kitöltés engedélyezése az űrlapok gyors kitöltéséhez más alkalmazásokban
Előállított jelszó mérete
@@ -251,7 +250,6 @@
Fájlnév
Útvonal
Mesterkulcs hozzárendelése
- Bájtok
Fájlútvonal
A teljes fájlútvonal megtekintése
Kuka használata
@@ -271,7 +269,7 @@
Mágikus billentyűzet
Egyéni billentyűzet aktiválása, amely kitölti a jelszavakat és az összes azonosító mezőt
Mágikus billentyűzet
- Mágikus billentyűzet (KeePass DX)
+ Mágikus billentyűzet (KeePassDX)
Mágikus billentyűzet beállításai
Bejegyzés
Időtúllépés
diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml
index 10ffc0aa1..ac6d70e63 100644
--- a/app/src/main/res/values-it/strings.xml
+++ b/app/src/main/res/values-it/strings.xml
@@ -2,20 +2,20 @@
@@ -44,7 +44,7 @@
Decodifica contenuto database…
Usa come database predefinito
Numeri
- KeePass DX \u00A9 %1$d Kunzisoft viene distribuito assolutamente con nessuna garanzia. Si tratta di software libero e sei invitato a distribuirlo sotto le condizioni della licenza GPL versione 3 o successiva.
+ KeePassDX © %1$d Kunzisoft viene distribuito assolutamente con nessuna garanzia. Si tratta di software libero e sei invitato a distribuirlo sotto le condizioni della licenza GPL versione 3 o successiva.
Note
Apri un database esistente
Ultimo accesso
@@ -60,8 +60,8 @@
Nome
URL
Nome utente
- La codifica a flusso ARCFOUR non è supportata.
- KeePass DX non può gestire questo URI.
+ La codifica a flusso Arcfour non è supportata.
+ KeePassDX non può gestire questo URI.
Impossibile creare il file:
Lettura del database fallita.
Assicurati che il percorso sia corretto.
@@ -123,8 +123,7 @@
In corso…
Protezione
Sola lettura
- KeePass DX richiede l\'autorizzazione di scrittura per poter modificare il tuo database.
- A partire da Android KitKat, alcuni dispositivi non permettono più alle app di scrivere nella scheda SD.
+ KeePassDX richiede l\'autorizzazione di scrittura per poter modificare il tuo database.
Cronologia file recenti
Ricorda i file recenti
Ricorda la posizione dei file chiave dei database
@@ -215,8 +214,8 @@
Aspetto
Generale
Autocompletamento
- Autocompletamento di KeePass DX
- Accedi con KeePass DX
+ Autocompletamento di KeePassDX
+ Accedi con KeePassDX
Imposta servizio predefinito di autocompletamento
Attiva l\'autocompletamento per compilare velocemente i moduli in altre app
Dimensione password generata
@@ -242,7 +241,6 @@
Percorso
Assegna una chiave master
Crea un nuovo database
- Bytes
Percorso file
Visualizza il percorso file completo
Usa il cestino
@@ -337,7 +335,7 @@
Appunti
Build %1$s
Magitastiera
- Magitastiera (KeePass DX)
+ Magitastiera (KeePassDX)
Impostazioni Magitastiera
Elemento
Scadenza
diff --git a/app/src/main/res/values-iw/strings.xml b/app/src/main/res/values-iw/strings.xml
index c5cffcf61..ab477a642 100644
--- a/app/src/main/res/values-iw/strings.xml
+++ b/app/src/main/res/values-iw/strings.xml
@@ -2,24 +2,24 @@
משוב
דף הבית
- KeePass DX היא תוכנה המממשת את מנהל הסיסמאות KeePass לאנרואיד.
+ KeePassDX היא תוכנה המממשת את מנהל הסיסמאות KeePass לאנרואיד.
קבל
הוסף ערך
הוסף קבוצה
@@ -57,8 +57,8 @@
שמור
שם
שם משתמש
- צופן זרם ArcFour אינו נתמך.
- KeePass DX לא יכול לטפל ב-URI הזה.
+ צופן זרם Arcfour אינו נתמך.
+ KeePassDX לא יכול לטפל ב-URI הזה.
לא הצליח ליצור קובץ:
מסד נתונים לא חוקי.
נתיב לא חוקי.
@@ -119,8 +119,7 @@
צור מסד נתונים חדש…
עובד…
הגנה
- ל-KeePass DX אין הרשאות כתיבה למסד הנתונים הזה, ולכן הוא יפתח לקריאה בלבד.
- החל מאנרואיד 4.4, מספר מכשירים לא מרשים ליישומים לכתובת לכרטיס ה-SD.
+ ל-KeePassDX אין הרשאות כתיבה למסד הנתונים הזה, ולכן הוא יפתח לקריאה בלבד.
היסטוריית קובץ אחרונה
שמור קבצים שהיו בשימוש לאחרונה
זכור מיקום קבצי מפתח
diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml
index 79db6b054..8c2bfae86 100644
--- a/app/src/main/res/values-ja/strings.xml
+++ b/app/src/main/res/values-ja/strings.xml
@@ -2,20 +2,20 @@
フィードバック
ホームページ
@@ -39,7 +39,7 @@
データベースを解析中…
このデータベースを次回以降も利用する
数字
- KeePass DX \u00A9 %1$d Kunzisoft によって作られたフリーソフトウェアであり、無保証です。GPLバージョン3以上の条件下でこれを再頒布することができます。
+ KeePassDX © %1$d Kunzisoft によって作られたフリーソフトウェアであり、無保証です。GPLバージョン3以上の条件下でこれを再頒布することができます。
データベースファイル
最終アクセス日
キャンセル
@@ -54,8 +54,8 @@
タイトル
URL
ユーザー名
- ArcFour stream cipherには対応していません。
- KeePass DXはこのuriを処理できません。
+ Arcfour stream cipherには対応していません。
+ KeePassDXはこのuriを処理できません。
ファイルを作成できません。
無効なデータベースです。
パスが無効です。
@@ -103,7 +103,7 @@
マイナス (-)
期限なし
検索結果に該当するものはありません。
- このuriを処理できません。
+ このURLを処理できません。
以前使用したデータベースを開く:
検索対象から除外
\"バックアップ\"と\"ごみ箱\"を検索対象から除外します
@@ -182,9 +182,47 @@
新しいデータベースを作成
保護
書き込み保護
- Keepass DX は、データベースを変更するために書き込みアクセス許可が必要です。
- Android Kitkat から、一部のデバイスはアプリが SD カードに書き込むことができません。
+ KeePassDX は、データベースを変更するために書き込みアクセス許可が必要です。
最近使用したファイルの履歴
最近使用したファイル名を記憶します
すべてのデータで使用するデータベース暗号化アルゴリズム。
+ 並び順
+ 昇順
+ ゴミ箱を一番下にする
+ タイトル順
+ ユーザー名順
+ 作成日順
+ 最終保存日順
+ 最終アクセス順
+ 注意
+ ファイルを開く
+ エントリーの追加
+ グループの追加
+ ファイル情報
+ エントリーのアイコン
+ エントリーの保存
+ パスワード生成
+ パスワードの長さ
+ フィールドの追加
+ フィールドの削除
+ エントリーを移動できませんでした。
+ エントリーをコピーできませんでした。
+ 指紋認証は利用可能ですが設定されていません。
+ マスターキー
+ 編集履歴
+ ワンタイムパスワードのタイプ
+ 有効期限(秒)
+ アルゴリズム
+ ワンタイムパスワード
+ グループをコピーできませんでした。
+ シークレットキーはBase32のフォーマットでなければいけません。
+ 有効期限は%1$d から %2$d 秒の間でなければいけません。
+ データベース作成中…
+ セキュリティー設定
+ マスターキー設定
+ データベースを保存できませんでした。
+ データベースの保存
+ ゴミ箱を空にする
+ コマンド実行中…
+ 削除するとこのエントリーは復活できませんがよろしいですか?
\ No newline at end of file
diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml
index 50f09a5c4..d4e965450 100644
--- a/app/src/main/res/values-ko/strings.xml
+++ b/app/src/main/res/values-ko/strings.xml
@@ -2,20 +2,20 @@
피드백
@@ -49,7 +49,7 @@
데이터베이스 컨텐츠 암호 해독 중…
기본 데이터베이스로 사용
단위
- KeePass DX © %1$d Kunzisoft는 보증이 적용되지 않습니다; 이것은 자유 소프트웨어이며, GPL 버전 3 또는 그 이상의 조건으로의 재배포를 환영합니다.
+ KeePassDX © %1$d Kunzisoft는 보증이 적용되지 않습니다; 이것은 자유 소프트웨어이며, GPL 버전 3 또는 그 이상의 조건으로의 재배포를 환영합니다.
접근됨
취소
노트
@@ -64,8 +64,8 @@
제목
링크
아이디
- ARCFOUR 스트림 암호는 지원되지 않습니다.
- KeePass DX에서는 이 URI를 처리할 수 없습니다.
+ Arcfour 스트림 암호는 지원되지 않습니다.
+ KeePassDX에서는 이 URI를 처리할 수 없습니다.
파일을 생성할 수 없음:
데이터베이스를 읽을 수 없음.
경로가 확실한지 확인하십시오.
@@ -145,8 +145,7 @@
작업 중…
보호
쓰기 보호됨
- KeePass DX는 데이터베이스를 수정하기 위해 쓰기 권한이 필요합니다.
- 안드로이드 4.4 KitKat부터, 일부 기기는 SD카드 쓰기를 지원하지 않습니다.
+ KeePassDX는 데이터베이스를 수정하기 위해 쓰기 권한이 필요합니다.
최근 파일 기록
최근 파일 이름 기억하기
데이터베이스 키 파일 위치 기억하기
diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml
index 0b7b627f7..803fa6486 100644
--- a/app/src/main/res/values-lt/strings.xml
+++ b/app/src/main/res/values-lt/strings.xml
@@ -1,6 +1,6 @@
- KeePass DX yra KeePass slaptažodžių tvarkyklės realizacija Android platformai
+ KeePassDX yra KeePass slaptažodžių tvarkyklės realizacija Android platformai
Iškarpinė išvalyta.
Neteisingas slaptažodis arba rakto failas.
Atsiliepimai:
@@ -76,7 +76,7 @@
Iškarpinės išvalymas nepavyko
Teksto dydis grupės sąraše
Neiškoti atkūrimo įrašuose
- KeePass DX negali apdoroti šio uri.
+ KeePassDX negali apdoroti šio uri.
Įrašo duomenys nerasti.
Rakto failas yra tuščias.
Rakto failas neegzistuoja.
diff --git a/app/src/main/res/values-lv/strings.xml b/app/src/main/res/values-lv/strings.xml
index 2a58ed703..01d6e9f35 100644
--- a/app/src/main/res/values-lv/strings.xml
+++ b/app/src/main/res/values-lv/strings.xml
@@ -2,7 +2,7 @@
Atsauksmes:
Mājaslapa:
- KeePass DX ir KeePass paroļu menedžera Android implementācija
+ KeePassDX ir KeePass paroļu menedžera Android implementācija
Pieņemt
Jauns ieraksts
Jauna grupa
@@ -40,7 +40,7 @@
Vārds
URL
Lietotāja vārds
- ArcFour plūsmas šifrs netiek atbalstīts.
+ Arcfour plūsmas šifrs netiek atbalstīts.
Neizdevās pātiet uz norādīto adresi.
Neizdevās izveidot failu:
Nederīga datu bāze.
@@ -148,5 +148,5 @@
Šifrēšana
Paplašinātais ASCII
Atļaut
- KeePassDX \u00A9 %1$d Kunzisoft nāk bez jebkādas garantijas. Šī ir bezmaksas programmatūra un jūs to varat izplatīt apstākļos, kas aprakstīti GPL 3 versijā vai jaunākā.
+ KeePassDX © %1$d Kunzisoft nāk bez jebkādas garantijas. Šī ir bezmaksas programmatūra un jūs to varat izplatīt apstākļos, kas aprakstīti GPL 3 versijā vai jaunākā.
diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml
index 9cddb9ed6..bcab3cee3 100644
--- a/app/src/main/res/values-nb/strings.xml
+++ b/app/src/main/res/values-nb/strings.xml
@@ -2,20 +2,20 @@
Tilbakemelding
@@ -38,8 +38,8 @@
Tillat
Utklippstavle tømt
Utklippstavlefeil
- Noen Android-telefoner fra Samsung lar ikke programmer bruke utklippstavlen.
- Tømming av utklippstavle mislyktes
+ Noen enheter lar ikke programmer bruke utklippstavlen.
+ Kunne ikke tømme utklippstavle
Tidsavbrudd for utklippstavle
Tid før utklippstavlen tømmes etter kopiering av brukernavn og passord
Dra for å tømme utklippstavlen nå
@@ -49,7 +49,7 @@
Dekrypterer databaseinnhold…
Bruk dette som forvalgt database
Siffer
- KeePass DX \u00A9 %1$d Kunzisoft kommer uten noen form for garanti. Dette er fri programvare, og du er velkommen til å redistribuere det i henhold til vilkårene i GPL versjon 3 eller senere.
+ KeePassDX © %1$d Kunzisoft kommer uten noen form for garanti. Dette er fri programvare, og du er velkommen til å redistribuere det i henhold til vilkårene i GPL versjon 3 eller senere.
Brukt
Avbryt
Kommentarer
@@ -64,8 +64,8 @@
Tittel
Nettadresse
Brukernavn
- ARCFOUR-strømchifferet støttes ikke.
- KeePass DX kan ikke håntere denne URI-en.
+ Arcfour-strømchifferet støttes ikke.
+ KeePassDX kan ikke håntere denne URI-en.
Kunne ikke opprette fil:
Ugyldig database eller fremmed hovednøkkel.
Ugyldig sti.
@@ -145,8 +145,7 @@
Arbeider…
Beskyttelse
Skrivebeskyttet
- KeePass DX har ikke skrivetilgang til din databaseplassering, så den vil bli åpnet skrivebeskyttet.
- Siden Android KitKat, tillater noen enheter ikke lenger programmer å skrive til SD-kortet.
+ KeePassDX har ikke skrivetilgang til din databaseplassering, så den vil bli åpnet skrivebeskyttet.
Nylig filhistorikk
Husk nylig brukte filnavn
Husk nøkkelfilers plassering
@@ -200,8 +199,8 @@
Utseende
Generelt
Autofyll
- KeePass DX autofyll-tjeneste
- Logg inn med KeePass DX
+ KeePassDX autofyll-tjeneste
+ Logg inn med KeePassDX
Sett forvalgt autofyll-tjeneste
Skru på tjenesten for å fylle ut skjema fra andre programmer
Passordsstørrelse
@@ -228,7 +227,6 @@
Sti
Tildel en hovednøkkel
Opprett ny KeePass-fil
- Byte
Filsti
Vis hele filstien
Bruk papirkurv
@@ -257,7 +255,7 @@
Tilbakestill visning av opplæringselementer
Tilbakestilling av opplæringsskjermer
Opprett din databasefil
- Du kjenner ikke KeePass DX enda, opprett din første passordsaministrasjonsfil.
+ Du kjenner ikke KeePassDX enda, opprett din første passordsaministrasjonsfil.
Åpne en eksisterende database
Du har allerede brukt en KeePass-behandler. Bare åpne KDBX-filen fra din filbehandler.
Legg til nye elementer i databasen din
@@ -294,9 +292,11 @@
Delta
Delta for å øke stabiliteten, sikkerheten, og med å legge til flere funksjoner.
Ulikt mange passordbehandlingsprogrammer, er dette reklamefri, copyleftbasert fri programvare og samler ikke inn personlig data på tjenerne sine, selv i sin gratisversjon.
- Ved kjøp av pro-versjonen, vil du få tilgang til denne visuelle funksjonen og du vil spesielt hjelpe realiseringen av gemenskapsprosjekter.
+ Ved kjøp av pro-versjonen, vil du få tilgang til denne visuelle funksjonen og du vil spesielt hjelpe realiseringen av gemenskapsprosjekter.
+
Denne visuelle funksjonen er tilgjengelig takket være din generøsitet.
- For å beholde vår frihet og alltid være aktive, stoler vi på dine bidrag.
+ For å beholde vår frihet og alltid være aktive, stoler vi på dine bidrag.
+
Denne funksjonen er under utvikling og krever bidrag for å bli tilgjengelig snart.
Ved å kjøpe pro-versjonen,
Ved å bidra,
@@ -317,7 +317,7 @@
Endre programmets ikonpakke
Bygg %1$s
Magikeyboard
- Magikeyboard (KeePass DX)
+ Magikeyboard (KeePassDX)
Magikeyboard-innstillinger
Oppføring
Tidsavbrudd
@@ -368,4 +368,43 @@
Lagre databaseopplysninger med biometriske data
Aktiver
Skru av
+ Oppføringsikon
+ Hovednøkkel
+ Sikkerhet
+ Historikk
+ Sett opp engangspassord
+ OTP-type
+ Hemmelighet
+ Periode (sekunder)
+ Teller
+ Siffer
+ Algoritme
+ OTP
+ Ugyldig OTP-hemmelighet.
+ Telleren må være mellom %1$d og %2$d.
+ Periode må være mellom %1$d og %2$d sekunder.
+ Database åpnet
+ Lagre database
+ Passordsavkryssningsboks
+ Nøkkelfil-avkryssningsboks
+ Biometrisk
+ Minst én identitetsdetalj må angis.
+ Du kan ikke kopiere en gruppe hit.
+ Hemmelig nøkkel må være i Base32-format.
+ "Symbolet må inneholde %1$d til %2$d siffer."
+ %1$d med samme UUID %2$s finnes allerede.
+ Oppretter database…
+ Sikkerhetsinnstillinger
+ Hovednøkkelinnstillinger
+ Databasen inneholder dupliserte UUID-er.
+ Vedvarende merknad
+ Legg til en merknad når databasen er åpen
+ Datakomprimering
+ Datakomprimering reduserer databasens størrelse.
+ Komprimering
+ Ingen
+ GZip
+ Kunne ikke lagre database.
+ Tøm papirkurv
+ Kjører kommandoen…
\ No newline at end of file
diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml
index 3b7d63224..c4b3f334d 100644
--- a/app/src/main/res/values-nl/strings.xml
+++ b/app/src/main/res/values-nl/strings.xml
@@ -2,20 +2,20 @@
@@ -41,7 +41,7 @@
Bezig met ontsleutelen van databankinhoud…
Gebruiken als standaarddatabank
Getallen
- KeePass DX \u00A9 %1$d Kunzisoft biedt geen enkele garantie. Dit is vrije software, dus je mag deze software verspreiden onder de voorwaarden van de GPL versie 3 of recenter.
+ KeePassDX © %1$d Kunzisoft biedt geen enkele garantie. Dit is vrije software, dus je mag deze software verspreiden onder de voorwaarden van de GPL versie 3 of recenter.
Bestaande databank openen
Laatst geopend
Annuleren
@@ -56,8 +56,8 @@
Naam
URL
Gebruikersnaam
- De ARCFOUR stream-versleuteling wordt niet ondersteund.
- KeePass DX kan deze URI niet verwerken.
+ De Arcfour stream-versleuteling wordt niet ondersteund.
+ KeePassDX kan deze URI niet verwerken.
Kan bestand niet creëren:
Kan databank niet uitlezen.
Zorg ervoor dat het pad juist is.
@@ -186,8 +186,7 @@
Lezen en schrijven
Beveiliging
Alleen-lezen
- KeePass DX moet worden gemachtigd om je databank te kunnen aanpassen.
- Sinds Android KitKat is het op sommige apparaten niet langer toegestaan om apps weg te schrijven naar de SD-kaart.
+ KeePassDX moet worden gemachtigd om je databank te kunnen aanpassen.
Recente bestandgeschiedenis
Recent gebruikte bestandsnamen onthouden
Het algoritme dat moet worden gebruikt om de gehele databank te versleutelen.
@@ -222,8 +221,8 @@
Uiterlijk
Algemeen
Auto-aanvullen
- KeePass DX auto-aanvullendienst
- Inloggen met KeePass DX
+ KeePassDX auto-aanvullendienst
+ Inloggen met KeePassDX
Standaard aanvuldienst instellen
Schakel de dienst in om formulieren in andere apps snel in te vullen
Gegenereerde wachtwoordgrootte
@@ -250,7 +249,6 @@
Pad
Hoofdsleutel toewijzen
Nieuwe databank creëren
- bytes
Bestandspad
Volledig bestandspad tonen
Prullenbak gebruiken
@@ -337,7 +335,7 @@
Iconenverzameling gebruikt in de app
Bouw %1$s
Magikeyboard
- Magikeyboard (Keepass DX)
+ Magikeyboard (KeePassDX)
Magikeyboard-instellingen
Item
Time-out
diff --git a/app/src/main/res/values-nn/strings.xml b/app/src/main/res/values-nn/strings.xml
index 0d3ddb9ae..78b560412 100644
--- a/app/src/main/res/values-nn/strings.xml
+++ b/app/src/main/res/values-nn/strings.xml
@@ -2,25 +2,25 @@
Tilbakemelding:
Heimeside:
- KeePass DX er ei android-utgåve av KeePass passordstyrar.
+ KeePassDX er ei android-utgåve av KeePass passordstyrar.
Godta
Legg til post
Legg til gruppe
@@ -40,7 +40,7 @@
Dekrypterer databasen …
Standarddatabasen
Tal
- KeePass DX \u00A9 %1$d Kunzisoft kjem med ingen som helst garanti. Dette er eit fritt program. Du er velkomen til å redistribuera det i samsvar med vilkåra til GPL utgåve 3 eller nyare.
+ KeePassDX © %1$d Kunzisoft kjem med ingen som helst garanti. Dette er eit fritt program. Du er velkomen til å redistribuera det i samsvar med vilkåra til GPL utgåve 3 eller nyare.
Skriv filnamnet til databasen
Brukt
Avbryt
@@ -55,8 +55,8 @@
Namn
Adresse
Brukaramn
- Kan ikkje bruka ArcFour dataflytkryptering.
- KeePass DX kan ikkje bruka denne ressursen.
+ Kan ikkje bruka Arcfour dataflytkryptering.
+ KeePassDX kan ikkje bruka denne ressursen.
Klarte ikkje å laga fila:
Ugyldig database.
Ugyldig stig.
diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml
index c0f99c347..42762b573 100644
--- a/app/src/main/res/values-pl/strings.xml
+++ b/app/src/main/res/values-pl/strings.xml
@@ -2,20 +2,20 @@
Informacje zwrotne
Strona domowa
@@ -53,8 +53,8 @@
Tytuł
URL
Nazwa użytkownika
- Strumieniowe szyfrowanie ArcFour nie jest wspierane.
- Nie można obsłużyć tego identyfikatora URI w KeePass DX.
+ Strumieniowe szyfrowanie Arcfour nie jest wspierane.
+ Nie można obsłużyć tego identyfikatora URI w KeePassDX.
Nie można utworzyć pliku:
Nie można odczytać bazy danych.
Upewnij się, że ścieżka jest prawidłowa.
@@ -77,7 +77,7 @@
hasło
Zainstaluj z Play-Store
Zainstaluj z F-Droid
- Nieprawidłowe hasło lub plik klucza.
+ Nie można odczytać uwierzytelnień. Jeśli to się powtórzy, plik bazy danych może być uszkodzony.
Nie można rozpoznać formatu bazy danych.
Długość
Wielkość listy grup
@@ -156,10 +156,10 @@
Rozszerzone ASCII
Zezwalaj
Błąd schowka
- Niektóre telefony Samsung z Androidem nie pozwalają aplikacjom korzystać ze schowka.
+ Niektóre urządzenia nie pozwalają aplikacjom korzystać ze schowka.
Nie można wyczyścić schowka
Przesuń, by wyczyścić schowek
- KeePass DX \u00A9 %1$d Kunzisoft korzystasz absolutnie bez gwarancji. To jest bezpłatne oprogramowanie i możesz go redystrybuować na warunkach GPL w wersji 3 lub późniejszej.
+ KeePassDX © %1$d Kunzisoft korzystasz absolutnie bez gwarancji. To jest bezpłatne oprogramowanie i możesz go redystrybuować na warunkach GPL w wersji 3 lub późniejszej.
Nie znaleziono danych wejściowych.
Nie można załadować bazy danych.
Nie można załadować klucza. Spróbuj zmniejszyć użycie pamięć KDF.
@@ -185,8 +185,7 @@
Modyfikowalne
Ochrona
Chroniony przed zapisem
- KeePass DX potrzebuje uprawnień do zapisu, aby mógł modyfikować bazę danych.
- Począwszy od Androida KitKat niektóre urządzenia nie zezwalają już aplikacjom na zapisywanie na kartę SD.
+ KeePassDX potrzebuje uprawnień do zapisu, aby mógł modyfikować bazę danych.
Algorytm szyfrowania bazy danych używany dla wszystkich danych.
Aby wygenerować klucz dla algorytmu szyfrowania, klucz główny jest transformowany przy użyciu losowo solonej funkcji wyprowadzania klucza.
Użycie pamięci
@@ -208,10 +207,10 @@
Czy na pewno nie chcesz używać żadnego klucza szyfrowania?
Wersja %1$s
Skanowanie odcisków palców jest obsługiwane, ale nie skonfigurowane.
- "Przechowywane hasło zaszyfrowane "
+ Zapisano zaszyfrowane hasło
Grupy poprzednie
Skanowanie odcisków palców
- Nie można odczytać klucza linii papilarnych. Przywróć swoje hasło.
+ Nie można odczytać klucza biometrycznego. Usuń go i powtórz procedurę rozpoznawania biometrycznego.
Nie można rozpoznać odcisku palca
Problem z odciskiem palca: %1$s
Użyj odcisku palca, aby zapisać to hasło
@@ -220,8 +219,8 @@
Wygląd
Ogólne
Wypełnij automatycznie
- Autouzupełnianie formularzy KeePass DX
- Zaloguj się za pomocą KeePass DX
+ Autouzupełnianie formularzy KeePassDX
+ Zaloguj się za pomocą KeePassDX
Ustaw domyślną usługę autouzupełniania
Włącz autouzupełnianie, aby móc szybko wypełniać formularze w innych aplikacjach
Wygenerowany rozmiar hasła
@@ -248,11 +247,10 @@
Ścieżka
Przypisz klucz główny
Utwórz nową bazę danych
- Bajtów
Ścieżka pliku
Wyświetl pełną ścieżkę do pliku
Użyj kosza
- Przenosi grupy i wpisy do \"Kosza\" przed usunięciem
+ Przenosi grupy i wpisy do grupy \"Kosz\" przed usunięciem
Pole czcionka
Zmień czcionkę użytą w polach, aby poprawić widoczność postaci
Zaufanie do schowka
@@ -281,9 +279,9 @@
Otwórz istniejącą bazę danych
Otwórz starszy plik bazy danych w przeglądarce plików, aby nadal z niego korzystać.
Dodaj elementy do swojej bazy danych
- "Dodaj wpisy, aby zarządzać swoimi cyfrowymi tożsamościami.
-\n
-\nDodaj grupy (odpowiednik folderów), aby uporządkować swoje wpisy i bazę danych."
+ Wpisy pomagają zarządzać twoimi tożsamościami cyfrowymi.
+\n
+\nGrupy (~ foldery) organizują wpisy w bazie danych.
Przeszukuj wpisy
Wprowadź tytuł, nazwę użytkownika lub zawartość innych pól, aby odzyskać swoje hasła.
Odblokuj bazę danych za pomocą odcisku palca
@@ -296,15 +294,14 @@
Zarejestruj podstawowe pole niedostarczone, wypełniając nowe pole, które możesz również chronić.
Odblokuj swoją bazę danych
Zapisz ochronę swojej bazy danych
- "Zmień tryb otwierania sesji.
-\n
-\nW trybie tylko do odczytu zapobiegasz niezamierzonym zmianom w bazie danych.
-\n
-\nW trybie zapisu możesz dodawać, usuwać lub modyfikować wszystkie elementy, jak chcesz."
+ Zmień tryb otwierania sesji.
+\n
+\n„Zabezpieczony przed zapisem” zapobiega niezamierzonym zmianom w bazie danych.
+\n„Modyfikowalne” pozwala dodawać, usuwać lub modyfikować wszystkie elementy.
Skopiuj pole
- "Skopiuj łatwo pole, aby wkleić je tam, gdzie chcesz
-\n
-\nMożesz użyć kilku metod wypełniania formularzy. Użyj tego, który wolisz."
+ Skopiowane pola można wkleić w dowolnym miejscu.
+\n
+\nUżyj preferowanej metody wypełniania formularzy.
Zablokuj bazę danych
Szybko zablokuj bazę danych, możesz skonfigurować aplikację, by po chwili ją zablokować, i gdy ekran się wyłączy.
Sortowanie elementów
@@ -333,7 +330,7 @@
Pakiet ikon używany w aplikacji
Kompilacja %1$s
Magikeyboard
- Magikeyboard (KeePass DX)
+ Magikeyboard (KeePassDX)
Ustawienia Magikeyboard
Wpis
Limit czasu
@@ -386,7 +383,7 @@
Nie można utworzyć bazy danych przy użyciu tego hasła i pliku klucza.
Zaawansowane odblokowywanie
Zapisz rozpoznawanie biometryczne
- Przechowuj dane biometryczne w bazie danych
+ OSTRZEŻENIE: Korzystanie z rozpoznawania biometrycznego nie zwalnia Cię od znajomości hasła głównego.
Otwarta baza danych z rozpoznawaniem biometrycznym
Wyodrębnij poświadczenia bazy danych z danymi biometrycznymi
Biometryczne
@@ -398,7 +395,7 @@
Klucz główny
Zabezpieczenia
Historia
- Ustaw hasło jednorazowe
+ Skonfiguruj hasło jednorazowe
Typ OTP
Tajne
Okres (w sekundach)
@@ -431,9 +428,9 @@
Klucz tajny musi być w formacie Base32.
Licznik musi być między %1$d a %2$d.
Okres musi wynosić od %1$d do %2$d sekund.
- Token musi zawierać %1$d do %2$d cyfr.
+ Token musi zawierać cyfry od %1$d do %2$d.
%1$s o tym samym identyfikatorze UUID %2$s już istnieje.
- Weryfikując to okno dialogowe, KeePass DX rozwiąże problem (poprzez wygenerowanie nowych UUID dla duplikatów) i będzie kontynuował.
+ Weryfikując to okno dialogowe, KeePassDX rozwiąże problem (poprzez wygenerowanie nowych UUID dla duplikatów) i będzie kontynuował.
Skopiuj pola wprowadzania danych za pomocą schowka urządzenia
Użyj zaawansowanego odblokowywania w celu łatwiejszego otwierania bazy danych
Kompresja danych zmniejsza rozmiar bazy danych.
@@ -442,4 +439,14 @@
Wymuś zmianę
Wymuś zmianę następnym razem
Wymuś zmianę klucza głównego następnym razem (raz)
+ Nie można zapisać bazy danych.
+ Zapisz bazę danych
+ Opróżnij kosz
+ Wykonywanie polecenia…
+ Czy na pewno chcesz trwale usunąć wybrane węzły\?
+ Magazyn kluczy nie został poprawnie zainicjowany.
+ Wpisz hasło przed kliknięciem przycisku biometrycznego.
+ Kosz grupy
+ Automatyczne zapisywanie bazy danych
+ Automatycznie zapisz bazę danych po ważnym działaniu (tylko w trybie „Modyfikowalnym”)
\ No newline at end of file
diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml
index 45a7812af..4bd786f1f 100644
--- a/app/src/main/res/values-pt-rBR/strings.xml
+++ b/app/src/main/res/values-pt-rBR/strings.xml
@@ -2,24 +2,24 @@
Comentários
Página inicial
- KeePass DX é uma implementação para Android do gerenciador de senhas KeePass
+ KeePassDX é uma implementação para Android do gerenciador de senhas KeePass
Aceitar
Adicionar entrada
Adicionar grupo
@@ -39,7 +39,7 @@
Descriptografando conteúdo do banco de dados…
Usar como banco de dados padrão
Digitos
- KeePass DX \u00A9 %1$d Kunzisoft vem com absolutamente nenhuma garantia. Este é um software livre, e você está convidado a redistribui-lo sob as condições da GPL versão 3 ou posterior.
+ KeePassDX © %1$d Kunzisoft vem com absolutamente nenhuma garantia. Este é um software livre, e você está convidado a redistribui-lo sob as condições da GPL versão 3 ou posterior.
Abrir banco de dados existente
Acessado
Cancelar
@@ -54,8 +54,8 @@
Nome
URL
Nome de usuário
- A cifra de fluxo ARCFOUR não é suportada.
- Não pôde tratar esta URI no KeePass DX.
+ A cifra de fluxo Arcfour não é suportada.
+ Não pôde tratar esta URI no KeePassDX.
Não foi possível criar o arquivo:
Falha ao ler o banco.
Certifique-se de que o caminho está correto.
@@ -78,7 +78,7 @@
senha
Instalar a partir do Google Play
Instalar a partir do F-Droid
- Senha ou arquivo de chaves inválidos.
+ Não foi possível ler credenciais. Se isso ocorrer novamente, seu arquivo de banco de dados pode estar corrompido.
Não pôde reconhecer formato do banco de dados.
Tamanho
Tamanho da lista de grupos
@@ -154,7 +154,7 @@
ASCII Extendido
Permitir
Erro na área de transferência
- Alguns celulares Samsung Android não permitem aplicativos a usarem a área de transferência.
+ Alguns dispositivos não permitem que aplicativos usem a área de transferência.
Não foi possível limpar a área de transferência
Deslize para limpar a área de transferência agora
Não pôde encontrar dado de entrada.
@@ -178,8 +178,7 @@
Leitura e escrita
Proteção
Apenas leitura
- KeePass DX precisa de permissões de escrita para poder mudar qualquer coisa no seu banco.
- A partir do Android KitKat, alguns dispositivos não permitem mais a escrita para o cartão de memória.
+ KeePassDX precisa de permissões de escrita para poder mudar qualquer coisa no seu banco.
Histórico de arquivos recentes
Lembrar nomes recentes de arquivos
Algoritmo de encriptação usado para todos os dados.
@@ -205,7 +204,7 @@
Impressão digital é suportada, mas não está configurada.
Escaneamento de impressão digital
Senha encriptada armazenada
- Não pôde ler chave de impressão digital. Recupere sua senha.
+ Não pôde ler chave de impressão digital. Por favor, apague-a e repita o procedimento de reconhecimento biométrico.
Não pôde reconhecer impressão digital
Problema de Impressão digital: %1$s
Use Impressão digital para armazenar esta senha
@@ -214,8 +213,8 @@
Aparência
Geral
Preenchimento automático
- Preenchimento Automático KeePass DX
- Entre com o KeePass DX
+ Preenchimento Automático KeePassDX
+ Entre com o KeePassDX
Definir serviço padrão de preenchimento automático
Habilite o serviço para rapidamente preencher formulários em outros aplicativos
Comprimento da senha gerada
@@ -241,11 +240,10 @@
Caminho
Defina uma chave mestre
Criar novo banco
- Bytes
Caminho do arquivo
Veja o caminho inteiro do arquivo
Usar lixeira
- Move grupos e entradas para a \"Lixeira\" antes de apagar
+ Mover grupos e entradas para o grupo \"Lixeira\" antes de apagar
Fonte do Campo
Muda a fonte usada nos campos para melhor visibilidade dos caracteres
Confiança da área de transferência
@@ -305,15 +303,12 @@
Participar
Ajude a aumentar a estabilidade, segurança e na adição de mais recursos.
Ao contrário de muitos aplicativos de gerenciamento de senhas, este aplicativo é livre de anúncios, software livre e não recupera dados pessoais em seus servidores, mesmo em sua versão gratuita.
- Ao comprar a versão pro, você terá acesso a este recurso visual e ajudará especialmente a realização de projetos comunitários.
-
+ Ao comprar a versão pro, você terá acesso a este recurso visual e ajudará especialmente a realização de projetos comunitários.
Este recurso visual está disponível graças à sua generosidade.
- Para manter a nossa liberdade e estarmos sempre ativos, nós contamos com a sua contribuição.
-
+ Para manter a nossa liberdade e estarmos sempre ativos, nós contamos com a sua contribuição.
Esse recurso está em desenvolvimento e exige que sua contribuição para que esteja disponível em breve.
Ao comprar a versão pro,
-
- Contribuindo ,
+ Contribuindo ,
Você está incentivando os desenvolvedores a criar novos recursos e a corrigir erros de acordo com suas observações.
Obrigado por sua contribuição.
Estamos trabalhando duro para lançar esse recurso o mais rápido possível.
@@ -336,7 +331,7 @@
Área de transferência
Build %1$s
Magikeyboard
- Magikeyboard (KeePass DX)
+ Magikeyboard (KeePassDX)
Configurações do Magikeyboard
Entrada
Tempo limite
@@ -390,7 +385,7 @@
Impossibilitado de criar um banco de dados com essa senha e arquivo-chave.
Desbloqueio avançado
Salvar reconhecimento biométrico
- Armazenar credenciais do banco de dados com biometria
+ AVISO: O uso de reconhecimento biométrico não exime você de saber sua senha mestra.
Abrir banco de dados com biometria
Extrair credenciais do banco de dados com biometria
Biometria
@@ -401,7 +396,7 @@
Chave mestre
Segurança
Histórico
- Configurar TOTP
+ Configurar OTP
Tipo OTP
Segredo
Período (segundos)
@@ -415,13 +410,13 @@
A chave secreta deve estar em formato Base32.
O contador deve estar entre %1$d e %2$d.
O período deve estar entre %1$d e %2$d segundos.
- O token deve conter de %1$d até %2$d digitos.
+ O token deve conter de %1$d até %2$d dígitos.
%1$s com o mesmo UUID %2$s já existe.
Criando banco de dados…
Configurações de segurança
Configurações da chave mestre
O banco de dados contém UUIDs duplicados.
- Ao validar este diálogo, o KeePass DX irá consertar o problema (gerando um novo UUID para os duplicados) e continuar.
+ Ao validar este diálogo, o KeePassDX irá consertar o problema (gerando um novo UUID para os duplicados) e continuar.
Banco de dados aberto
Copiar campos de entrada usando a área de transferência do seu aparelho
Notificação persistente
@@ -445,4 +440,14 @@
Nada
GZip
Configurações do teclado do aparelho
+ Não foi possível salvar no banco de dados.
+ Salvar banco de dados
+ Esvaziar lixeira
+ Executando o comando…
+ Você tem certeza que quer apagar permanentemente os nós selecionados\?
+ A chave não foi propriamente inicializada.
+ Digite sua senha antes de clicar no botão de biometria.
+ Grupo de lixeira
+ Salvar automaticamente o banco de dados
+ Salvar automaticamente o banco de dados depois de uma ação importante (somente no modo \"Modificável\")
\ No newline at end of file
diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml
index 162d35749..d9f4c7e3d 100644
--- a/app/src/main/res/values-pt-rPT/strings.xml
+++ b/app/src/main/res/values-pt-rPT/strings.xml
@@ -2,20 +2,20 @@
Comentários
@@ -44,7 +44,7 @@
A desencriptar o conteúdo da base de dados…
Utilizar como base de dados predefinida
Dígitos
- KeePass DX \u00A9 %1$d Kunzisoft é fornecido absolutamente sem nenhuma garantia. Este software é livre, e pode redistribui-lo conforme as condições da licença GPL versão 3 ou superior.
+ KeePassDX © %1$d Kunzisoft é fornecido absolutamente sem nenhuma garantia. Este software é livre, e pode redistribui-lo conforme as condições da licença GPL versão 3 ou superior.
Abrir banco de dados existente
Acedido
Cancelar
@@ -60,8 +60,8 @@
Nome
URL
Nome de utilizador
- A cifra de fluxo ARCFOUR não é suportada.
- Não pôde tratar esta URI no KeePass DX.
+ A cifra de fluxo Arcfour não é suportada.
+ Não pôde tratar esta URI no KeePassDX.
Não foi possível criar o ficheiro:
Não foi possível ler a base de dados.
Certifique-se que o caminho é válido.
@@ -124,8 +124,7 @@
Em funcionamento…
Proteção
Apenas leitura
- KeePass DX precisa de permissões de escrita para poder mudar qualquer coisa no seu banco.
- A partir do Android KitKat, alguns dispositivos não permitem mais a escrita para o cartão de memória.
+ KeePassDX precisa de permissões de escrita para poder mudar qualquer coisa no seu banco.
Histórico de ficheiros recentes
Lembrar nomes recentes de ficheiros
Lembra o local dos ficheiros-chave dos bancos de dados
@@ -213,8 +212,8 @@
Aparência
Geral
Preenchimento automático
- Serviço de Preenchimento Automático do KeePass DX
- Entrar com KeePass DX
+ Serviço de Preenchimento Automático do KeePassDX
+ Entrar com KeePassDX
Definir como serviço de preenchimento automático padrão
Ativar o serviço para preencher formulários em outras aplicações
Tamanho da palavra-chave gerada
@@ -239,7 +238,6 @@
Nome do ficheiro
Caminho
Defina uma chave mestre
- Bytes
Caminho do ficheiro
Veja o caminho inteiro do ficheiro
Usar lixeira
@@ -329,7 +327,7 @@
Mostrar nomes de usuário em listas de entrada
Área de transferência
Magikeyboard
- Magikeyboard (KeePass DX)
+ Magikeyboard (KeePassDX)
Configurações do Magikeyboard
Entrada
Tempo limite
diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml
index 07ea2b58b..94bcbcd37 100644
--- a/app/src/main/res/values-ru/strings.xml
+++ b/app/src/main/res/values-ru/strings.xml
@@ -2,30 +2,30 @@
Обратная связь
Сайт
- Android-версия программы управления паролями KeePass
+ Android-версия менеджера паролей KeePass
Принять
Новая запись
Новая группа
Алгоритм шифрования
Задержка
- Задержка блокировки при бездействии
+ Время до блокировки приложения при неактивности
Приложение
Настройки приложения
Не показывать снова
@@ -33,7 +33,7 @@
Создание, открытие и сохранение файла базы требует установки файлового менеджера, который принимает действия Intent ACTION_CREATE_DOCUMENT и ACTION_OPEN_DOCUMENT
Буфер обмена очищен
Ошибка буфера обмена
- Некоторые устройства Samsung не дают приложению использовать буфер обмена.
+ Некоторые устройства не дают приложению использовать буфер обмена.
Не удалось очистить буфер обмена
Задержка очистки буфера обмена
Продолжительность хранения в буфере обмена
@@ -43,7 +43,7 @@
Расшифровка базы…
База по умолчанию
Цифры
- Приложение KeePass DX © %1$d Kunzisoft предоставляется без каких-либо гарантий. Распространяется свободно по лицензии GPL v3 или новее.
+ Приложение KeePassDX © %1$d Kunzisoft предоставляется без каких-либо гарантий. Распространяется свободно по лицензии GPL v3 или новее.
Открыть существующую базу
Доступ
Отмена
@@ -59,8 +59,8 @@
Название
Ссылка
Имя
- Потоковый шифр ARCFOUR не поддерживается.
- Невозможно обработать указанный URI в KeePass DX.
+ Потоковый шифр Arcfour не поддерживается.
+ Невозможно обработать указанный URI в KeePassDX.
Невозможно создать файл:
Невозможно прочитать базу.
Убедитесь, что путь указан правильно.
@@ -87,14 +87,14 @@
Пароль
Google Play
F-Droid
- Неправильный главный пароль или файл ключа.
+ Неправильный главный пароль или файл ключа. Если это сообщение повторяется, файл базы, возможно, повреждён.
Неправильный алгоритм.
Невозможно определить формат базы.
Файл ключа не найден.
Файл ключа пуст.
Длина
Размер списка
- Размер шрифта элементов списка
+ Размер текста элементов списка
Загрузка базы…
Строчные
Скрывать пароли
@@ -111,24 +111,23 @@
Открыть
Поиск
Показать пароль
- Перейти
+ Открыть ссылку
-Дефис-
Никогда
Совпадения не найдены
Установите браузер, чтобы открыть этот URL.
Недавно открытые
Не искать в резервных копиях
- Не искать в \"Резервировании\" и \"Корзине\"
+ Не искать в группах \"Резервирование\" и \"Корзина\"
Создание новой базы…
Обработка…
Защита
Только чтение
- KeePass DX необходимо разрешение на запись, чтобы иметь возможность изменить что-либо в вашей базе.
- Начиная с Android KitKat, на некоторых устройствах приложениям запрещена запись на SD-карту.
- Недавно открытые
- Хранить имена недавно открытых файлов
+ KeePassDX необходимо разрешение на запись, чтобы иметь возможность изменить что-либо в вашей базе.
+ Базы паролей
+ Хранить имена недавно открытых баз
Хранить пути к файлам ключей
- Хранить файлы ключей
+ Файлы ключей
Убрать из списка
Rijndael (AES)
База
@@ -154,7 +153,7 @@
Биометрия поддерживается, но не настроена.
Ожидание биометрического ключа для разблокировки базы
Зашифрованный пароль сохранён
- Неправильный биометрический ключ. Восстановите главный пароль.
+ Невозможно распознать биометрический ключ. Пожалуйста, удалите его и повторите процедуру настройки биометрического распознавания.
Проблема с биометрическим ключом: %1$s
Используйте биометрический ключ, чтобы сохранить главный пароль
Для этой базы главный пароль ещё не сохранён.
@@ -197,7 +196,7 @@
Время последнего доступа
Редактировать запись
Разрешить
- Смахните, чтобы очистить буфер обмена сейчас
+ Смахните для очистки буфера обмена
Невозможно загрузить базу.
Невозможно загрузить ключ. Попробуйте уменьшить размер памяти, используемой функцией формирования ключа (KDF).
Нельзя переместить группу в саму себя.
@@ -220,14 +219,14 @@
Внешний вид
Общие
Автозаполнение
- Сервис автозаполнения KeePass DX
- Войти с помощью KeePass DX
+ Сервис автозаполнения KeePassDX
+ Войти с помощью KeePassDX
Включить сервис для быстрого заполнения форм в других приложениях
Сервис автозаполнения по умолчанию
Длина создаваемого пароля
- Установить длину создаваемых паролей по умолчанию
+ Настройка длины создаваемых паролей по умолчанию
Символы пароля
- Установить набор разрешённых символов для создания пароля
+ Настройка набора разрешённых символов для создания пароля
Буфер обмена
Уведомления буфера обмена
Включить уведомления буфера обмена для копирования полей при просмотре записи
@@ -248,13 +247,12 @@
Путь
Установить главный пароль
Создать новую базу
- Байт
Путь к файлу
Показывать полный путь к файлу
- Использовать \"Корзину\"
- Перемещать группу или запись в \"Корзину\" вместо удаления
- Шрифт полей
- Изменить используемый в полях шрифт для лучшей читаемости
+ Использовать \"корзину\"
+ Перемещать группу или запись в \"корзину\" вместо удаления
+ Особый шрифт
+ Использовать в полях особый шрифт для лучшей читаемости
Доверять буферу обмена
Разрешить копирование пароля и защищённых полей в буфер обмена
ПРЕДУПРЕЖДЕНИЕ: буфер обмена доступен всем приложениям. Если копируются чувствительные данные, другие программы могут их перехватить.
@@ -265,8 +263,8 @@
Приложение
Прочее
Клавиатура
- Magikeyboard
- Активировать пользовательскую клавиатуру для простого заполнения паролей и всех ваших идентификаторов
+ Настройки Magikeyboard
+ Активируйте пользовательскую клавиатуру для простого заполнения паролей и любых идентификаторов
Разрешить без главного пароля
Включить кнопку \"Открыть\", если главный пароль не указан
Только чтение
@@ -311,12 +309,14 @@
Участвуйте
Примите участие в проекте для повышения стабильности, безопасности и добавления новых возможностей.
В отличие от многих приложений управления паролями, это без рекламы, свободное программное обеспечение (copyleft) и не хранит ваши личные данные на своих серверах независимо от того, какую версию вы используете.
- При покупке Pro-версии вы будете иметь доступ к этим визуальным функциям и особенно поможете реализации общественных проектов.
+ При покупке Pro-версии вы будете иметь доступ к этим визуальным функциям и особенно поможете реализации общественных проектов.
+
Эти визуальные функции доступны благодаря вашей щедрости.
- Для того, чтобы сохранить нашу независимость и быть всегда активными, мы рассчитываем на ваш вклад.
+ Для того, чтобы сохранить нашу независимость и быть всегда активными, мы рассчитываем на ваш вклад.
Эта функция находится в разработке и требует вашего участия, чтобы стать доступной в ближайшее время.
Покупая Pro-версию,
- Участвуя в проекте,
+
+ Участвуя в проекте,
вы поощряете разработчиков добавлять новые возможности и исправлять ошибки в соответствии с вашими замечаниями.
Спасибо большое за ваш вклад.
Мы прилагаем все усилия, чтобы быстро выпустить эту функцию.
@@ -331,12 +331,12 @@
Набор значков
Набор значков, используемый в приложении
Magikeyboard
- Magikeyboard (KeePass DX)
+ Magikeyboard (KeePassDX)
Настройки Magikeyboard
Сборка %1$s
Запись
Задержка
- Время задержки перед очисткой вводимой записи
+ Время до очистки вводимой записи
Информационное уведомление
Показывать уведомление, когда запись доступна
Запись
@@ -350,7 +350,7 @@
Вибрация при нажатии
Звук при нажатии
Не убивать приложение…
- Нажмите \"Назад\" для блокировки
+ Блокировка нажатием \"Назад\"
Блокировка базы при нажатии кнопки \"Назад\" на начальном экране
Очищать при закрытии
Закрывать базу при закрытии уведомления
@@ -385,7 +385,7 @@
Невозможно создать базу с этим паролем и ключевым файлом.
Дополнительная разблокировка
Сохранение биометрического ключа
- Сохранять главный пароль биометрическим ключом
+ ВНИМАНИЕ: использование функции биометрического распознавания не освобождает пользователя от необходимости знать главный пароль.
Открывать базу биометрическим ключом
Извлекать главный пароль биометрическим ключом
Биометрический ключ
@@ -417,14 +417,14 @@
Настройки безопасности
Настройки главного пароля
База содержит повторяющиеся UUID.
- Если вы разрешите, KeePass DX исправит проблему (путём создания новых UUID для дубликатов) и продолжит работу.
+ Если вы разрешите, KeePassDX исправит проблему (путём создания новых UUID для дубликатов) и продолжит работу.
База открыта
Копирование полей ввода с помощью буфера обмена устройства
Постоянное уведомление
Показывать уведомление, пока открыта база
Использовать дополнительную разблокировку для более лёгкого открытия базы данных
Сжатие данных
- Сжатие данных уменьшает размер базы
+ Сжатие данных уменьшает размер базы.
Максимум записей в истории
Ограничение числа элементов истории каждой записи
Максимальный размер истории
@@ -440,5 +440,15 @@
Сжатие
Нет
GZip
- Настройки клавиатуры устройства
+ Настройки клавиатур устройства
+ Невозможно сохранить базу.
+ Сохранить базу
+ Очистить \"корзину\"
+ Выполнение команды…
+ Вы уверены, что хотите навсегда удалить выбранные узлы\?
+ Хранилище ключей не инициализировано должным образом.
+ Введите пароль перед нажатием кнопки биометрии.
+ Группа \"корзины\"
+ Автосохранение базы
+ Автоматическое сохранение базы после каждого важного действия (только в \"режиме записи\")
\ No newline at end of file
diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml
index aaa0fd1fe..368eef47d 100644
--- a/app/src/main/res/values-sk/strings.xml
+++ b/app/src/main/res/values-sk/strings.xml
@@ -2,20 +2,20 @@
Spätná väzba
Domovská stránka
@@ -39,7 +39,7 @@
Dešifrujem obsah databázy…
Použiť ako predvolenú databázu
Číslice
- KeePass DX \u00A9 %1$d Kunzisoft použitie Absolútne bez Záruky. Toto je free software, a môžete ho používať pod GPL ver. 3 alebo vyššie.
+ KeePassDX © %1$d Kunzisoft použitie Absolútne bez Záruky. Toto je free software, a môžete ho používať pod GPL ver. 3 alebo vyššie.
Vložte názov Databázy
Pristupované
Zrušiť
@@ -54,8 +54,8 @@
Meno
URL
Meno používateľa
- ArcFour stream šifra nieje podporovaná.
- KeePass DX nevie použiť túto uri.
+ Arcfour stream šifra nieje podporovaná.
+ KeePassDX nevie použiť túto uri.
Neviem vytvoriť súbor:
Chybná databáza.
Chybná cesta.
diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml
index 5cf59ea62..834d679df 100644
--- a/app/src/main/res/values-sv/strings.xml
+++ b/app/src/main/res/values-sv/strings.xml
@@ -2,20 +2,20 @@
@@ -29,13 +29,13 @@
Tidsgräns för app
Inaktivitet innan appen låses
App
- Inställningar för applikation
+ App-inställningar
Visa inte igen
Parenteser
Skapa, öppna och spara en databasfil kräver att du installerar en filhanterare som accepterar avsiktlig åtgärd ACTION_CREATE_DOCUMENT och ACTION_OPEN_DOCUMENT
Urklipp har rensats
Urklippsfel
- Vissa Samsung Android-telefoner låter inte appar använda Urklipp.
+ Vissa enheter låter inte appar använda urklipp.
Det gick inte att rensa urklipp
Tidsgräns för urklipp
Lagringens varaktighet i urklippet
@@ -45,35 +45,35 @@
Dekrypterar databasinnehåll…
Använd som standarddatabas
Siffror
- KeePass DX \u00A9 %1$d Kunzisoft kommer HELT UTAN GARANTIER; Detta är fri programvara och du är välkommen att distribuera den utifrån villkoren i GPL version 3 eller senare.
- Ange databasnamn
+ KeePassDX © %1$d Kunzisoft kommer helt utan garantier. Detta är fri programvara och du är välkommen att distribuera den utifrån villkoren i GPL version 3 eller senare.
+ Öppna befintlig databas
Senast använd
Avbryt
- Kommentarer
+ Anteckningar
Bekräfta lösenord
Skapad
- Upphör att gälla
+ Upphör
Nyckelfil
- Senast ändrad
+ Ändrad
Lösenord
Spara
Namn
URL
Användarnamn
- Strömchiffret ArcFour stöds inte.
- KeePass DX kan inte hantera denna URI.
+ Strömchiffret Arcfour stöds inte.
+ KeePassDX kunde inte hantera denna URI.
Kunde inte skapa filen:
- Ogiltig databas.
- Ogiltig sökväg.
- Ett namn krävs.
- Ett lösenord eller en nyckelfil är ett krav.
- The phone ran out of memory while parsing your database. It may be too large for your phone.
- At least one password generation type must be selected
+ Kunde inte läsa databas.
+ Se till att sökvägen är korrekt.
+ Ange ett namn.
+ Välj en nyckelfil.
+ Otillräckligt minne för att ladda hela databasen.
+ Minst en lösenords-genereringstyp måste väljas.
Lösenorden matchar inte.
- Antalet rundor är för stort. Sätter värdet till 2147483648.
- Ett fältnamn krävs för varje sträng.
- En titel krävs.
- Ange ett positivt heltal i fältet för längd
+ \"Transformationsrundor\" är för stort. Sätter värdet till 2147483648.
+ Varje sträng måste ha ett fältnamn.
+ Lägg till en titel.
+ Ange ett positivt heltal i fältet för längd.
Fältnamn
Fältvärde
Filhanterare
@@ -87,9 +87,9 @@
Lösenord
Installera från Play Store
Installera från F-Droid
- Ogiltigt lösenord eller nyckelfil.
- Ogiltig algoritm.
- Databasformatet är okänt.
+ Det gick inte att läsa autentiseringsuppgifterna. Om detta inträffar igen kan det bero på att databasfilen är skadad.
+ Fel algoritm.
+ Det gick inte att känna igen databasformatet.
Nyckelfilen existerar inte.
Nyckelfilen är tom.
Längd
@@ -97,16 +97,16 @@
Textstorlek i grupplistan
Laddar databas…
Gemener
- Maskera lösenord
- Döljer lösenord som standard
+ Dölj lösenord
+ Döljer lösenord (***) som standard
Om
- Byt nyckelfil
+ Byt huvudnyckel
Inställningar
Databasinställningar
Radera
Donera
Redigera
- Göm lösenord
+ Dölj lösenord
Lås databas
Öppna
Sök
@@ -115,25 +115,25 @@
Bindestreck
Aldrig
Inget sökresultat
- Inget standardprogram för denna URL.
- Senat öppnade databaser :
- Sök inte efter poster i backup/papperskorg
- Söker inte efter poster i \'Backup\' eller \'Recycle Bin\'
+ Installera en webbläsare för att öppna denna URL.
+ Senast öppnade databaser
+ Sök inte efter backup-poster
+ Utelämnar poster i grupperna \"Backup\" och \"Papperskorg\"
Skapar ny databas…
Arbetar…
Skydd
- Sparar sökvägar till nyckelfiler
+ Kommer ihåg sökvägar till databasers nyckelfiler
Spara nyckelfil
Ta bort
Rijndael (AES)
Root
- Krypteringsrundor
- Högre antal krypteringsrundor ger ytterligare skydd mot "brute force"-attacker, men kan göra att ladda och spara går betydligt långsammare.
- rundor
+ Transformationsrundor
+ Högre antal krypteringsrundor ger ytterligare skydd mot bruteforce-attacker, men kan göra det betydligt långsammare att ladda och spara.
+ transformationsrundor
Sparar databas…
Mellanslag
Sök
- Sortera efter databasordning
+ Naturlig ordning
Specialtecken
Postens titel/beskrivning
Sökresultat
@@ -141,9 +141,11 @@
Understreck
Databasversionen stöds ej.
Versaler
- SD-kortet är för närvarande inte monterat på enheten. Du kan inte skapa/ladda databasen.
+ Montera SD-kortet för att skapa eller ladda in en databas.
Version %1$s
- Ange lösenord och/eller nyckelfil för att öppna databasen.
+ Ange lösenord och/eller nyckelfil för att öppna databasen.
+\n
+\nBacka upp databasfilen på ett säkert ställe efter varje ändring.
- 5 sekunder
- 10 sekunder
@@ -168,14 +170,14 @@
Svep för att rensa urklipp nu
Öppna fil
Lägg till nod
- Lägg till post
+ Ny post
Lägg till grupp
Filinformation
- Lösenord kryssruta
- Nyckelfil kryssruta
+ Lösenordskryssruta
+ Nyckelfilskryssruta
Repetera växla lösenordssynlighet
- Post ikon
- Post spara
+ Post-ikon
+ Spara post
Lösenordsgenerator
Lösenords längd
Lägg till fält
@@ -185,4 +187,268 @@
Stäng fält
Huvudnyckel
Säkerhet
+ Kunde inte hitta data för posten.
+ Kunde inte aktivera autofyll-tjänsten.
+ Kunde inte hitta filen. Försök att öppna den igen från din filhanterare.
+ Kopia av %1$s
+ Formulär-ifyllning
+ Skrivskyddad
+ KeePass DX behöver skrivbehörighet för att ändra något i din databas.
+ Senaste filhistorik
+ Kom ihåg senaste filnamn
+ Krypteringsalgoritm som används för all data i databasen.
+ För att generera nyckeln till krypteringsalgoritmen kommer huvudnyckeln transformeras med en slumpmässigt saltad nyckelderivatsfunktion.
+ Minnesanvändning
+ Mängd minne (i binära bytes) som ska användas av nyckelderivatsfunktionen.
+ Parallellism
+ Grad av parallellism (dvs. antal trådar) som används av nyckelderivatsfuntionen.
+ Sortera
+ Stigande ↓
+ Grupper först
+ Papperskorg längst ner
+ Titel
+ Användarnamn
+ Skapelse
+ Ändring
+ Åtkomst
+ Varning
+ Undvik lösenordstecken utöver textkodningsformatet i databasfilen (okända tecken konverteras till samma bokstav).
+ Ge tillåtelse att skriva till SD-kortet för att spara ändringar i databasen.
+ Är du säker på att du verkligen inte vill skydda dina lösenord från att låsas upp\?
+ Är du säker på att du inte vill använda en krypteringsnyckel\?
+ Krypterat lösenord sparat
+ Generellt
+ Autofyll
+ KeePass DX autofyll formulär
+ Logga in med KeePass DX
+ Välj standardtjänst för autofyll
+ Längd på genererat lösenord
+ Anger standardlängden för de genererade lösenorden
+ Lösenordstecken
+ Ange tillåtna tecken för lösenordsgeneratorn
+ Urklipps-aviseringar
+ Aktivera urklipps-aviseringar för att kopiera fält när en post visas
+ Lås
+ Skärmlås
+ Lås databasen när skärmen är av
+ Kunde inte starta denna funktion.
+ Din Androidversion %1$s möter inte minimumversionen %2$s.
+ Kunde inte hitta motsvarande hårdvara.
+ Filnamn
+ Sökväg
+ Tilldela en huvudnyckel
+ Skapa ny databas
+ Filsökväg
+ Visa hela filsökvägen
+ Använd papperskorg
+ Flyttar grupper och poster till gruppen \"Papperskorg\" innan de raderas
+ Fält-typsnitt
+ Ändra typsnitt som används i fält för att se tecknen bättre
+ Lita på urklipp
+ Tillåt postens lösenord och skyddade fält att kopieras till urklipp
+ Namn på databas
+ Beskrivning på databas
+ Version på databas
+ Text
+ App
+ Annan
+ Tangentbord
+ Magikeyboard
+ Återställ hjälpskärmar
+ Visa alla hjälpskärmar igen
+ Återställ hjälpskärmar
+ Skapa din databasfil
+ Skapa din första lösenordshanteringsfil.
+ Öppna en befintlig databas
+ Öppna din tidigare databasfil från din filhanterare för att fortsätta använda den.
+ Lägg till objekt i din databas
+ Poster hjälper dig att hålla reda på dina digitala identiteter.
+\n
+\nGrupper (~ folders) organiserar poster i din databas.
+ Sök igenom poster
+ Skriv in titel, användarnamn eller innehåll från andra fält för att hämta dina lösenord.
+ Redigera posten
+ Redigera posten med anpassade fält. Pooldata kan refereras mellan olika inmatningsfält.
+ Skapa ett starkt lösenord för din post.
+ Generera ett starkt lösenord för att associera med din post, definiera det enkelt enligt kriterierna för formuläret och glöm inte ett säkert lösenord.
+ Lägg till anpassade fält
+ Registrera ett grundläggande, icke-levererat fält genom att fylla i ett nytt som du också kan skydda.
+ Lås upp din databas
+ Kopiera ett fält
+ Kopierade fält kan klistras in vart som helst.
+\n
+\nAnvänd den formulärfyllningsmetoden som du föredrar.
+ Lås databasen
+ Lås databasen snabbt, du kan ställa in att appen låser den efter ett tag och när skärmen släcks.
+ Objektsortering
+ Välj hur poster och grupper sorteras.
+ Delta
+ Hjälp till att öka stabilitet, säkerhet och med att lägga till fler funktioner.
+ Till skillnad från många andra lösenordshanterare är den här reklamfri, copyleftad fri mjukvara och samlar inte in någon personlig data på servrar,oavsett vilken version du använder.
+ Genom att köpa proffsversionen får du tillgång till den här visuella funktionen och du hjälper särskilt till med genomförseln av community-projekt.
+ Den här visuella funktionen är tillgänglig tack vare din generositet.
+ För att behålla vår frihet och alltid vara aktiva räknar vi med ditt bidrag.
+ "Den här funktionen "utvecklas och kräver ditt bidrag för att vara tillgänglig snart.
+ Genom att köpa pro-versionen,
+ Genom att bidra,
+ så uppmuntrar du utvecklare att skapa nya funktioner och att fixa buggar efter dina anmärkningar.
+ Stort tack för ditt bidrag.
+ Vi jobbar hårt med att släppa den här funktionen snart.
+ Glöm inte att hålla appen uppdaterad genom att installera nya versioner.
+ Ladda ner
+ Bidra
+ ChaCha20
+ AES KDF
+ Argon2
+ Apptema
+ Tema som används i appen
+ Ikonpaket
+ Ikonpaket som används i appen
+ Du kan inte lägga en grupp i sig själv.
+ Kopia
+ Flytta
+ Klistra in
+ Avbryt
+ Om automatisk rensning av urklippet misslyckas, radera dess historik manuellt.
+ VARNING: Urklipp delas mellan alla appar. Om känslig data kopieras kan annan mjukvara återskapa den.
+ Tillåt ingen huvudnyckel
+ Aktivera \"öppna\"-knappen om inga användaruppgifter har valts
+ Hjälpskärmar
+ Markerar element för att lära dig hur appen fungerar
+ Skrivskyddad
+ Modifierbar
+ Skrivskyddad
+ Öppna databasen i skrivskyddat läge som standard
+ Skrivskydda din databas
+ Ändra öppningsläge för sessionen.
+\n
+\n\"Skriv-skyddad\" förhindrar oavsiktliga ändringar till databasen.
+\n\"Modifierbar\" låter dig lägga till, radera eller ändra alla element.
+ Kunde inte ladda in databas.
+ Kunde inte ladda in nyckeln. Prova att sänka KDF \"Minnesanvändning\".
+ Visa användarnamn
+ Visa användarnamn i post-listor
+ Urklipp
+ Build %1$s
+ Magikeyboard
+ Magikeyboard (KeePass DX)
+ Inställningar för Magikeyboard
+ Post
+ Timeout
+ Timeout för att rensa tangentbordsposten
+ Aviseringsinformation
+ Visa en avisering när en post är tillgänglig
+ Post
+ %1$s finns tillgänglig på Magikeyboard
+ %1$s
+ Rensa vid stängning
+ Stäng databasen när aviseringen stängs
+ Utseende
+ Tangentbordstema
+ Tangenter
+ Vibrera vid knapptryckning
+ Ljud vid knapptryckning
+ Val-läge
+ Stäng inte appen…
+ Tryck på tillbaka-knappen för att låsa
+ Lås databasen när användaren klickar på tillbaka-knappen från startskärmen
+ Rensa vid stängning
+ Stäng databasen när aviseringen stängs
+ Papperskorg
+ Val av post
+ Visa inmatningsfält i Magikeyboard när en post visas
+ Radera lösenord
+ Raderar det skrivna lösenordet efter ett anslutningsförsök
+ Under-noder
+ UUID
+ Du kan inte flytta en post hit.
+ Du kan inte kopiera en post här.
+ Visa antal poster
+ Visa antalet poster i en grupp
+ Det går inte att skapa en databas med det här lösenordet och nyckelfilen.
+ Avancerad upplåsning
+ Radera sparad biometrisk nyckel
+ Biometrisk prompt stöds men är inte konfigurerad.
+ Öppna den biometriska prompten för att låsa upp databasen
+ Öppna den biometriska prompten för att lagra autentiseringsuppgifter
+ Spara biometrisk igenkänning
+ VARNING: Användandet av biometrisk igenkänning befriar dig inte från att veta ditt huvudlösenord.
+ Öppna databas med biometrisk igenkänning
+ Hämta databasinformation med biometrisk data
+ Kan inte läsa den biometriska nyckeln. Radera den och gör om den biometriska igenkänningsproceduren.
+ Känner inte igen biometrik
+ Biometriskt fel: %1$s
+ Den här databasen har inga sparade autentiseringsuppgifter ännu.
+ Utseende
+ Biometrik
+ Avancerad upplåsning
+ Biometrisk upplåsning
+ Låter dig skanna din biometrik för att öppna databasen
+ Öppna biometrisk prompt automatiskt
+ Öppna biometrisk prompt automatiskt när en biometrisk nyckel är definierad för en databas
+ Radera krypteringsnycklar
+ Radera alla krypteringsnycklar som hör till den biometriska igenkänningen
+ Är du säker på att du vill radera alla nycklar som hör till den biometriska igenkänningen\?
+ Aktivera
+ Avaktivera
+ Historik
+ Konfigurera engångslösenord
+ OTP-typ
+ Hemlighet
+ Period (sekunder)
+ Räknare
+ Siffror
+ Algoritm
+ OTP
+ Ogiltig OTP-hemlighet.
+ Minst en användaruppgift måste anges.
+ Du kan inte kopiera en grupp här.
+ Hemlighet måste vara i Base32-format.
+ Räknare måste vara mellan %1$d and %2$d.
+ Period måste vara mellan %1$d and %2$d sekunder.
+ Pollett måste innehålla %1$d till %2$d siffror.
+ %1$s med samma UUID %2$s finns redan.
+ Skapar databas…
+ Säkerhetsinställningar
+ Inställningar för huvudnyckel
+ Databasen innehåller dubbla UUID:er.
+ Genom att bekräfta den här dialogrutan kommer KeePass DX lösa problemet (genom att generera nya UUID:er för dubletter) och fortsätta.
+ Historik
+ Aktivera autofyll för att snabbt kunna fylla i formulär i andra appar
+ Databas öppnad
+ Kopiera post-fält med hjälp av enhetens urklipp
+ Beständig avisering
+ Lägg till en avisering när databasen är öppen
+ Använd avancerad upplåsning för att öppna en databas enklare
+ Datakomprimering
+ Datakomprimering reducerar databasens storlek.
+ Max. historikobjekt
+ Begränsar antalet historikobjekt per post
+ Max. historikstorlek
+ Begränsa historikens storlek per post (i binära bytes)
+ Rekommenderas att ändra
+ Rekommenderas att ändra huvudnyckeln (dagar)
+ Tvingad ändring
+ Tvungen att ändra huvudnyckeln (dagar)
+ Tvinga ändring nästa gång
+ Tvinga ändring av huvudnyckeln nästa gång (en gång)
+ Standard-användarnamn
+ Anpassad databasfärg
+ Komprimering
+ Ingen
+ GZip
+ Aktivera ett anpassat tangentbord som innehåller dina lösenord och alla identitetsfält
+ Enhetens tangentbordsinställningar
+ Lås upp databasen med biometrik
+ Länka dina lösenord till din skannande biometrik för att snabbt låsa upp din databas.
+ Kunde inte spara databas.
+ Spara databas
+ Töm papperskorg
+ Utför kommandot …
+ Är du säker på att du vill radera de valda noderna permanent\?
+ Keystore har inte initierats korrekt.
+ Skriv lösenordet innan du klickar på biometrik-knappen.
+ Papperskorgsgruppen
+ Autospara databas
+ Spara databasen automatiskt efter en viktig händelse (endast i läget \"Modifierbar\")
\ No newline at end of file
diff --git a/app/src/main/res/values-sw600dp-land/dimens.xml b/app/src/main/res/values-sw600dp-land/dimens.xml
index 1c997bf84..ee7b49205 100644
--- a/app/src/main/res/values-sw600dp-land/dimens.xml
+++ b/app/src/main/res/values-sw600dp-land/dimens.xml
@@ -1,4 +1,22 @@
+
0.5
diff --git a/app/src/main/res/values-sw600dp-port/dimens.xml b/app/src/main/res/values-sw600dp-port/dimens.xml
index f6bb99ee0..9184c0fe9 100644
--- a/app/src/main/res/values-sw600dp-port/dimens.xml
+++ b/app/src/main/res/values-sw600dp-port/dimens.xml
@@ -1,4 +1,22 @@
+
0.7
diff --git a/app/src/main/res/values-te/strings.xml b/app/src/main/res/values-te/strings.xml
index 82db1a564..1c0eb7b1f 100644
--- a/app/src/main/res/values-te/strings.xml
+++ b/app/src/main/res/values-te/strings.xml
@@ -1,7 +1,7 @@
అభిప్రాయం:
హోమ్ పేజీ:
- KeePass DX అనేది KeePass పాస్వర్డ్ మేనేజర్ యొక్క యాండ్రాయిడ్ అమలు.
+ KeePassDX అనేది KeePass పాస్వర్డ్ మేనేజర్ యొక్క యాండ్రాయిడ్ అమలు.
ఆమోదించు
"ఎంట్రీని జత చెయ్యండి "
ఎంట్రీని మార్పు చెయ్యండి
diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml
index 5d947edea..847191031 100644
--- a/app/src/main/res/values-tr/strings.xml
+++ b/app/src/main/res/values-tr/strings.xml
@@ -2,20 +2,20 @@
Geri Bildirim
Ana sayfa
@@ -38,7 +38,7 @@
Pano temizlendi
Pano hatası
Bazı Samsung Android telefonları, uygulamaların panoya kullanılmasına izin vermez.
- "Pano temizlenemedi "
+ Pano temizlenemedi
Pano zaman aşımı
Panodaki depolama süresi
Veritabanı
@@ -64,11 +64,11 @@
Veritabanı içeriği deşifre ediliyor…
Varsayılan veritabanı olarak kullan
Rakamlar
- KeePass DX © %1$d Kunzisoft kesinlikle bir garanti vermez. Bu, libre yazılımıdır ve GPL sürüm 3 veya üzeri şartlar altında yeniden dağıtmanız mümkündür.
+ KeePassDX © %1$d Kunzisoft kesinlikle bir garanti vermez. Bu, libre yazılımıdır ve GPL sürüm 3 veya üzeri şartlar altında yeniden dağıtmanız mümkündür.
Süre sonu
Anahtar dosya
- ARCFOUR akış şifresi desteklenmiyor.
- Bu URI, KeePass DX\'te işlenemedi.
+ Arcfour akış şifresi desteklenmiyor.
+ Bu URI, KeePassDX\'te işlenemedi.
Bir anahtar dosyası seçin.
Tüm veritabanınızı yüklemek için bellek yok.
Veritabanınız yüklenemedi.
@@ -94,8 +94,8 @@
parola
Parola
F-Droid\'den yükleyin
- "Play Store\'dan yükleyin "
- Parola veya anahtar dosya okunamadı.
+ Play Store\'dan yükleyin
+ Kimlik bilgileri okunamadı. Bu tekrar ederse, veritabanı dosyanız bozuk olabilir.
Yanlış algoritma.
Veritabanı biçimi tanımlanamadı.
Hiç anahtar dosya yok.
@@ -107,7 +107,7 @@
Öğe listesindeki metin boyutu
Veritabanı yükleniyor…
Küçük harf
- "Parolaları gizle "
+ Parolaları gizle
Parola maskesi. Varsayılan (***)
Hakkında
Ana anahtarı değiştir
@@ -123,7 +123,7 @@
Yapıştır
Sil
İptal
- "Parolayı gizle "
+ Parolayı gizle
Veritabanını kilitle
Aç
Ara
@@ -144,8 +144,7 @@
Çalışıyor…
Koruma
Yazma korumalı
- Veritabanınızdaki herhangi bir şeyi değiştirmek için KeePass DX\'in yazma iznine ihtiyacı var.
- Android KitKat ile başlayan bazı cihazlar artık uygulamaların SD karta yazmasına izin vermiyor.
+ Veritabanınızdaki herhangi bir şeyi değiştirmek için KeePassDX\'in yazma iznine ihtiyacı var.
Son dosya geçmişi
Son dosya adlarını hatırla
Veritabanı anahtar dosyaların yerini hatırlar
@@ -165,8 +164,7 @@
Boşluk
Ara
Sırala
- En düşük önce
-\n
+ Önce en düşük ↓
Grup önce
Alttaki geri dönüşüm kutusu
Doğal sıra
@@ -202,8 +200,8 @@
Görünüm
Genel
Otomatik Doldurma
- KeePass DX formu otomatik doldurma
- KeePass DX ile giriş yap
+ KeePassDX formu otomatik doldurma
+ KeePassDX ile giriş yap
Varsayılan otomatik doldurma hizmetini ayarla
Diğer uygulamalardaki formları hızlı doldurmak için otomatik doldurmayı etkinleştirin
Oluşturulan parola boyutu
@@ -229,7 +227,6 @@
Dosya adı
Yol
Ana anahtar atayın
- Bayt
Dosya yolu
Tam dosya yolunu görüntüle
Geri Dönüşüm Kutusunu kullan
@@ -249,7 +246,7 @@
Magikeyboard
Parolalarınızı ve tüm kimlik alanlarınızı içeren özel bir klavye etkinleştirin
Magikeyboard
- Magikeyboard (KeePass DX)
+ Magikeyboard (KeePassDX)
Magikeyboard ayarları
Girdi
Zaman aşımı
@@ -317,10 +314,8 @@
Bu görsel özellik, cömertliğiniz sayesinde kullanılabilir.
Özgürlüğümüzü korumak ve daima aktif olmak için katkılarınıza güveniyoruz
Bu özellik geliştirme aşamasındadır ve katkılarınızın yakında kullanıma sunulmasını gerektirir.
-
- Pro sürümü satın alarak,
-
- Katkıda bulunarak,
+ Pro sürümü satın alarak,
+ Katkıda bulunarak,
Geliştiricilerin yeni özellikler oluşturmasını ve söz konusu hatalara göre hataları düzeltmesini teşvik ediyorsunuz.
Katkınız için çok teşekkür ederim.
Bu özelliği çabucak yayınlamak için çok çalışıyoruz.
@@ -373,7 +368,7 @@
Bu parola ve anahtar dosyası ile veritabanı oluşturulamıyor.
Gelişmiş kilit açma
Biyometrik tanımayı kaydedin
- Biyolojik verilerle veritabanı kimlik bilgilerini saklayın
+ UYARI: Biyometrik tanıma kullanımı sizi ana şifrenizi bilmekten muaf tutmaz.
Biyometrik tanıma ile veritabanı aç
Biyometrik verilerle veritabanı kimlik bilgilerini çıkar
Biyometrik
@@ -384,7 +379,7 @@
Ana Anahtar
Güvenlik
Geçmiş
- Tek Seferlik Parola Ayarla
+ Tek seferlik parola ayarla
OTP türü
Sır
Periyot (saniye)
@@ -404,7 +399,7 @@
Güvenlik ayarları
Ana Anahtar ayarları
Veritabanı tekrarlanan UUID\'ler içermektedir.
- Bu iletişim kutusunu doğrulayarak, KeePass DX sorunu çözecek (tekrarlananlar için yeni UUID\'ler oluşturarak) ve devam edecektir.
+ Bu iletişim kutusunu doğrulayarak, KeePassDX sorunu çözecek (tekrarlananlar için yeni UUID\'ler oluşturarak) ve devam edecektir.
Veritabanı açıldı
Cihazınızın panosunu kullanarak giriş alanlarını kopyala
Kalıcı bildirim
@@ -428,4 +423,14 @@
Yok
GZip
Cihaz Klavye Ayarları
+ Veritabanı kaydedilemedi.
+ Veritabanını kaydet
+ Geri Dönüşüm Kutusunu Boşalt
+ Komut çalıştırılıyor…
+ Seçili düğümleri kalıcı olarak silmek istediğinizden emin misiniz\?
+ Anahtar deposu düzgün bir şekilde başlatılmadı.
+ Biyometrik butona tıklamadan önce şifreyi yazın.
+ Geri dönüşüm kutusu grubu
+ Veritabanını otomatik kaydet
+ Önemli bir işlemden sonra veritabanını otomatik olarak kaydet (yalnızca \"Değiştirilebilir\" modunda)
\ No newline at end of file
diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml
index 52a7816c0..827c655c5 100644
--- a/app/src/main/res/values-uk/strings.xml
+++ b/app/src/main/res/values-uk/strings.xml
@@ -2,25 +2,25 @@
Зворотний зв’язок:
Домашня сторінка:
- KeePass DX є Android версією менеджера паролів KeePass.
+ KeePassDX є Android версією менеджера паролів KeePass.
Прийняти
Додати запис
Додати групу
@@ -40,7 +40,7 @@
Розшифрування змісту бази даних…
Використовувати як мою типову базу даних
Цифри
- KeePass DX \u00A9 %1$d Kunzisoft comes with absolutely no warranty. This is free software, and you are welcome to redistribute it under the conditions of the GPL version 3 or later.
+ KeePassDX © %1$d Kunzisoft comes with absolutely no warranty. This is free software, and you are welcome to redistribute it under the conditions of the GPL version 3 or later.
Введіть ім’я бази даних
Доступ
Відміна
@@ -55,8 +55,8 @@
Ім’я
URL
Ім’я користувача
- Потокове шифрування ArcFour не підтримується.
- KeePass DX не може опрацювати цю адресу.
+ Потокове шифрування Arcfour не підтримується.
+ KeePassDX не може опрацювати цю адресу.
Не можливо створити файл:
Невірна база даних.
Невірний шлях.
diff --git a/app/src/main/res/values-v14/styles.xml b/app/src/main/res/values-v14/styles.xml
index 397383cfa..c1322ce0b 100644
--- a/app/src/main/res/values-v14/styles.xml
+++ b/app/src/main/res/values-v14/styles.xml
@@ -1,4 +1,22 @@
+
\ No newline at end of file
diff --git a/app/src/main/res/values/style_purple.xml b/app/src/main/res/values/style_purple.xml
index 150dd459e..c62d92806 100644
--- a/app/src/main/res/values/style_purple.xml
+++ b/app/src/main/res/values/style_purple.xml
@@ -2,20 +2,20 @@
diff --git a/app/src/main/res/values/style_red.xml b/app/src/main/res/values/style_red.xml
index 2314fc58f..ef94a0bdf 100644
--- a/app/src/main/res/values/style_red.xml
+++ b/app/src/main/res/values/style_red.xml
@@ -2,20 +2,20 @@
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 0d35b2f19..b67c6315c 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -2,20 +2,20 @@
@@ -137,6 +137,63 @@
- @style/KeepassDXStyle.Expanded.Title
- @style/KeepassDXStyle.Collapsed.Title
+
@@ -152,6 +209,13 @@
- @color/background_night
+
+
+
+
+
+
+
+
@@ -328,4 +408,10 @@
- 16sp
+
+
+
diff --git a/app/src/main/res/xml/keyboard_method.xml b/app/src/main/res/xml/keyboard_method.xml
index 18c026733..6a2222bd8 100644
--- a/app/src/main/res/xml/keyboard_method.xml
+++ b/app/src/main/res/xml/keyboard_method.xml
@@ -2,20 +2,20 @@
.
+ along with KeePassDX. If not, see .
-->
.
+ along with KeePassDX. If not, see .
-->
.
+ along with KeePassDX. If not, see .
-->
diff --git a/app/src/main/res/xml/preferences_advanced_unlock.xml b/app/src/main/res/xml/preferences_advanced_unlock.xml
index 39fbbdbb0..db45ab418 100644
--- a/app/src/main/res/xml/preferences_advanced_unlock.xml
+++ b/app/src/main/res/xml/preferences_advanced_unlock.xml
@@ -2,20 +2,20 @@
.
+ along with KeePassDX. If not, see .
-->
@@ -72,6 +72,11 @@
+
.
+ along with KeePassDX. If not, see .
-->
diff --git a/app/src/main/res/xml/preferences_database.xml b/app/src/main/res/xml/preferences_database.xml
index 9dab9f174..8d4e9f6b0 100644
--- a/app/src/main/res/xml/preferences_database.xml
+++ b/app/src/main/res/xml/preferences_database.xml
@@ -2,20 +2,20 @@
diff --git a/app/src/main/res/xml/preferences_database_master_key.xml b/app/src/main/res/xml/preferences_database_master_key.xml
index 8472e961f..8be20ef0d 100644
--- a/app/src/main/res/xml/preferences_database_master_key.xml
+++ b/app/src/main/res/xml/preferences_database_master_key.xml
@@ -2,20 +2,20 @@
diff --git a/app/src/main/res/xml/preferences_database_security.xml b/app/src/main/res/xml/preferences_database_security.xml
index 2385e6870..e8a94abd1 100644
--- a/app/src/main/res/xml/preferences_database_security.xml
+++ b/app/src/main/res/xml/preferences_database_security.xml
@@ -2,20 +2,20 @@
.
+ along with KeePassDX. If not, see .
-->
diff --git a/app/src/main/res/xml/preferences_keyboard.xml b/app/src/main/res/xml/preferences_keyboard.xml
index 1485d6e1e..dbdc51d9c 100644
--- a/app/src/main/res/xml/preferences_keyboard.xml
+++ b/app/src/main/res/xml/preferences_keyboard.xml
@@ -2,20 +2,20 @@
+
.
+ along with KeePassDX. If not, see .
-->
+
diff --git a/app/src/pro/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/pro/res/mipmap-anydpi-v26/ic_launcher_round.xml
index b2e3062c2..6658b787a 100644
--- a/app/src/pro/res/mipmap-anydpi-v26/ic_launcher_round.xml
+++ b/app/src/pro/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -1,4 +1,22 @@
+
diff --git a/app/src/pro/res/values/donottranslate.xml b/app/src/pro/res/values/donottranslate.xml
index 91fac64c1..b1535d410 100644
--- a/app/src/pro/res/values/donottranslate.xml
+++ b/app/src/pro/res/values/donottranslate.xml
@@ -2,22 +2,22 @@
- KeePass DX Pro
+ KeePassDX Pro
Pro
diff --git a/art/feature_graphic.svg b/art/feature_graphic.svg
index 1ff81fde6..c64f3d79f 100644
--- a/art/feature_graphic.svg
+++ b/art/feature_graphic.svg
@@ -11,13 +11,13 @@
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
inkscape:export-ydpi="90"
inkscape:export-xdpi="90"
- inkscape:export-filename="/home/joker/Projects/KeePassDX/art/feature_graphic.png"
+ inkscape:export-filename="/home/joker/Projects/KeePassDX/fastlane/metadata/android/en-US/images/feature_graphic.png"
id="svg2"
version="1.1"
- inkscape:version="0.91 r13725"
+ inkscape:version="0.92.1 r15371"
xml:space="preserve"
- width="1024"
- height="500"
+ width="1092.2667"
+ height="533.33331"
viewBox="0 0 1024 500"
sodipodi:docname="feature_graphic.svg">image/svg+xmlKeePassProProDXDXKeePassDXDXFeatures :
- Create database files / entries and groups
- Support for .kdb and .kdbx files (version 1 to 4) with AES - Twofish - ChaCha20 - Argon2 algorithm
- - Compatible with the majority of alternative programs (KeePass, KeePassX, KeePass XC...)
+ - Compatible with the majority of alternative programs (KeePass, KeePassX, KeePassXC...)
- Allows fast copy of fields and opening of URI / URL
- Biometric recognition for fast unlocking (Fingerprint / Face unlock / ...)
- One-Time Password management (HOTP / TOTP) for Two-factor authentication (2FA)
@@ -13,7 +13,7 @@
- Precise management of settings
- Code written in native language (Kotlin / Java / JNI / C)
-Keepass DX is opensource and ad-free.
+KeePassDX is opensource and ad-free.
You can donate or buy the pro version
for a better service and a quick development of your features.
diff --git a/fastlane/metadata/android/en-US/images/featureGraphic.png b/fastlane/metadata/android/en-US/images/featureGraphic.png
index e3d6214ad..82ddcf16d 100644
Binary files a/fastlane/metadata/android/en-US/images/featureGraphic.png and b/fastlane/metadata/android/en-US/images/featureGraphic.png differ
diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/screen4.jpg b/fastlane/metadata/android/en-US/images/phoneScreenshots/screen4.jpg
index b7dcf6324..934d509f0 100644
Binary files a/fastlane/metadata/android/en-US/images/phoneScreenshots/screen4.jpg and b/fastlane/metadata/android/en-US/images/phoneScreenshots/screen4.jpg differ
diff --git a/fastlane/metadata/android/en-US/short_description.txt b/fastlane/metadata/android/en-US/short_description.txt
index ebb3fb08e..68be39c78 100644
--- a/fastlane/metadata/android/en-US/short_description.txt
+++ b/fastlane/metadata/android/en-US/short_description.txt
@@ -1 +1 @@
-KeePass Deluxe, secure and open source password manager
+Secure and open source password manager compatible with KeePass files.
diff --git a/fastlane/metadata/android/en-US/title.txt b/fastlane/metadata/android/en-US/title.txt
index d8058b033..3636a5061 100644
--- a/fastlane/metadata/android/en-US/title.txt
+++ b/fastlane/metadata/android/en-US/title.txt
@@ -1 +1 @@
-KeePass DX
\ No newline at end of file
+KeePassDX
\ No newline at end of file
diff --git a/fastlane/metadata/android/fr-FR/changelogs/26.txt b/fastlane/metadata/android/fr-FR/changelogs/26.txt
new file mode 100644
index 000000000..cfd919f9f
--- /dev/null
+++ b/fastlane/metadata/android/fr-FR/changelogs/26.txt
@@ -0,0 +1,11 @@
+ * Téléchargement des fichiers joints
+ * Changement du texte de format de fichiers
+ * Empêche la capture pour tous les écrans
+ * Touche "Go" exécutée automatiquement dans Magikeyboard
+ * Restauration et suppression d'historique d'entrée
+ * Paramètre pour cacher les entrées expirées
+ * Nouveau thème noir
+ * Correction du crash pendant le vidage du presse-papiers
+ * Correction des compressions des fichiers joints
+ * Correction des dates
+ * Correction du message UUID pour les bases de données V1
\ No newline at end of file
diff --git a/fastlane/metadata/android/fr-FR/full_description.txt b/fastlane/metadata/android/fr-FR/full_description.txt
index fcb244300..cb928390e 100644
--- a/fastlane/metadata/android/fr-FR/full_description.txt
+++ b/fastlane/metadata/android/fr-FR/full_description.txt
@@ -3,7 +3,7 @@
Fonctionnalités :
- Création de bases de données / entrées et groupes
- Support des fichiers .kdb et .kdbx (version 1 à 4) avec algorithme AES - Twofish - ChaCha20 - Argon2
- - Compatible avec la majorité des programmes alternatifs (KeePass, KeePassX, KeePass XC...)
+ - Compatible avec la majorité des programmes alternatifs (KeePass, KeePassX, KeePassXC...)
- Permet la copie rapide de champs et l'ouverture d'URI /URL
- Reconnaissance biométrique pour un déblocage rapide (Empreintes digitales / Déverouillage par visage / ...)
- Gestion des mots de passe à usage unique (One-Time Password HOTP / TOTP) pour l'authentification à deux facteurs (2FA)
@@ -13,7 +13,7 @@
- Gestion précise des paramètres
- Code écrit en langage natif (Kotlin / Java / JNI / C)
-Keepass DX est opensource et sans publicité.
+KeePassDX est opensource et sans publicité.
Vous pouvez faire un don ou acheter la version pro
pour un meilleur service et un développement rapide de vos fonctionnalités.
diff --git a/fastlane/metadata/android/fr-FR/images/phoneScreenshots/screen4.jpg b/fastlane/metadata/android/fr-FR/images/phoneScreenshots/screen4.jpg
index 888cd8c2e..f43294348 100644
Binary files a/fastlane/metadata/android/fr-FR/images/phoneScreenshots/screen4.jpg and b/fastlane/metadata/android/fr-FR/images/phoneScreenshots/screen4.jpg differ
diff --git a/fastlane/metadata/android/fr-FR/short_description.txt b/fastlane/metadata/android/fr-FR/short_description.txt
index 771fc3fad..07639b8d5 100644
--- a/fastlane/metadata/android/fr-FR/short_description.txt
+++ b/fastlane/metadata/android/fr-FR/short_description.txt
@@ -1 +1 @@
-KeePass Deluxe, gestionnaire de mots de passe sécurisé et open source
+Gestionnaire de mots de passe sécurisé et open source compatible fichiers KeePass
diff --git a/fastlane/pro/metadata/android/en-US/full_description.txt b/fastlane/pro/metadata/android/en-US/full_description.txt
index f6997e641..fbe94b498 100644
--- a/fastlane/pro/metadata/android/en-US/full_description.txt
+++ b/fastlane/pro/metadata/android/en-US/full_description.txt
@@ -9,7 +9,7 @@ This pro version is under development, buying it encourages faster developmen
- Compatible with the majority of alternative programs (KeePass, KeePassX, KeePass XC...)
- Allows fast copy of fields and opening of URI / URL
- Biometric recognition for fast unlocking (Fingerprint / Face unlock / ...)
- - One-Time Password management (HOTP / TOTP)
+ - One-Time Password management (HOTP / TOTP) for Two-factor authentication (2FA)
- Material design with themes
- AutoFill and Integration
- Field filling keyboard
@@ -21,6 +21,6 @@ This pro version is under development, buying it encourages faster developmen
- TOTP Steam creation
- Deleting donation buttons
-Keepass DX is opensource and ad-free.
+KeePassDX is opensource and ad-free.
Any issue : https://github.com/Kunzisoft/KeePassDX/issues
diff --git a/fastlane/pro/metadata/android/en-US/images/featureGraphic.png b/fastlane/pro/metadata/android/en-US/images/featureGraphic.png
index 2aabace67..74d7a647c 100644
Binary files a/fastlane/pro/metadata/android/en-US/images/featureGraphic.png and b/fastlane/pro/metadata/android/en-US/images/featureGraphic.png differ
diff --git a/fastlane/pro/metadata/android/en-US/short_description.txt b/fastlane/pro/metadata/android/en-US/short_description.txt
index 8ce3b5d00..b2687a7ff 100644
--- a/fastlane/pro/metadata/android/en-US/short_description.txt
+++ b/fastlane/pro/metadata/android/en-US/short_description.txt
@@ -1 +1 @@
-Pro version of KeePass Deluxe, secure and open source password manager
+Pro version of KeePassDX, secure and open source password manager
diff --git a/fastlane/pro/metadata/android/en-US/title.txt b/fastlane/pro/metadata/android/en-US/title.txt
index 5f0462ba7..957d0de73 100644
--- a/fastlane/pro/metadata/android/en-US/title.txt
+++ b/fastlane/pro/metadata/android/en-US/title.txt
@@ -1 +1 @@
-KeePass DX Pro
+KeePassDX Pro
diff --git a/fastlane/pro/metadata/android/fr-FR/full_description.txt b/fastlane/pro/metadata/android/fr-FR/full_description.txt
index 8a1c4d422..dca7c09bc 100644
--- a/fastlane/pro/metadata/android/fr-FR/full_description.txt
+++ b/fastlane/pro/metadata/android/fr-FR/full_description.txt
@@ -9,7 +9,7 @@ Cette version pro est en cours de développement, en l'achetant vous encouragez
- Compatible avec la majorité des programmes alternatifs (KeePass, KeePassX, KeePass XC...)
- Permet la copie rapide de champs et l'ouverture d'URI /URL
- Reconnaissance biométrique pour un déblocage rapide (Empreintes digitales / Déverouillage par visage / ...)
- - Gestion de One-Time Password (HOTP / TOTP)
+ - Gestion de One-Time Password (HOTP / TOTP) pour l'authentification à deux facteurs (2FA)
- Material design avec thèmes
- Remplissage automatique de champs
- Clavier de remplissage de champs
@@ -21,7 +21,7 @@ Cette version pro est en cours de développement, en l'achetant vous encouragez
- Création de TOTP Steam
- Suppression des boutons de don
-Keepass DX est opensource et sans publicité.
+KeePassDX est opensource et sans publicité.
Vous avez un bug : https://github.com/Kunzisoft/KeePassDX/issues
diff --git a/fastlane/pro/metadata/android/fr-FR/short_description.txt b/fastlane/pro/metadata/android/fr-FR/short_description.txt
index 38f98c1b0..54bff4bf5 100644
--- a/fastlane/pro/metadata/android/fr-FR/short_description.txt
+++ b/fastlane/pro/metadata/android/fr-FR/short_description.txt
@@ -1 +1 @@
-Version pro de KeePass DX, gestionnaire de mots de passe sécurisé et open source
+Version pro de KeePassDX, gestionnaire de mots de passe sécurisé et open source
diff --git a/gplv3.md b/gplv3.md
index 7bdad759f..dcbfa4ee3 100644
--- a/gplv3.md
+++ b/gplv3.md
@@ -593,8 +593,8 @@ them to the start of each source file to most effectively state the exclusion
of warranty; and each file should have at least the *copyright* line and a
pointer to where the full notice is found.
- KeePass DX, Android KeePass Manager
- Copyright (C) 2018 Jeremy JAMET / Kunzisoft
+ KeePassDX, Android KeePass Manager
+ Copyright (C) 2018 Jeremy JAMET / Kunzisoft
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -614,7 +614,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short notice like
this when it starts in an interactive mode:
- KeePass DX Copyright (C) 2018 Jeremy JAMET / Kunzisoft
+ KeePassDX Copyright (C) 2018 Jeremy JAMET / Kunzisoft
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
diff --git a/icon-pack-classic/src/main/res/values/strings.xml b/icon-pack-classic/src/main/res/values/strings.xml
index 0759533b1..d73343d3d 100644
--- a/icon-pack-classic/src/main/res/values/strings.xml
+++ b/icon-pack-classic/src/main/res/values/strings.xml
@@ -2,20 +2,20 @@
diff --git a/icon-pack-material/src/main/res/values/strings.xml b/icon-pack-material/src/main/res/values/strings.xml
index e6f5f3ac1..653191b73 100644
--- a/icon-pack-material/src/main/res/values/strings.xml
+++ b/icon-pack-material/src/main/res/values/strings.xml
@@ -2,20 +2,20 @@