mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2026-11-29 05:13:03 -08:00
fix: Java import
This commit is contained in:
64 files changed
+229
-190
No files matched your search
@@ -21,7 +21,7 @@ package com.kunzisoft.keepass.database.crypto
|
||||
|
||||
import com.kunzisoft.keepass.utils.bytes16ToUuid
|
||||
import java.security.NoSuchAlgorithmException
|
||||
import java.util.*
|
||||
import java.util.UUID
|
||||
|
||||
enum class EncryptionAlgorithm {
|
||||
|
||||
|
||||
@@ -19,10 +19,25 @@
|
||||
*/
|
||||
package com.kunzisoft.keepass.database.crypto
|
||||
|
||||
import com.kunzisoft.keepass.utils.*
|
||||
import java.io.*
|
||||
import com.kunzisoft.keepass.utils.UnsignedInt
|
||||
import com.kunzisoft.keepass.utils.UnsignedLong
|
||||
import com.kunzisoft.keepass.utils.bytes4ToUInt
|
||||
import com.kunzisoft.keepass.utils.bytes64ToLong
|
||||
import com.kunzisoft.keepass.utils.bytes64ToULong
|
||||
import com.kunzisoft.keepass.utils.readBytes2ToUShort
|
||||
import com.kunzisoft.keepass.utils.readBytes4ToUInt
|
||||
import com.kunzisoft.keepass.utils.readBytesLength
|
||||
import com.kunzisoft.keepass.utils.write2BytesUShort
|
||||
import com.kunzisoft.keepass.utils.write4BytesUInt
|
||||
import com.kunzisoft.keepass.utils.write8BytesLong
|
||||
import com.kunzisoft.keepass.utils.writeBooleanByte
|
||||
import com.kunzisoft.keepass.utils.writeByte
|
||||
import java.io.ByteArrayInputStream
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.io.IOException
|
||||
import java.io.InputStream
|
||||
import java.io.OutputStream
|
||||
import java.nio.charset.Charset
|
||||
import java.util.*
|
||||
|
||||
open class VariantDictionary {
|
||||
|
||||
|
||||
@@ -20,12 +20,12 @@
|
||||
package com.kunzisoft.keepass.database.crypto.kdf
|
||||
|
||||
import com.kunzisoft.encrypt.HashManager
|
||||
import com.kunzisoft.keepass.utils.UnsignedLong
|
||||
import com.kunzisoft.encrypt.aes.AESTransformer
|
||||
import com.kunzisoft.keepass.utils.UnsignedLong
|
||||
import com.kunzisoft.keepass.utils.bytes16ToUuid
|
||||
import java.io.IOException
|
||||
import java.security.SecureRandom
|
||||
import java.util.*
|
||||
import java.util.UUID
|
||||
|
||||
class AesKdf : KdfEngine() {
|
||||
|
||||
|
||||
@@ -19,14 +19,14 @@
|
||||
*/
|
||||
package com.kunzisoft.keepass.database.crypto.kdf
|
||||
|
||||
import com.kunzisoft.keepass.utils.UnsignedInt
|
||||
import com.kunzisoft.keepass.utils.UnsignedLong
|
||||
import com.kunzisoft.encrypt.argon2.Argon2Transformer
|
||||
import com.kunzisoft.encrypt.argon2.Argon2Type
|
||||
import com.kunzisoft.keepass.utils.UnsignedInt
|
||||
import com.kunzisoft.keepass.utils.UnsignedLong
|
||||
import com.kunzisoft.keepass.utils.bytes16ToUuid
|
||||
import java.io.IOException
|
||||
import java.security.SecureRandom
|
||||
import java.util.*
|
||||
import java.util.UUID
|
||||
|
||||
class Argon2Kdf(private val type: Type) : KdfEngine() {
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ package com.kunzisoft.keepass.database.crypto.kdf
|
||||
import com.kunzisoft.keepass.utils.UnsignedInt
|
||||
import java.io.IOException
|
||||
import java.io.Serializable
|
||||
import java.util.*
|
||||
import java.util.UUID
|
||||
|
||||
// TODO Parcelable
|
||||
abstract class KdfEngine : Serializable {
|
||||
|
||||
@@ -19,11 +19,11 @@
|
||||
*/
|
||||
package com.kunzisoft.keepass.database.crypto.kdf
|
||||
|
||||
import com.kunzisoft.keepass.database.crypto.VariantDictionary
|
||||
import com.kunzisoft.keepass.utils.bytes16ToUuid
|
||||
import com.kunzisoft.keepass.utils.uuidTo16Bytes
|
||||
import com.kunzisoft.keepass.database.crypto.VariantDictionary
|
||||
import java.io.IOException
|
||||
import java.util.*
|
||||
import java.util.UUID
|
||||
|
||||
class KdfParameters: VariantDictionary {
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import com.kunzisoft.keepass.utils.readStringParcelableMap
|
||||
import com.kunzisoft.keepass.utils.writeStringParcelableMap
|
||||
import java.util.*
|
||||
|
||||
class CustomData : Parcelable {
|
||||
|
||||
|
||||
@@ -286,7 +286,7 @@ open class Database {
|
||||
get() = mDatabaseKDBX != null
|
||||
|
||||
val availableCompressionAlgorithms: List<CompressionAlgorithm>
|
||||
get() = mDatabaseKDBX?.availableCompressionAlgorithms ?: ArrayList()
|
||||
get() = mDatabaseKDBX?.availableCompressionAlgorithms ?: emptyList()
|
||||
|
||||
var compressionAlgorithm: CompressionAlgorithm?
|
||||
get() = mDatabaseKDBX?.compressionAlgorithm
|
||||
@@ -331,7 +331,7 @@ open class Database {
|
||||
}
|
||||
|
||||
val availableEncryptionAlgorithms: List<EncryptionAlgorithm>
|
||||
get() = mDatabaseKDB?.availableEncryptionAlgorithms ?: mDatabaseKDBX?.availableEncryptionAlgorithms ?: ArrayList()
|
||||
get() = mDatabaseKDB?.availableEncryptionAlgorithms ?: mDatabaseKDBX?.availableEncryptionAlgorithms ?: listOf()
|
||||
|
||||
var encryptionAlgorithm: EncryptionAlgorithm?
|
||||
get() = mDatabaseKDB?.encryptionAlgorithm ?: mDatabaseKDBX?.encryptionAlgorithm
|
||||
@@ -342,7 +342,7 @@ open class Database {
|
||||
}
|
||||
|
||||
val availableKdfEngines: List<KdfEngine>
|
||||
get() = mDatabaseKDB?.kdfAvailableList ?: mDatabaseKDBX?.kdfAvailableList ?: ArrayList()
|
||||
get() = mDatabaseKDB?.kdfAvailableList ?: mDatabaseKDBX?.kdfAvailableList ?: listOf()
|
||||
|
||||
val allowKdfModification: Boolean
|
||||
get() = availableKdfEngines.size > 1
|
||||
@@ -550,7 +550,7 @@ open class Database {
|
||||
|
||||
val groupNamesNotAllowed: List<String>
|
||||
get() {
|
||||
return mDatabaseKDB?.groupNamesNotAllowed ?: ArrayList()
|
||||
return mDatabaseKDB?.groupNamesNotAllowed ?: listOf()
|
||||
}
|
||||
|
||||
private fun setDatabaseKDB(databaseKDB: DatabaseKDB) {
|
||||
|
||||
@@ -24,7 +24,7 @@ import android.os.ParcelUuid
|
||||
import android.os.Parcelable
|
||||
import com.kunzisoft.keepass.database.element.database.DatabaseVersioned
|
||||
import com.kunzisoft.keepass.utils.readParcelableCompat
|
||||
import java.util.*
|
||||
import java.util.UUID
|
||||
|
||||
class DeletedObject : Parcelable {
|
||||
|
||||
|
||||
@@ -320,7 +320,7 @@ class Entry : Node, EntryVersionedInterface<Group> {
|
||||
* @return Map of label/value
|
||||
*/
|
||||
fun getExtraFields(): List<Field> {
|
||||
val extraFields = ArrayList<Field>()
|
||||
val extraFields = mutableListOf<Field>()
|
||||
entryKDBX?.let {
|
||||
it.doForEachDecodedCustomField { field ->
|
||||
extraFields.add(field)
|
||||
@@ -391,7 +391,7 @@ class Entry : Node, EntryVersionedInterface<Group> {
|
||||
}
|
||||
|
||||
fun getAttachments(attachmentPool: AttachmentPool, inHistory: Boolean = false): List<Attachment> {
|
||||
val attachments = ArrayList<Attachment>()
|
||||
val attachments = mutableListOf<Attachment>()
|
||||
entryKDB?.getAttachment(attachmentPool)?.let {
|
||||
attachments.add(it)
|
||||
}
|
||||
@@ -421,9 +421,9 @@ class Entry : Node, EntryVersionedInterface<Group> {
|
||||
entryKDBX?.putAttachment(attachment, attachmentPool)
|
||||
}
|
||||
|
||||
fun getHistory(): ArrayList<Entry> {
|
||||
val history = ArrayList<Entry>()
|
||||
val entryKDBXHistory = entryKDBX?.history ?: ArrayList()
|
||||
fun getHistory(): List<Entry> {
|
||||
val history = mutableListOf<Entry>()
|
||||
val entryKDBXHistory = entryKDBX?.history ?: listOf()
|
||||
for (entryHistory in entryKDBXHistory) {
|
||||
history.add(Entry(entryHistory))
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ class Group : Node, GroupVersionedInterface<Group, Entry> {
|
||||
groupKDBX?.getChildGroups()?.map {
|
||||
Group(it)
|
||||
} ?:
|
||||
ArrayList()
|
||||
listOf()
|
||||
}
|
||||
|
||||
override fun getChildEntries(): List<Entry> {
|
||||
@@ -279,11 +279,11 @@ class Group : Node, GroupVersionedInterface<Group, Entry> {
|
||||
groupKDBX?.getChildEntries()?.map {
|
||||
Entry(it)
|
||||
} ?:
|
||||
ArrayList()
|
||||
listOf()
|
||||
}
|
||||
|
||||
fun getChildEntriesInfo(database: Database): List<EntryInfo> {
|
||||
val entriesInfo = ArrayList<EntryInfo>()
|
||||
val entriesInfo = mutableListOf<EntryInfo>()
|
||||
getChildEntries().forEach { entry ->
|
||||
entriesInfo.add(entry.getEntryInfo(database))
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.kunzisoft.keepass.database.element.binary
|
||||
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
class BinaryCache {
|
||||
|
||||
@@ -29,7 +28,7 @@ class BinaryCache {
|
||||
}
|
||||
|
||||
// Similar to file storage but much faster TODO SparseArray
|
||||
private val byteArrayList = HashMap<String, ByteArray>()
|
||||
private val byteArrayList = mutableMapOf<String, ByteArray>()
|
||||
|
||||
fun getByteArray(key: String): KeyByteArray {
|
||||
if (key == UNKNOWN) {
|
||||
|
||||
@@ -159,7 +159,7 @@ abstract class BinaryPool<T> {
|
||||
*/
|
||||
protected fun orderedBinariesWithoutDuplication(condition: ((binary: BinaryData) -> Boolean) = { true })
|
||||
: List<KeyBinary<T>> {
|
||||
val keyBinaryList = ArrayList<KeyBinary<T>>()
|
||||
val keyBinaryList = mutableListOf<KeyBinary<T>>()
|
||||
for ((key, binary) in pool) {
|
||||
// Don't deduplicate
|
||||
val existentBinary =
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ package com.kunzisoft.keepass.database.element.binary
|
||||
|
||||
import com.kunzisoft.keepass.database.element.DateInstant
|
||||
import com.kunzisoft.keepass.database.element.icon.IconImageCustom
|
||||
import java.util.*
|
||||
import java.util.UUID
|
||||
|
||||
class CustomIconPool : BinaryPool<UUID>() {
|
||||
|
||||
|
||||
+2
-2
@@ -866,7 +866,7 @@ class DatabaseKDBX : DatabaseVersioned<UUID, UUID, GroupKDBX, EntryKDBX> {
|
||||
}
|
||||
|
||||
fun removeUnlinkedAttachment(binary: BinaryData, clear: Boolean) {
|
||||
val listBinaries = ArrayList<BinaryData>()
|
||||
val listBinaries = mutableListOf<BinaryData>()
|
||||
listBinaries.add(binary)
|
||||
removeUnlinkedAttachments(listBinaries, clear)
|
||||
}
|
||||
@@ -878,7 +878,7 @@ class DatabaseKDBX : DatabaseVersioned<UUID, UUID, GroupKDBX, EntryKDBX> {
|
||||
private fun removeUnlinkedAttachments(binaries: List<BinaryData>, clear: Boolean) {
|
||||
// TODO check in icon pool
|
||||
// Build binaries to remove with all binaries known
|
||||
val binariesToRemove = ArrayList<BinaryData>()
|
||||
val binariesToRemove = mutableListOf<BinaryData>()
|
||||
if (binaries.isEmpty()) {
|
||||
attachmentPool.doForEachBinary { _, binary ->
|
||||
binariesToRemove.add(binary)
|
||||
|
||||
@@ -30,7 +30,7 @@ class AutoType : Parcelable {
|
||||
var enabled = true
|
||||
var obfuscationOptions = OBF_OPT_NONE
|
||||
var defaultSequence = ""
|
||||
private var windowSeqPairs = ArrayList<AutoTypeItem>()
|
||||
private var windowSeqPairs = mutableListOf<AutoTypeItem>()
|
||||
|
||||
constructor()
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ class EntryKDBX : EntryVersioned<UUID, UUID, GroupKDBX, EntryKDBX>, NodeKDBXInte
|
||||
override var previousParentGroup: UUID = DatabaseVersioned.UUID_ZERO
|
||||
var qualityCheck = true
|
||||
var autoType = AutoType()
|
||||
var history = ArrayList<EntryKDBX>()
|
||||
var history = mutableListOf<EntryKDBX>()
|
||||
var additional = ""
|
||||
|
||||
override var expires: Boolean = false
|
||||
@@ -315,7 +315,7 @@ class EntryKDBX : EntryVersioned<UUID, UUID, GroupKDBX, EntryKDBX>, NodeKDBXInte
|
||||
* It's a list because history labels can be defined multiple times
|
||||
*/
|
||||
fun getAttachments(attachmentPool: AttachmentPool, inHistory: Boolean = false): List<Attachment> {
|
||||
val entryAttachmentList = ArrayList<Attachment>()
|
||||
val entryAttachmentList = mutableListOf<Attachment>()
|
||||
for ((label, poolId) in binaries) {
|
||||
attachmentPool[poolId]?.let { binary ->
|
||||
entryAttachmentList.add(Attachment(label, binary))
|
||||
|
||||
@@ -28,7 +28,7 @@ import com.kunzisoft.keepass.database.element.node.NodeIdInt
|
||||
import com.kunzisoft.keepass.database.element.node.NodeKDBInterface
|
||||
import com.kunzisoft.keepass.database.element.node.Type
|
||||
import com.kunzisoft.keepass.utils.readParcelableCompat
|
||||
import java.util.*
|
||||
import java.util.UUID
|
||||
|
||||
class GroupKDB : GroupVersioned<Int, UUID, GroupKDB, EntryKDB>, NodeKDBInterface {
|
||||
|
||||
|
||||
@@ -31,12 +31,12 @@ import com.kunzisoft.keepass.database.element.node.NodeId
|
||||
import com.kunzisoft.keepass.database.element.node.NodeIdUUID
|
||||
import com.kunzisoft.keepass.database.element.node.NodeKDBXInterface
|
||||
import com.kunzisoft.keepass.database.element.node.Type
|
||||
import com.kunzisoft.keepass.utils.readParcelableCompat
|
||||
import com.kunzisoft.keepass.utils.readSerializableCompat
|
||||
import com.kunzisoft.keepass.utils.UnsignedLong
|
||||
import com.kunzisoft.keepass.utils.readBooleanCompat
|
||||
import com.kunzisoft.keepass.utils.readParcelableCompat
|
||||
import com.kunzisoft.keepass.utils.readSerializableCompat
|
||||
import com.kunzisoft.keepass.utils.writeBooleanCompat
|
||||
import java.util.*
|
||||
import java.util.UUID
|
||||
|
||||
class GroupKDBX : GroupVersioned<UUID, UUID, GroupKDBX, EntryKDBX>, NodeKDBXInterface {
|
||||
|
||||
|
||||
+6
-5
@@ -22,7 +22,6 @@ package com.kunzisoft.keepass.database.element.group
|
||||
import android.os.Parcel
|
||||
import com.kunzisoft.keepass.database.element.entry.EntryVersioned
|
||||
import com.kunzisoft.keepass.database.element.node.NodeVersioned
|
||||
import java.util.*
|
||||
|
||||
abstract class GroupVersioned
|
||||
<
|
||||
@@ -35,9 +34,9 @@ abstract class GroupVersioned
|
||||
|
||||
private var titleGroup = ""
|
||||
@Transient
|
||||
private val childGroups = LinkedList<Group>()
|
||||
private val childGroups = mutableListOf<Group>()
|
||||
@Transient
|
||||
private val childEntries = LinkedList<Entry>()
|
||||
private val childEntries = mutableListOf<Entry>()
|
||||
private var positionIndexChildren = 0
|
||||
|
||||
constructor() : super()
|
||||
@@ -51,8 +50,10 @@ abstract class GroupVersioned
|
||||
dest.writeString(titleGroup)
|
||||
}
|
||||
|
||||
protected fun updateWith(source: GroupVersioned<GroupId, EntryId, Group, Entry>,
|
||||
updateParents: Boolean = true) {
|
||||
protected fun updateWith(
|
||||
source: GroupVersioned<GroupId, EntryId, Group, Entry>,
|
||||
updateParents: Boolean = true
|
||||
) {
|
||||
super.updateWith(source, updateParents)
|
||||
titleGroup = source.titleGroup
|
||||
if (updateParents) {
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ import com.kunzisoft.keepass.database.element.CustomData
|
||||
import com.kunzisoft.keepass.database.element.DateInstant
|
||||
import com.kunzisoft.keepass.database.element.Tags
|
||||
import com.kunzisoft.keepass.utils.UnsignedLong
|
||||
import java.util.*
|
||||
import java.util.UUID
|
||||
|
||||
interface NodeKDBXInterface : NodeTimeInterface {
|
||||
|
||||
|
||||
+25
-24
@@ -25,8 +25,7 @@ import com.kunzisoft.keepass.database.element.database.DatabaseVersioned
|
||||
import com.kunzisoft.keepass.database.element.icon.IconImage
|
||||
import com.kunzisoft.keepass.utils.readListCompat
|
||||
import com.kunzisoft.keepass.utils.readParcelableCompat
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
import java.util.UUID
|
||||
|
||||
class Template : Parcelable {
|
||||
|
||||
@@ -36,32 +35,34 @@ class Template : Parcelable {
|
||||
var icon = IconImage()
|
||||
var backgroundColor: Int? = null
|
||||
var foregroundColor: Int? = null
|
||||
var sections: MutableList<TemplateSection> = ArrayList()
|
||||
var sections: MutableList<TemplateSection> = mutableListOf()
|
||||
private set
|
||||
|
||||
constructor(uuid: UUID,
|
||||
title: String,
|
||||
icon: IconImage,
|
||||
section: TemplateSection,
|
||||
version: Int = 1)
|
||||
: this(uuid, title, icon, ArrayList<TemplateSection>().apply {
|
||||
add(section)
|
||||
}, version)
|
||||
constructor(
|
||||
uuid: UUID,
|
||||
title: String,
|
||||
icon: IconImage,
|
||||
section: TemplateSection,
|
||||
version: Int = 1
|
||||
) : this(uuid, title, icon, mutableListOf<TemplateSection>(section), version)
|
||||
|
||||
constructor(uuid: UUID,
|
||||
title: String,
|
||||
icon: IconImage,
|
||||
sections: List<TemplateSection>,
|
||||
version: Int = 1)
|
||||
: this(uuid, title, icon, null, null, sections, version)
|
||||
constructor(
|
||||
uuid: UUID,
|
||||
title: String,
|
||||
icon: IconImage,
|
||||
sections: List<TemplateSection>,
|
||||
version: Int = 1
|
||||
) : this(uuid, title, icon, null, null, sections, version)
|
||||
|
||||
constructor(uuid: UUID,
|
||||
title: String,
|
||||
icon: IconImage,
|
||||
backgroundColor: Int?,
|
||||
foregroundColor: Int?,
|
||||
sections: List<TemplateSection>,
|
||||
version: Int = 1) {
|
||||
constructor(
|
||||
uuid: UUID,
|
||||
title: String,
|
||||
icon: IconImage,
|
||||
backgroundColor: Int?,
|
||||
foregroundColor: Int?,
|
||||
sections: List<TemplateSection>,
|
||||
version: Int = 1
|
||||
) {
|
||||
this.version = version
|
||||
this.uuid = uuid
|
||||
this.title = title
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ package com.kunzisoft.keepass.database.element.template
|
||||
|
||||
import com.kunzisoft.keepass.database.element.icon.IconImage
|
||||
import com.kunzisoft.keepass.database.element.icon.IconImageStandard
|
||||
import java.util.*
|
||||
import java.util.UUID
|
||||
|
||||
class TemplateBuilder {
|
||||
|
||||
|
||||
+22
-4
@@ -25,9 +25,13 @@ import com.kunzisoft.encrypt.StreamCipher
|
||||
import com.kunzisoft.keepass.database.crypto.CipherEngine
|
||||
import com.kunzisoft.keepass.database.crypto.CrsAlgorithm
|
||||
import com.kunzisoft.keepass.database.crypto.HmacBlock
|
||||
import com.kunzisoft.keepass.database.element.*
|
||||
import com.kunzisoft.keepass.database.element.Attachment
|
||||
import com.kunzisoft.keepass.database.element.CustomDataItem
|
||||
import com.kunzisoft.keepass.database.element.DateInstant
|
||||
import com.kunzisoft.keepass.database.element.DateInstant.Companion.fromDotNetSeconds
|
||||
import com.kunzisoft.keepass.database.element.DateInstant.Companion.fromISO8601Format
|
||||
import com.kunzisoft.keepass.database.element.DeletedObject
|
||||
import com.kunzisoft.keepass.database.element.Tags
|
||||
import com.kunzisoft.keepass.database.element.binary.BinaryData
|
||||
import com.kunzisoft.keepass.database.element.binary.BinaryData.Companion.BASE64_FLAG
|
||||
import com.kunzisoft.keepass.database.element.database.CompressionAlgorithm
|
||||
@@ -40,14 +44,26 @@ import com.kunzisoft.keepass.database.element.node.NodeIdUUID
|
||||
import com.kunzisoft.keepass.database.element.node.NodeKDBXInterface
|
||||
import com.kunzisoft.keepass.database.element.security.MemoryProtectionConfig
|
||||
import com.kunzisoft.keepass.database.element.security.ProtectedString
|
||||
import com.kunzisoft.keepass.database.exception.*
|
||||
import com.kunzisoft.keepass.database.exception.CorruptedDatabaseException
|
||||
import com.kunzisoft.keepass.database.exception.DatabaseInputException
|
||||
import com.kunzisoft.keepass.database.exception.InvalidAlgorithmDatabaseException
|
||||
import com.kunzisoft.keepass.database.exception.InvalidCredentialsDatabaseException
|
||||
import com.kunzisoft.keepass.database.exception.KDFMemoryDatabaseException
|
||||
import com.kunzisoft.keepass.database.exception.NoMemoryDatabaseException
|
||||
import com.kunzisoft.keepass.database.exception.XMLMalformedDatabaseException
|
||||
import com.kunzisoft.keepass.database.file.DatabaseHeaderKDBX
|
||||
import com.kunzisoft.keepass.database.file.DatabaseHeaderKDBX.Companion.FILE_VERSION_40
|
||||
import com.kunzisoft.keepass.database.file.DatabaseKDBXXML
|
||||
import com.kunzisoft.keepass.stream.HashedBlockInputStream
|
||||
import com.kunzisoft.keepass.stream.HmacBlockInputStream
|
||||
import com.kunzisoft.keepass.tasks.ProgressTaskUpdater
|
||||
import com.kunzisoft.keepass.utils.*
|
||||
import com.kunzisoft.keepass.utils.UnsignedInt
|
||||
import com.kunzisoft.keepass.utils.UnsignedLong
|
||||
import com.kunzisoft.keepass.utils.bytes16ToUuid
|
||||
import com.kunzisoft.keepass.utils.bytes64ToLong
|
||||
import com.kunzisoft.keepass.utils.readBytes
|
||||
import com.kunzisoft.keepass.utils.readBytes4ToUInt
|
||||
import com.kunzisoft.keepass.utils.readBytesLength
|
||||
import org.xmlpull.v1.XmlPullParser
|
||||
import org.xmlpull.v1.XmlPullParserException
|
||||
import org.xmlpull.v1.XmlPullParserFactory
|
||||
@@ -56,7 +72,9 @@ import java.io.InputStream
|
||||
import java.io.UnsupportedEncodingException
|
||||
import java.nio.charset.Charset
|
||||
import java.text.ParseException
|
||||
import java.util.*
|
||||
import java.util.Arrays
|
||||
import java.util.Stack
|
||||
import java.util.UUID
|
||||
import java.util.zip.GZIPInputStream
|
||||
import javax.crypto.Cipher
|
||||
import javax.crypto.CipherInputStream
|
||||
|
||||
+14
-3
@@ -25,9 +25,14 @@ import android.util.Xml
|
||||
import com.kunzisoft.encrypt.StreamCipher
|
||||
import com.kunzisoft.keepass.database.crypto.CrsAlgorithm
|
||||
import com.kunzisoft.keepass.database.crypto.kdf.KdfFactory
|
||||
import com.kunzisoft.keepass.database.element.*
|
||||
import com.kunzisoft.keepass.database.element.CustomData
|
||||
import com.kunzisoft.keepass.database.element.CustomDataItem
|
||||
import com.kunzisoft.keepass.database.element.DateInstant
|
||||
import com.kunzisoft.keepass.database.element.DateInstant.Companion.toDotNetSeconds
|
||||
import com.kunzisoft.keepass.database.element.DateInstant.Companion.toISO8601Format
|
||||
import com.kunzisoft.keepass.database.element.DeletedObject
|
||||
import com.kunzisoft.keepass.database.element.Field
|
||||
import com.kunzisoft.keepass.database.element.Tags
|
||||
import com.kunzisoft.keepass.database.element.binary.BinaryData.Companion.BASE64_FLAG
|
||||
import com.kunzisoft.keepass.database.element.database.CompressionAlgorithm
|
||||
import com.kunzisoft.keepass.database.element.database.DatabaseKDBX
|
||||
@@ -45,12 +50,18 @@ import com.kunzisoft.keepass.database.file.DatabaseHeaderKDBX.Companion.FILE_VER
|
||||
import com.kunzisoft.keepass.database.file.DatabaseKDBXXML
|
||||
import com.kunzisoft.keepass.stream.HashedBlockOutputStream
|
||||
import com.kunzisoft.keepass.stream.HmacBlockOutputStream
|
||||
import com.kunzisoft.keepass.utils.*
|
||||
import com.kunzisoft.keepass.utils.UnsignedInt
|
||||
import com.kunzisoft.keepass.utils.longTo8Bytes
|
||||
import com.kunzisoft.keepass.utils.readAllBytes
|
||||
import com.kunzisoft.keepass.utils.uuidTo16Bytes
|
||||
import com.kunzisoft.keepass.utils.write4BytesUInt
|
||||
import com.kunzisoft.keepass.utils.writeByte
|
||||
import org.xmlpull.v1.XmlSerializer
|
||||
import java.io.IOException
|
||||
import java.io.OutputStream
|
||||
import java.security.SecureRandom
|
||||
import java.util.*
|
||||
import java.util.Stack
|
||||
import java.util.UUID
|
||||
import java.util.zip.GZIPOutputStream
|
||||
import javax.crypto.Cipher
|
||||
import javax.crypto.CipherOutputStream
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.kunzisoft.keepass.database.element.Tags
|
||||
import com.kunzisoft.keepass.database.element.icon.IconImageStandard
|
||||
import com.kunzisoft.keepass.database.element.icon.IconImageStandard.Companion.FOLDER_ID
|
||||
import com.kunzisoft.keepass.utils.readParcelableCompat
|
||||
import java.util.*
|
||||
import java.util.UUID
|
||||
|
||||
class GroupInfo : NodeInfo {
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ object PasskeyEntryFields {
|
||||
* Remove parameters fields use to generate auto fields
|
||||
*/
|
||||
fun generateAutoFields(fieldsToParse: List<Field>): MutableList<Field> {
|
||||
val newCustomFields: MutableList<Field> = ArrayList(fieldsToParse)
|
||||
val newCustomFields: MutableList<Field> = fieldsToParse.toMutableList()
|
||||
// Remove parameter fields
|
||||
val usernameField = Field(FIELD_USERNAME)
|
||||
val privateKeyField = Field(FIELD_PRIVATE_KEY)
|
||||
|
||||
@@ -448,7 +448,7 @@ object OtpEntryFields {
|
||||
if (username.isEmpty())
|
||||
username = otpElement.name
|
||||
// Add OTP field
|
||||
val mutableCustomFields = customFields as ArrayList<Field>
|
||||
val mutableCustomFields = customFields
|
||||
val otpField = buildOtpField(otpElement, null, null)
|
||||
if (mutableCustomFields.contains(otpField)) {
|
||||
mutableCustomFields.remove(otpField)
|
||||
@@ -464,7 +464,7 @@ object OtpEntryFields {
|
||||
* Remove parameters fields use to generate auto fields
|
||||
*/
|
||||
fun generateAutoFields(fieldsToParse: List<Field>): MutableList<Field> {
|
||||
val newCustomFields: MutableList<Field> = ArrayList(fieldsToParse)
|
||||
val newCustomFields: MutableList<Field> = fieldsToParse.toMutableList()
|
||||
// Remove parameter fields
|
||||
val otpField = Field(OTP_FIELD)
|
||||
val totpSeedField = Field(TOTP_SEED_FIELD)
|
||||
|
||||
@@ -19,14 +19,14 @@
|
||||
*/
|
||||
package com.kunzisoft.keepass.stream
|
||||
|
||||
import com.kunzisoft.keepass.database.crypto.HmacBlock
|
||||
import com.kunzisoft.keepass.utils.UnsignedLong
|
||||
import com.kunzisoft.keepass.utils.bytes4ToUInt
|
||||
import com.kunzisoft.keepass.utils.readBytesLength
|
||||
import com.kunzisoft.keepass.utils.uLongTo8Bytes
|
||||
import com.kunzisoft.keepass.database.crypto.HmacBlock
|
||||
import java.io.IOException
|
||||
import java.io.InputStream
|
||||
import java.util.*
|
||||
import java.util.Arrays
|
||||
import javax.crypto.Mac
|
||||
|
||||
class HmacBlockInputStream(private val baseStream: InputStream, private val verify: Boolean, private val key: ByteArray) : InputStream() {
|
||||
|
||||
@@ -27,7 +27,7 @@ import java.io.InputStream
|
||||
import java.io.OutputStream
|
||||
import java.nio.ByteBuffer
|
||||
import java.nio.charset.Charset
|
||||
import java.util.*
|
||||
import java.util.UUID
|
||||
|
||||
/**
|
||||
* Read all data of stream and invoke [readBytes] each time the buffer is full or no more data to read.
|
||||
@@ -319,7 +319,7 @@ 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 SEP = System.lineSeparator()
|
||||
private val REPLACE = SEP != CRLF
|
||||
|
||||
fun bytesToString(buf: ByteArray, replaceCRLF: Boolean = true): String {
|
||||
@@ -331,7 +331,7 @@ fun bytesToString(buf: ByteArray, replaceCRLF: Boolean = true): String {
|
||||
// Get string
|
||||
var jstring = String(buf, 0, len, defaultCharset)
|
||||
if (replaceCRLF && REPLACE) {
|
||||
jstring = jstring.replace(CRLF, SEP!!)
|
||||
jstring = jstring.replace(CRLF, SEP)
|
||||
}
|
||||
return jstring
|
||||
}
|
||||
@@ -393,7 +393,7 @@ fun writeStringToStream(outputStream: OutputStream, string: String?): Int {
|
||||
}
|
||||
|
||||
if (REPLACE) {
|
||||
str = str.replace(SEP!!, CRLF)
|
||||
str = str.replace(SEP, CRLF)
|
||||
}
|
||||
|
||||
val initial = str.toByteArray(defaultCharset)
|
||||
|
||||
@@ -29,10 +29,15 @@ import android.content.pm.ResolveInfo
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.util.Log
|
||||
import java.io.*
|
||||
import java.io.File
|
||||
import java.io.FileInputStream
|
||||
import java.io.FileNotFoundException
|
||||
import java.io.FileOutputStream
|
||||
import java.io.InputStream
|
||||
import java.io.OutputStream
|
||||
import java.net.MalformedURLException
|
||||
import java.net.URL
|
||||
import java.util.*
|
||||
import java.util.Locale
|
||||
|
||||
fun String.parseUri(): Uri? {
|
||||
return if (this.isNotEmpty()) Uri.parse(this) else null
|
||||
|
||||
Reference in new issue
Block a user