mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-28 04:46:51 +01:00
Huami/Xiaomi: Log session keys
It's otherwise impossible to troubleshoot issues from the logs, since the communication is encrypted.
This commit is contained in:
parent
b242ad1ec5
commit
29f57758fa
@ -159,9 +159,7 @@ public class InitOperation2021 extends InitOperation implements Huami2021Handler
|
||||
finalSharedSessionAES[i] = (byte) (sharedEC[i + 8] ^ secretKey[i]);
|
||||
}
|
||||
|
||||
if (BuildConfig.DEBUG) {
|
||||
LOG.debug("Shared Session Key: {}", GB.hexdump(finalSharedSessionAES));
|
||||
}
|
||||
huami2021ChunkedEncoder.setEncryptionParameters(encryptedSequenceNumber, finalSharedSessionAES);
|
||||
huami2021ChunkedDecoder.setEncryptionParameters(finalSharedSessionAES);
|
||||
|
||||
|
@ -195,12 +195,10 @@ public class XiaomiAuthService extends AbstractXiaomiService {
|
||||
System.arraycopy(step2hmac, 32, decryptionNonce, 0, 4);
|
||||
System.arraycopy(step2hmac, 36, encryptionNonce, 0, 4);
|
||||
|
||||
if (BuildConfig.DEBUG) {
|
||||
LOG.debug("decryptionKey: {}", GB.hexdump(decryptionKey));
|
||||
LOG.debug("encryptionKey: {}", GB.hexdump(encryptionKey));
|
||||
LOG.debug("decryptionNonce: {}", GB.hexdump(decryptionNonce));
|
||||
LOG.debug("encryptionNonce: {}", GB.hexdump(encryptionNonce));
|
||||
}
|
||||
|
||||
final byte[] decryptionConfirmation = hmacSHA256(decryptionKey, ArrayUtils.addAll(watchNonce.getNonce().toByteArray(), nonce));
|
||||
if (!Arrays.equals(decryptionConfirmation, watchNonce.getHmac().toByteArray())) {
|
||||
|
Loading…
Reference in New Issue
Block a user