Remove HMAC key logging from logcat
Replace full key values in Log.d() calls with length-only metadata to prevent key material leakage via logcat access. Reviewed in codereview.md (recommendation #1).
This commit is contained in:
parent
81abf2d824
commit
eb337d2157
2 changed files with 393 additions and 2 deletions
|
|
@ -213,7 +213,7 @@ class UsbKeyReceiver : BroadcastReceiver() {
|
|||
val upperKey = hexKey.uppercase()
|
||||
val prefs = context.getSharedPreferences(SettingsActivity.PREFS_NAME, Context.MODE_PRIVATE)
|
||||
prefs.edit().putString(SettingsActivity.PREF_KEY, upperKey).apply()
|
||||
Log.d(TAG, "HMAC key saved: $upperKey")
|
||||
Log.d(TAG, "HMAC key saved (${upperKey.length} chars)")
|
||||
handler.post {
|
||||
Toast.makeText(context, "Beveiligingssleutel gelezen", Toast.LENGTH_LONG).show()
|
||||
}
|
||||
|
|
@ -226,7 +226,7 @@ class UsbKeyReceiver : BroadcastReceiver() {
|
|||
} else if (noKey) {
|
||||
Log.d(TAG, "ESP has no key — generating and provisioning")
|
||||
val newKey = generateRandomHexKey()
|
||||
Log.d(TAG, "Generated key: $newKey")
|
||||
Log.d(TAG, "Generated key (${newKey.length} chars)")
|
||||
|
||||
val setKeyCmd = "SET_KEY:$newKey\n".toByteArray(StandardCharsets.US_ASCII)
|
||||
val written = connection.bulkTransfer(epOut, setKeyCmd, setKeyCmd.size, 1000)
|
||||
|
|
|
|||
Loading…
Reference in a new issue