Renamed encryptedDefaultPassword to defaultPassword
This commit is contained in:
parent
dde2ff47a4
commit
2f709ed0b6
|
@ -102,7 +102,7 @@ open class AuthenticationService(
|
||||||
val cipher = cryptographyManager.getInitializedCipherForDecryption(EncryptionKeyName, iv)
|
val cipher = cryptographyManager.getInitializedCipherForDecryption(EncryptionKeyName, iv)
|
||||||
biometricAuthenticationService.authenticate(cipher) { authenticationResult ->
|
biometricAuthenticationService.authenticate(cipher) { authenticationResult ->
|
||||||
if (authenticationResult.successful) {
|
if (authenticationResult.successful) {
|
||||||
settings.encryptedDefaultPassword?.let {
|
settings.defaultPassword?.let {
|
||||||
val encryptedUserPassword = decodeFromBase64(it)
|
val encryptedUserPassword = decodeFromBase64(it)
|
||||||
val decrypted = cryptographyManager.decryptData(encryptedUserPassword, cipher)
|
val decrypted = cryptographyManager.decryptData(encryptedUserPassword, cipher)
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ open class AuthenticationService(
|
||||||
|
|
||||||
protected open fun openDatabase(settings: AuthenticationSettings) {
|
protected open fun openDatabase(settings: AuthenticationSettings) {
|
||||||
if (settings.type == AuthenticationType.None) {
|
if (settings.type == AuthenticationType.None) {
|
||||||
settings.encryptedDefaultPassword?.let { encryptedPassword ->
|
settings.defaultPassword?.let { encryptedPassword ->
|
||||||
settings.initializationVector?.let { iv ->
|
settings.initializationVector?.let { iv ->
|
||||||
settings.salt?.let { salt ->
|
settings.salt?.let { salt ->
|
||||||
val decrypted = cryptographyManager.decryptDataWithPbe(decodeFromBase64(encryptedPassword), DefaultPasswordEncryptionKey,
|
val decrypted = cryptographyManager.decryptDataWithPbe(decodeFromBase64(encryptedPassword), DefaultPasswordEncryptionKey,
|
||||||
|
@ -161,14 +161,14 @@ open class AuthenticationService(
|
||||||
if (type == AuthenticationType.Biometric) {
|
if (type == AuthenticationType.Biometric) {
|
||||||
encryptionCipherForBiometric?.let { encryptionCipher ->
|
encryptionCipherForBiometric?.let { encryptionCipher ->
|
||||||
val encryptedPassword = cryptographyManager.encryptData(newPassword, encryptionCipher)
|
val encryptedPassword = cryptographyManager.encryptData(newPassword, encryptionCipher)
|
||||||
settings.encryptedDefaultPassword = encodeToBase64(encryptedPassword)
|
settings.defaultPassword = encodeToBase64(encryptedPassword)
|
||||||
settings.initializationVector = encodeToBase64(encryptionCipher.iv)
|
settings.initializationVector = encodeToBase64(encryptionCipher.iv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (type == AuthenticationType.None) {
|
else if (type == AuthenticationType.None) {
|
||||||
val salt = cryptographyManager.generateRandomBytes(8)
|
val salt = cryptographyManager.generateRandomBytes(8)
|
||||||
val (encryptedPassword, iv) = cryptographyManager.encryptDataWithPbe(newPassword, DefaultPasswordEncryptionKey, salt)
|
val (encryptedPassword, iv) = cryptographyManager.encryptDataWithPbe(newPassword, DefaultPasswordEncryptionKey, salt)
|
||||||
settings.encryptedDefaultPassword = encodeToBase64(encryptedPassword)
|
settings.defaultPassword = encodeToBase64(encryptedPassword)
|
||||||
settings.initializationVector = encodeToBase64(iv)
|
settings.initializationVector = encodeToBase64(iv)
|
||||||
settings.salt = encodeToBase64(salt)
|
settings.salt = encodeToBase64(salt)
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ package net.dankito.banking.ui.android.authentication
|
||||||
open class AuthenticationSettings(
|
open class AuthenticationSettings(
|
||||||
open var type: AuthenticationType,
|
open var type: AuthenticationType,
|
||||||
open var hashedUserPassword: String? = null,
|
open var hashedUserPassword: String? = null,
|
||||||
open var encryptedDefaultPassword: String? = null,
|
open var defaultPassword: String? = null,
|
||||||
open var initializationVector: String? = null,
|
open var initializationVector: String? = null,
|
||||||
open var salt: String? = null
|
open var salt: String? = null
|
||||||
) {
|
) {
|
||||||
|
|
Loading…
Reference in New Issue