mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Merge branch 'develop' into feature/Search_Refactoring
This commit is contained in:
@@ -12,8 +12,8 @@ android {
|
|||||||
applicationId "com.kunzisoft.keepass"
|
applicationId "com.kunzisoft.keepass"
|
||||||
minSdkVersion 15
|
minSdkVersion 15
|
||||||
targetSdkVersion 31
|
targetSdkVersion 31
|
||||||
versionCode = 96
|
versionCode = 97
|
||||||
versionName = "3.2.0_beta4"
|
versionName = "3.2.0"
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
|
|
||||||
testApplicationId = "com.kunzisoft.keepass.tests"
|
testApplicationId = "com.kunzisoft.keepass.tests"
|
||||||
|
|||||||
@@ -991,20 +991,25 @@ class Database {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
fun createGroup(): Group? {
|
fun createGroup(virtual: Boolean = false): Group? {
|
||||||
dataModifiedSinceLastLoading = true
|
if (!virtual) {
|
||||||
|
dataModifiedSinceLastLoading = true
|
||||||
|
}
|
||||||
|
var group: Group? = null
|
||||||
mDatabaseKDB?.let { database ->
|
mDatabaseKDB?.let { database ->
|
||||||
return Group(database.createGroup()).apply {
|
group = Group(database.createGroup()).apply {
|
||||||
setNodeId(database.newGroupId())
|
setNodeId(database.newGroupId())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mDatabaseKDBX?.let { database ->
|
mDatabaseKDBX?.let { database ->
|
||||||
return Group(database.createGroup()).apply {
|
group = Group(database.createGroup()).apply {
|
||||||
setNodeId(database.newGroupId())
|
setNodeId(database.newGroupId())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (virtual)
|
||||||
|
group?.isVirtual = virtual
|
||||||
|
|
||||||
return null
|
return group
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getEntryById(id: NodeId<UUID>): Entry? {
|
fun getEntryById(id: NodeId<UUID>): Entry? {
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ import com.kunzisoft.keepass.database.element.node.NodeVersioned
|
|||||||
import com.kunzisoft.keepass.database.element.security.MemoryProtectionConfig
|
import com.kunzisoft.keepass.database.element.security.MemoryProtectionConfig
|
||||||
import com.kunzisoft.keepass.database.element.template.Template
|
import com.kunzisoft.keepass.database.element.template.Template
|
||||||
import com.kunzisoft.keepass.database.element.template.TemplateEngineCompatible
|
import com.kunzisoft.keepass.database.element.template.TemplateEngineCompatible
|
||||||
import com.kunzisoft.keepass.database.exception.UnknownKDF
|
|
||||||
import com.kunzisoft.keepass.database.file.DatabaseHeaderKDBX.Companion.FILE_VERSION_31
|
import com.kunzisoft.keepass.database.file.DatabaseHeaderKDBX.Companion.FILE_VERSION_31
|
||||||
import com.kunzisoft.keepass.database.file.DatabaseHeaderKDBX.Companion.FILE_VERSION_40
|
import com.kunzisoft.keepass.database.file.DatabaseHeaderKDBX.Companion.FILE_VERSION_40
|
||||||
import com.kunzisoft.keepass.database.file.DatabaseHeaderKDBX.Companion.FILE_VERSION_41
|
import com.kunzisoft.keepass.database.file.DatabaseHeaderKDBX.Companion.FILE_VERSION_41
|
||||||
@@ -92,12 +91,7 @@ class DatabaseKDBX : DatabaseVersioned<UUID, UUID, GroupKDBX, EntryKDBX> {
|
|||||||
var kdfParameters: KdfParameters? = null
|
var kdfParameters: KdfParameters? = null
|
||||||
|
|
||||||
override var kdfEngine: KdfEngine?
|
override var kdfEngine: KdfEngine?
|
||||||
get() = try {
|
get() = getKdfEngineFromParameters(kdfParameters)
|
||||||
getEngineKDBX4(kdfParameters)
|
|
||||||
} catch (unknownKDF: UnknownKDF) {
|
|
||||||
Log.i(TAG, "Unable to retrieve KDF engine", unknownKDF)
|
|
||||||
null
|
|
||||||
}
|
|
||||||
set(value) {
|
set(value) {
|
||||||
value?.let {
|
value?.let {
|
||||||
if (kdfParameters?.uuid != value.defaultParameters.uuid)
|
if (kdfParameters?.uuid != value.defaultParameters.uuid)
|
||||||
@@ -108,18 +102,16 @@ class DatabaseKDBX : DatabaseVersioned<UUID, UUID, GroupKDBX, EntryKDBX> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Throws(UnknownKDF::class)
|
private fun getKdfEngineFromParameters(kdfParameters: KdfParameters?): KdfEngine? {
|
||||||
fun getEngineKDBX4(kdfParameters: KdfParameters?): KdfEngine {
|
|
||||||
val unknownKDFException = UnknownKDF()
|
|
||||||
if (kdfParameters == null) {
|
if (kdfParameters == null) {
|
||||||
throw unknownKDFException
|
return null
|
||||||
}
|
}
|
||||||
for (engine in kdfAvailableList) {
|
for (engine in kdfAvailableList) {
|
||||||
if (engine.uuid == kdfParameters.uuid) {
|
if (engine.uuid == kdfParameters.uuid) {
|
||||||
return engine
|
return engine
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw unknownKDFException
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
fun randomizeKdfParameters() {
|
fun randomizeKdfParameters() {
|
||||||
@@ -553,7 +545,8 @@ class DatabaseKDBX : DatabaseVersioned<UUID, UUID, GroupKDBX, EntryKDBX> {
|
|||||||
fun makeFinalKey(masterSeed: ByteArray) {
|
fun makeFinalKey(masterSeed: ByteArray) {
|
||||||
|
|
||||||
kdfParameters?.let { keyDerivationFunctionParameters ->
|
kdfParameters?.let { keyDerivationFunctionParameters ->
|
||||||
val kdfEngine = getEngineKDBX4(keyDerivationFunctionParameters)
|
val kdfEngine = getKdfEngineFromParameters(keyDerivationFunctionParameters)
|
||||||
|
?: throw IOException("Unknown key derivation function")
|
||||||
|
|
||||||
var transformedMasterKey = kdfEngine.transform(masterKey, keyDerivationFunctionParameters)
|
var transformedMasterKey = kdfEngine.transform(masterKey, keyDerivationFunctionParameters)
|
||||||
if (transformedMasterKey.size != 32) {
|
if (transformedMasterKey.size != 32) {
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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 <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.kunzisoft.keepass.database.exception
|
|
||||||
|
|
||||||
import java.io.IOException
|
|
||||||
|
|
||||||
class UnknownKDF : IOException("Unknown key derivation function")
|
|
||||||
@@ -37,7 +37,6 @@ import com.kunzisoft.keepass.database.element.group.GroupKDBX
|
|||||||
import com.kunzisoft.keepass.database.element.node.NodeKDBXInterface
|
import com.kunzisoft.keepass.database.element.node.NodeKDBXInterface
|
||||||
import com.kunzisoft.keepass.database.element.security.MemoryProtectionConfig
|
import com.kunzisoft.keepass.database.element.security.MemoryProtectionConfig
|
||||||
import com.kunzisoft.keepass.database.exception.DatabaseOutputException
|
import com.kunzisoft.keepass.database.exception.DatabaseOutputException
|
||||||
import com.kunzisoft.keepass.database.exception.UnknownKDF
|
|
||||||
import com.kunzisoft.keepass.database.file.DatabaseHeaderKDBX
|
import com.kunzisoft.keepass.database.file.DatabaseHeaderKDBX
|
||||||
import com.kunzisoft.keepass.database.file.DatabaseHeaderKDBX.Companion.FILE_VERSION_40
|
import com.kunzisoft.keepass.database.file.DatabaseHeaderKDBX.Companion.FILE_VERSION_40
|
||||||
import com.kunzisoft.keepass.database.file.DatabaseHeaderKDBX.Companion.FILE_VERSION_41
|
import com.kunzisoft.keepass.database.file.DatabaseHeaderKDBX.Companion.FILE_VERSION_41
|
||||||
|
|||||||
@@ -39,8 +39,7 @@ class SearchHelper {
|
|||||||
searchParameters: SearchParameters,
|
searchParameters: SearchParameters,
|
||||||
max: Int): Group? {
|
max: Int): Group? {
|
||||||
|
|
||||||
val searchGroup = database.createGroup()
|
val searchGroup = database.createGroup(virtual = true)
|
||||||
searchGroup?.isVirtual = true
|
|
||||||
searchGroup?.title = "\"" + searchParameters.searchQuery + "\""
|
searchGroup?.title = "\"" + searchParameters.searchQuery + "\""
|
||||||
|
|
||||||
// Search all entries
|
// Search all entries
|
||||||
|
|||||||
@@ -90,7 +90,7 @@
|
|||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/breadcrumb_list"
|
android:id="@+id/breadcrumb_list"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||||
android:orientation="horizontal" />
|
android:orientation="horizontal" />
|
||||||
</androidx.appcompat.widget.Toolbar>
|
</androidx.appcompat.widget.Toolbar>
|
||||||
|
|||||||
Reference in New Issue
Block a user