Skip to content

Commit 0287952

Browse files
committed
Remove redundant qualifier
1 parent cf00bce commit 0287952

3 files changed

Lines changed: 8 additions & 12 deletions

File tree

app/src/main/kotlin/com/darkrockstudios/app/securecamera/security/XorCipher.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ object XorCipher {
99
fun encrypt(plaintext: String, key: String): String {
1010
if (key.isBlank()) error("Key must not be empty!")
1111
val obfuscated = xor(plaintext.toByteArray(StandardCharsets.UTF_8), key)
12-
return String(Base64.Default.encodeToByteArray(obfuscated))
12+
return String(Base64.encodeToByteArray(obfuscated))
1313
}
1414

1515
@OptIn(ExperimentalEncodingApi::class)
1616
fun decrypt(ciphertextB64: String, key: String): String {
1717
if (key.isBlank()) error("Key must not be empty!")
18-
val decoded: ByteArray = Base64.Default.decode(ciphertextB64)
18+
val decoded: ByteArray = Base64.decode(ciphertextB64)
1919
return String(xor(decoded, key), StandardCharsets.UTF_8)
2020
}
2121

app/src/main/kotlin/com/darkrockstudios/app/securecamera/security/schemes/HardwareBackedEncryptionScheme.kt

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@ package com.darkrockstudios.app.securecamera.security.schemes
22

33
import android.content.Context
44
import android.security.keystore.KeyGenParameterSpec
5-
import android.security.keystore.KeyProperties.BLOCK_MODE_GCM
6-
import android.security.keystore.KeyProperties.ENCRYPTION_PADDING_NONE
7-
import android.security.keystore.KeyProperties.KEY_ALGORITHM_AES
8-
import android.security.keystore.KeyProperties.PURPOSE_DECRYPT
9-
import android.security.keystore.KeyProperties.PURPOSE_ENCRYPT
5+
import android.security.keystore.KeyProperties.*
106
import android.security.keystore.StrongBoxUnavailableException
117
import com.darkrockstudios.app.securecamera.preferences.AppSettingsDataSource
128
import com.darkrockstudios.app.securecamera.preferences.HashedPin
@@ -60,10 +56,10 @@ class HardwareBackedEncryptionScheme(
6056

6157
val cipheredDsalt = dSaltFile.readBytes()
6258
val plainDsalt = decryptWithHardwareBackedKey(cipheredDsalt)
63-
val encodedDsalt = Base64.Default.encode(plainDsalt)
59+
val encodedDsalt = Base64.encode(plainDsalt)
6460

6561
val deviceId = deviceInfo.getDeviceIdentifier()
66-
val encodedDeviceId = Base64.Default.encode(deviceId)
62+
val encodedDeviceId = Base64.encode(deviceId)
6763

6864
val dekInput =
6965
plainPin.toByteArray(Charsets.UTF_8) + encodedDsalt.toByteArray(Charsets.UTF_8) + encodedDeviceId.toByteArray(
@@ -134,10 +130,10 @@ class HardwareBackedEncryptionScheme(
134130
SecureRandom.getInstanceStrong().nextBytes(dSalt)
135131

136132
// Derive the key
137-
val encodedDsalt = Base64.Default.encode(dSalt)
133+
val encodedDsalt = Base64.encode(dSalt)
138134

139135
val deviceId = deviceInfo.getDeviceIdentifier()
140-
val encodedDeviceId = Base64.Default.encode(deviceId)
136+
val encodedDeviceId = Base64.encode(deviceId)
141137

142138
val dekInput =
143139
plainPin.toByteArray(Charsets.UTF_8) + encodedDsalt.toByteArray(Charsets.UTF_8) + encodedDeviceId.toByteArray(

app/src/main/kotlin/com/darkrockstudios/app/securecamera/security/schemes/SoftwareEncryptionScheme.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ open class SoftwareEncryptionScheme(
107107
)
108108

109109
val deviceId = deviceInfo.getDeviceIdentifier()
110-
val encodedDeviceId = Base64.Default.encode(deviceId)
110+
val encodedDeviceId = Base64.encode(deviceId)
111111

112112
val dekInput = plainPin.toByteArray(Charsets.UTF_8) + encodedDeviceId.toByteArray(Charsets.UTF_8)
113113

0 commit comments

Comments
 (0)