mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Try to fix decodeHex method conflict in some devices
This commit is contained in:
@@ -451,7 +451,7 @@ class DatabaseKDBX : DatabaseVersioned<UUID, UUID, GroupKDBX, EntryKDBX> {
|
||||
return if (hashString != null
|
||||
&& checkKeyFileHash(dataString, hashString)) {
|
||||
Log.i(TAG, "Successful key file hash check.")
|
||||
Hex.decodeHex(dataString)
|
||||
Hex.decodeHex(dataString.toCharArray())
|
||||
} else {
|
||||
Log.e(TAG, "Unable to check the hash of the key file.")
|
||||
null
|
||||
@@ -477,7 +477,7 @@ class DatabaseKDBX : DatabaseVersioned<UUID, UUID, GroupKDBX, EntryKDBX> {
|
||||
digest = MessageDigest.getInstance("SHA-256")
|
||||
digest?.reset()
|
||||
// hexadecimal encoding of the first 4 bytes of the SHA-256 hash of the key.
|
||||
val dataDigest = digest.digest(Hex.decodeHex(data))
|
||||
val dataDigest = digest.digest(Hex.decodeHex(data.toCharArray()))
|
||||
.copyOfRange(0, 4)
|
||||
.toHexString()
|
||||
success = dataDigest == hash
|
||||
|
||||
@@ -140,7 +140,7 @@ abstract class DatabaseVersioned<
|
||||
when (keyData.size) {
|
||||
32 -> return keyData
|
||||
64 -> try {
|
||||
return Hex.decodeHex(String(keyData))
|
||||
return Hex.decodeHex(String(keyData).toCharArray())
|
||||
} catch (ignoredException: Exception) {
|
||||
// Key is not base 64, treat it as binary data
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ data class OtpElement(var otpModel: OtpModel = OtpModel()) {
|
||||
@Throws(IllegalArgumentException::class)
|
||||
fun setHexSecret(secret: String) {
|
||||
if (secret.isNotEmpty())
|
||||
otpModel.secret = Hex.decodeHex(secret)
|
||||
otpModel.secret = Hex.decodeHex(secret.toCharArray())
|
||||
else
|
||||
throw IllegalArgumentException()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user