format. do not log keys

This commit is contained in:
Andrei Vereha 2021-11-28 15:58:56 +01:00
parent 7374ff2eb1
commit 4aa67dedb5
4 changed files with 85 additions and 82 deletions

View file

@ -80,13 +80,11 @@ class KeyExchange(
pdmNonce +
podNonce
aesCmac(confKey, pdmConfData, pdmConf)
aapsLogger.debug(LTag.PUMPBTCOMM, "pdmConf: ${pdmConf.toHex()}")
val podConfData = POD_CONF_MAGIC_PREFIX +
podNonce +
pdmNonce
aesCmac(confKey, podConfData, podConf)
aapsLogger.debug(LTag.PUMPBTCOMM, "podConf: ${podConf.toHex()}")
if (BuildConfig.DEBUG) {
aapsLogger.debug(LTag.PUMPBTCOMM, "pdmPrivate: ${pdmPrivate.toHex()}")
@ -94,6 +92,8 @@ class KeyExchange(
aapsLogger.debug(LTag.PUMPBTCOMM, "podPublic: ${podPublic.toHex()}")
aapsLogger.debug(LTag.PUMPBTCOMM, "pdmNonce: ${pdmNonce.toHex()}")
aapsLogger.debug(LTag.PUMPBTCOMM, "podNonce: ${podNonce.toHex()}")
aapsLogger.debug(LTag.PUMPBTCOMM, "podConf: ${podConf.toHex()}")
aapsLogger.debug(LTag.PUMPBTCOMM, "pdmConf: ${pdmConf.toHex()}")
aapsLogger.debug(LTag.PUMPBTCOMM, "LTK, donna key: ${curveLTK.toHex()}")
aapsLogger.debug(LTag.PUMPBTCOMM, "Intermediate key: ${intermediateKey.toHex()}")

View file

@ -3,6 +3,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.session
import info.nightscout.androidaps.extensions.toHex
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.omnipod.dash.BuildConfig
import org.spongycastle.util.encoders.Hex
import java.security.SecureRandom
import javax.crypto.Cipher
@ -102,6 +103,7 @@ class Milenage(
val receivedMacS = auts.copyOfRange(6, 14)
init {
if (BuildConfig.DEBUG) {
aapsLogger.debug(LTag.PUMPBTCOMM, "Milenage K: ${k.toHex()}")
aapsLogger.debug(LTag.PUMPBTCOMM, "Milenage RAND: ${rand.toHex()}")
aapsLogger.debug(LTag.PUMPBTCOMM, "Milenage SQN: ${sqn.toHex()}")
@ -118,6 +120,7 @@ class Milenage(
aapsLogger.debug(LTag.PUMPBTCOMM, "Milenage synchronizationSqn: ${synchronizationSqn.toHex()}")
aapsLogger.debug(LTag.PUMPBTCOMM, "Milenage receivedMacS: ${receivedMacS.toHex()}")
}
}
companion object {

View file

@ -677,7 +677,8 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
private fun store() {
try {
val serialized = Gson().toJson(podState)
val cleanPodState = podState.copy(ltk = byteArrayOf()) // do not log ltk
val serialized = Gson().toJson(cleanPodState)
logger.debug(LTag.PUMP, "Storing Pod state: $serialized")
sharedPreferences.putString(R.string.key_omnipod_dash_pod_state, serialized)
} catch (ex: Exception) {
@ -699,56 +700,55 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
return PodState()
}
class PodState : Serializable {
var activationProgress: ActivationProgress = ActivationProgress.NOT_STARTED
var lastUpdatedSystem: Long = 0
var lastStatusResponseReceived: Long = 0
data class PodState(
var activationProgress: ActivationProgress = ActivationProgress.NOT_STARTED,
var lastUpdatedSystem: Long = 0,
var lastStatusResponseReceived: Long = 0,
var bluetoothConnectionState: OmnipodDashPodStateManager.BluetoothConnectionState =
OmnipodDashPodStateManager.BluetoothConnectionState.DISCONNECTED
var connectionAttempts = 0
var successfulConnections = 0
var successfulConnectionAttemptsAfterRetries = 0
var failedConnectionsAfterRetries = 0
var messageSequenceNumber: Short = 0
var sequenceNumberOfLastProgrammingCommand: Short? = null
var activationTime: Long? = null
var uniqueId: Long? = null
var bluetoothAddress: String? = null
var ltk: ByteArray? = null
var eapAkaSequenceNumber: Long = 1
var timeZone: String? = null // TimeZone ID (e.g. "Europe/Amsterdam")
var timeZoneOffset: Int? = null
var timeZoneUpdated: Long? = null
var alarmSynced: Boolean = false
var suspendAlertsEnabled: Boolean = false
OmnipodDashPodStateManager.BluetoothConnectionState.DISCONNECTED,
var connectionAttempts: Int = 0,
var successfulConnections: Int = 0,
var successfulConnectionAttemptsAfterRetries: Int = 0,
var failedConnectionsAfterRetries: Int = 0,
var messageSequenceNumber: Short = 0,
var sequenceNumberOfLastProgrammingCommand: Short? = null,
var activationTime: Long? = null,
var uniqueId: Long? = null,
var bluetoothAddress: String? = null,
var ltk: ByteArray? = null,
var eapAkaSequenceNumber: Long = 1,
var timeZone: String? = null, // TimeZone ID (e.g. "Europe/Amsterdam")
var timeZoneOffset: Int? = null,
var timeZoneUpdated: Long? = null,
var alarmSynced: Boolean = false,
var suspendAlertsEnabled: Boolean = false,
var bleVersion: SoftwareVersion? = null
var firmwareVersion: SoftwareVersion? = null
var lotNumber: Long? = null
var podSequenceNumber: Long? = null
var pulseRate: Short? = null
var primePulseRate: Short? = null
var podLifeInHours: Short? = null
var firstPrimeBolusVolume: Short? = null
var secondPrimeBolusVolume: Short? = null
var bleVersion: SoftwareVersion? = null,
var firmwareVersion: SoftwareVersion? = null,
var lotNumber: Long? = null,
var podSequenceNumber: Long? = null,
var pulseRate: Short? = null,
var primePulseRate: Short? = null,
var podLifeInHours: Short? = null,
var firstPrimeBolusVolume: Short? = null,
var secondPrimeBolusVolume: Short? = null,
var expirationReminderEnabled: Boolean? = null
var expirationHours: Int? = null
var lowReservoirAlertEnabled: Boolean? = null
var lowReservoirAlertUnits: Int? = null
var expirationReminderEnabled: Boolean? = null,
var expirationHours: Int? = null,
var lowReservoirAlertEnabled: Boolean? = null,
var lowReservoirAlertUnits: Int? = null,
var pulsesDelivered: Short? = null
var pulsesRemaining: Short? = null
var podStatus: PodStatus? = null
var deliveryStatus: DeliveryStatus? = null
var minutesSinceActivation: Short? = null
var activeAlerts: EnumSet<AlertType>? = null
var alarmType: AlarmType? = null
var pulsesDelivered: Short? = null,
var pulsesRemaining: Short? = null,
var podStatus: PodStatus? = null,
var deliveryStatus: DeliveryStatus? = null,
var minutesSinceActivation: Short? = null,
var activeAlerts: EnumSet<AlertType>? = null,
var alarmType: AlarmType? = null,
var basalProgram: BasalProgram? = null
var tempBasal: OmnipodDashPodStateManager.TempBasal? = null
var activeCommand: OmnipodDashPodStateManager.ActiveCommand? = null
var basalProgram: BasalProgram? = null,
var tempBasal: OmnipodDashPodStateManager.TempBasal? = null,
var activeCommand: OmnipodDashPodStateManager.ActiveCommand? = null,
var lastBolus: OmnipodDashPodStateManager.LastBolus? = null
}
) : Serializable
}