digitalbirdo / BT-LinkkeySync

Scripts to synchronize bluetooth link keys from mac OSX to windows
MIT License
113 stars 32 forks source link

How to fix BLE devices #12

Open AuroraWright opened 6 years ago

AuroraWright commented 6 years ago

I just made my BLE MS Designer mouse work on both Windows and macOS. Steps are as follows:

foxevereg commented 5 years ago

Thank you very much for your solution. I've followed your steps but failed. I'm using win10 1809 & macOS 10.14.2 mojave. My BT device is Logitech M585 Bluetooth4.0 BLE which requires CSRK value under win10. Following the steps, after modified Bluetooth.plist and bluetoothd.plist ,reboot . the mouse automaticly link to macOS ,but the EDIV LTK RAND value in bluetoothd.plist changed. It lose connection with win10. Did you encounter with this problem? Any suggestion? Thank u!

AuroraWright commented 5 years ago

No, that never happened to me. I also recently got ahold of a Microsoft Designer Keyboard (which is also BLE) and it works fine on that too. CSRK is useless basically, it's only used during the initial key generation process, no idea why Microsoft keeps it in the registry (if you edit it to all zeros it still works).

foxevereg commented 5 years ago

Thank u so much for ur reply. it seems when macos links to the mouse, it does a pair action, changes the values in bluetoothd.plist.

i've tried to fill the values to win registry but the mouse was still not working. it connected to win, and disconnected after a short while. connet and disconnect.

i'will look for other bluetooth 4.0 mouse to do a test. Maybe it's device variant.

foxevereg commented 5 years ago

No, that never happened to me. I also recently got ahold of a Microsoft Designer Keyboard (which is also BLE) and it works fine on that too. CSRK is useless basically, it's only used during the initial key generation process, no idea why Microsoft keeps it in the registry (if you edit it to all zeros it still works).

I managed to find a Mictosoft Designer mouse and modified the plists, then rebooted. The values changed all the same. How about your macOS version? And how did you modify the plists, PlistEdit Pro or just command line?

image

AuroraWright commented 5 years ago

I first disable bluetooth on macOS before replacing the plists. Then I use the command line (with sudo) to copy the plists somewhere else, make them accessible by myself, and use the XCode built-in plist editor. I then change the permissions back to those of the originals and copy them back, then reboot. I finally re-enable bluetooth. This works on both Sierra and High Sierra. I doubt anything changed on Mojave.

foxevereg commented 5 years ago

Disabling bluetooth is the KEY STEP. Disable bluetooth, then replace the plists, the values will not change.My mouse works fine under both macOS and win10 now. Thank u so much for your detail steps!

foxevereg commented 5 years ago

i've posted the full steps on a hackintosh forum to help more people. Have a look at the acknowledgments list:) image [http://bbs.pcbeta.com/forum.php?mod=viewthread&tid=1800655&page=1#pid48751782]

AuroraWright commented 5 years ago

Thanks for the acknowledgement, I also clarified that Bluetooth should be disabled and then enabled again in the first post

filipnavara commented 5 years ago

Just a heads-up. After upgrading to Windows 10 build 18298 the keys were actually moved somewhere else in the registry. The old values before the update could still be found at "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BTHPORT\Upgrade\BTHPORT\Keys" (note the Upgrade part), but for newly paired devices you are out of luck.

AuroraWright commented 5 years ago

Did you try looking for the new location?

filipnavara commented 5 years ago

I did, there's new "FingerprintString" in the "Devices" key, but I didn't really see an obvious mapping between the two. It's possible they are unrelated.

AuroraWright commented 5 years ago

I'd try looking for the mac addresses of the devices or something like that... if nothing shows up, maybe they're in the filesystem now

filipnavara commented 5 years ago

Turns out I was probably wrong. I re-paired the mouse and re-run regedit under PSExec and there are new values in the Keys... I guess I must have done something wrong the first time.

UPDATE: And it indeed works! Thanks!

foxevereg commented 5 years ago

0x00:System and Device:

win10 1809
macOS 10.14.2 mojave
Logitech M585  Bluetooth4.0  BLE

0x01:Delete paired bluetooth info.(All paired devices will be deleted!!!)

sudo rm  /private/var/root/Library/Preferences/com.apple.bluetoothd.plist
sudo rm /Library/Preferences/com.apple.Bluetooth.plist

0x02:Pair your device under macOS, export pair info. create a new folder and copy plists into this folder. ~/Desktop/mouse/AfterPaired

sudo cp  /private/var/root/Library/Preferences/com.apple.bluetoothd.plist ~/Desktop/mouse/AfterPaired/
sudo cp  /Library/Preferences/com.apple.Bluetooth.plist ~/Desktop/mouse/AfterPaired/

Notice:mac address of the mouse at this time is : reboot to win10,pair the mouse under win10。 use psexec to export the pair info of win10 psexec -s -i \\127.0.0.1 regedit

use psexec to run regedit,export HKEY\_LOCAL\_MACHINE\SYSTEM\CurrentControlSet\Services\BTHPORT\Parameters\Keys\{bluetooth adapter MAC}\{BLE device MAC}to a reg file。

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BTHPORT\Parameters\Keys\48d705c4730a\e082ec5ce5a1]
"LTK"=hex:2c,21,a6,81,62,b3,3f,16,b5,10,ed,ac,5a,12,09,dc
"KeyLength"=dword:00000000
"ERand"=hex(b):95,f8,1f,05,cb,fa,0b,78
"EDIV"=dword:0000043b
"IRK"=hex:76,d9,aa,05,2d,3b,db,e7,40,9d,59,a7,f9,94,f0,72
"Address"=hex(b):a1,e5,5c,ec,82,e0,00,00
"AddressType"=dword:00000001
"CSRK"=hex:27,82,02,83,53,b2,cf,9e,87,c8,48,bb,c4,c5,dc,a9
"OutboundSignCounter"=dword:00000000
"MasterIRKStatus"=dword:00000001
"AuthReq"=dword:0000002d

the mac address of the mouse at this time :(1 more than macOS) reboot to macOS

0x03:use Plist Edit Pro to modify com.apple.bluetoothd.plist reg--->bluetoothd.plist,

value                                     reg                                                   bluetoothd.plist
EDIV:modify                        dword:0000043b                                              <3b04>
IRK:modify                         hex:76,d9,aa,05,2d,3b,db,e7,40,9d,59,a7,f9,94,f0,72         <72f094f9 a7599d40 e7db3b2d 05aad976>
LTK:copy                           hex:2c,21,a6,81,62,b3,3f,16,b5,10,ed,ac,5a,12,09,dc         <2c21a681 62b33f16 b510edac 5a1209dc>
RAND:copy                          hex(b):95,f8,1f,05,cb,fa,0b,78                              <95f81f05 cbfa0b78>                                     
ADDRESS:delete00,00,modify         hex(b):a1,e5,5c,ec,82,e0,00,00                              <e082ec5c e5a1>

Modified:

       "48-d7-05-c4-73-0a" =         {
            "e0-82-ec-5c-e5-a1" =             {
                Address = <e082ec5c e5a1>;
                AddressType = 1;
                EDIV = <3b04>;
                IRK = <72f094f9 a7599d40 e7db3b2d 05aad976>;
                LTK = <2c21a681 62b33f16 b510edac 5a1209dc>;
                LTKLength = <10>;
                MITMProtection = 0;
                OriginalAddressType = 1;
                RAND = <95f81f05 cbfa0b78>;

Save。

0x04:modify ~/Desktop/mouse/AfterPaired/com.apple.bluetoothd.plist using Plist Edit Pro modify mac address from e082ec5c e5a0 to new e082ec5c e5a1,保存。

0x05:replace system file

TURN OFF bluetooth!! TURN OFF bluetooth!! TURN OFF bluetooth!!

make sure the privilidge is 600,owner is root:wheel。 MBP:AfterPaired user$ ls -al ~/Desktop/mouse/AfterPaired

sudo cp  ~/Desktop/mouse/AfterPaired/com.apple.bluetoothd.plist  /private/var/root/Library/Preferences/com.apple.bluetoothd.plist
sudo cp  ~/Desktop/mouse/AfterPaired/com.apple.Bluetooth.plist  /Library/Preferences/com.apple.Bluetooth.plist

make sure the content of the file is correct

sudo defaults read /private/var/root/Library/Preferences/com.apple.bluetoothd.plist
sudo defaults read /Library/Preferences/com.apple.Bluetooth.plist

0x06:reboot to win10 and mac seperetely,check whether the mouse is connected。

AuroraWright commented 5 years ago

@foxevereg You don't need to endian-swap the IRK as far as I know. Both my Designer mouse and my Designer keyboard work without swapping it (and I think it doesn't make sense that Apple would have IRK and LTK with different endianness).

foxevereg commented 5 years ago

@foxevereg You don't need to endian-swap the IRK as far as I know. Both my Designer mouse and my Designer keyboard work without swapping it (and I think it doesn't make sense that Apple would have IRK and LTK with different endianness).

I think it doesn't make sense that Apple would have IRK and LTK with different endianness too. I was also confused with the fact. When I was trying to connect my mouse to both win10 and macOS. It was found that IRK won't change after repairing my mouse. when paired under Win10, the IRK is hex:76,d9,aa,05,2d,3b,db,e7,40,9d,59,a7,f9,94,f0,72(in exported reg file) when paired under macOS, the IRK is <72f094f9 a7599d40 e7db3b2d 05aad976> so, I make endian-swap to IRK.

It seems either endianness will work under macOS?

pwiatrowski commented 5 years ago

it's been a while since the last update to this post but I didn't want to open a new case so let's write here. I followed the procedure described here and successfully dual-paired the Microsoft Mobile Mouse 3600 - thanks for that!

However, I've got a big issue with the Microsoft Modern keyboard - I cannot get it to work :( I tried multiple options but no joy - the problem is that I cannot pair it at all in macos as it requires connecting via USB for the initial pairing in Windows. I did that and tried to transfer the keys and create manual entries in /Library/Preferences/com.apple.Bluetooth.plist but I get nowhere. I feel I'm missing correct settings in DeviceCache section - is that correct assumption?

Does anyone have any ideas what I can try to make it work? I found that someone did exactly that on Linux (https://askubuntu.com/a/1063285) but Linux has a different syntax of the Bluetooth config files (especially the 'Services' section).

Any help is more than welcome!

Cheers!

someperson commented 5 years ago

I have a device that shows up as BLE in macOS, but Classic Bluetooth in Windows. What can I do to make this somehow work? The device is a Bose QuietComfort 35 II, and in Windows, it actually shows up in the pairing list as two devices, one of which is BLE and does absolutely nothing, the other of which is Classic Bluetooth and works. macOS, on the other hand, only seems to want to connect to it using BLE, which works. Is it possible to somehow disable BLE in macOS temporarily so I can get it paired to both systems using the same method?

ruiderson commented 4 years ago

it's been a while since the last update to this post but I didn't want to open a new case so let's write here. I followed the procedure described here and successfully dual-paired the Microsoft Mobile Mouse 3600 - thanks for that!

However, I've got a big issue with the Microsoft Modern keyboard - I cannot get it to work :( I tried multiple options but no joy - the problem is that I cannot pair it at all in macos as it requires connecting via USB for the initial pairing in Windows. I did that and tried to transfer the keys and create manual entries in /Library/Preferences/com.apple.Bluetooth.plist but I get nowhere. I feel I'm missing correct settings in DeviceCache section - is that correct assumption?

Does anyone have any ideas what I can try to make it work? I found that someone did exactly that on Linux (https://askubuntu.com/a/1063285) but Linux has a different syntax of the Bluetooth config files (especially the 'Services' section).

Any help is more than welcome!

Cheers!

Anyone has any tip for the above case? I would love to use my Microsoft Modern Keyboard on macOS without the USB cable, but that seems impossible. =/

Stampoo commented 4 years ago

Howdy, I have Microsoft Modern Mobile Mouse (it's next step evolution Microsoft Designer Mouse), after paring, OS (Windows 10 and Hight Sierra) not created IRK and Address Fields in *.plist and Reg, who fighting with this trouble?

macmeister1967 commented 3 years ago

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BTHPORT\Parameters\Keys\

is EMPTY under Windows 10

borodaxel commented 3 years ago

It is empty after 20H2 upgrade.

roddy20 commented 3 years ago

It is empty after 20H2 upgrade.

it is not empty you have no access rights to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BTHPORT\ make yourself an owner

macmeister1967 commented 3 years ago

@roddy20 , how do I do that exactly?

borodaxel commented 3 years ago

It is empty after 20H2 upgrade.

Sorry. You need to run regedit with pstool (official from MS) to get rights of SYSTEM user. Then you will see contents of BTHPORT section.

macmeister1967 commented 3 years ago

many thanks, I'll give it a try on my desktop PC first :-)

On Sun, 9 May 2021 at 18:29, borodaxel @.***> wrote:

It is empty after 20H2 upgrade.

Sorry. You need to run regedit with pstool (official from MS) to get rights of SYSTEM user. Then you will see contents of BTHPORT section.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/digitalbirdo/BT-LinkkeySync/issues/12#issuecomment-835743633, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGLSXILKHTXCMA7JMCPONWLTMZBXZANCNFSM4FMX5OJA .

macmeister1967 commented 3 years ago

I assume this is with the PsExec.exe ??? with flags?

I'm new to all this, so any help is appreciated.

PS. I am using Logi Pebble mouse, so if it's not compatible - let me know

Oh, also Logi MX Anywhere 2S

Cheers

On Mon, 10 May 2021 at 11:30, Craig Cooper @.***> wrote:

many thanks, I'll give it a try on my desktop PC first :-)

On Sun, 9 May 2021 at 18:29, borodaxel @.***> wrote:

It is empty after 20H2 upgrade.

Sorry. You need to run regedit with pstool (official from MS) to get rights of SYSTEM user. Then you will see contents of BTHPORT section.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/digitalbirdo/BT-LinkkeySync/issues/12#issuecomment-835743633, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGLSXILKHTXCMA7JMCPONWLTMZBXZANCNFSM4FMX5OJA .

roddy20 commented 3 years ago

@roddy20 , how do I do that exactly?

https://www.howtogeek.com/262464/how-to-gain-full-permissions-to-edit-protected-registry-keys/

roddy20 commented 3 years ago

PsExec.exe

PsExec -i RegEdit

macmeister1967 commented 3 years ago

Thanks Roddy, the documentation says it's PsExec -s RegEdit tho ?!

On Mon, 10 May 2021 at 22:10, roddy20 @.***> wrote:

PsExec.exe

PsExec -i RegEdit

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/digitalbirdo/BT-LinkkeySync/issues/12#issuecomment-836619324, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGLSXIOMM5ROOWA6TBIP5RDTM7ELXANCNFSM4FMX5OJA .

roddy20 commented 3 years ago

PsExec

https://docs.microsoft.com/en-us/sysinternals/downloads/psexec

macmeister1967 commented 3 years ago

I already have it - and I'm going to test it out tonight or tomorrow... on both Desktop and Laptop :-)

thx

On Mon, 10 May 2021 at 23:37, roddy20 @.***> wrote:

PsExec

https://docs.microsoft.com/en-us/sysinternals/downloads/psexec

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/digitalbirdo/BT-LinkkeySync/issues/12#issuecomment-836710745, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGLSXIP7SP75CRSNNM2FQXDTM7OS3ANCNFSM4FMX5OJA .

macmeister1967 commented 3 years ago

Haha, I switched to macOS-only, so don't need this anymore, but thanks for all the great advice and help offered.

On Tue, 11 May 2021 at 09:09, Craig Cooper @.***> wrote:

I already have it - and I'm going to test it out tonight or tomorrow... on both Desktop and Laptop :-)

thx

On Mon, 10 May 2021 at 23:37, roddy20 @.***> wrote:

PsExec

https://docs.microsoft.com/en-us/sysinternals/downloads/psexec

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/digitalbirdo/BT-LinkkeySync/issues/12#issuecomment-836710745, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGLSXIP7SP75CRSNNM2FQXDTM7OS3ANCNFSM4FMX5OJA .

dekun-ph commented 3 years ago

try this fork: https://github.com/lietxia/BT-LinkkeySync

it works with mine.

Mahasvan commented 3 years ago

Is this normal that this method doesn't work in Monterey?

/Library/Preferences/com.apple.Bluetooth.plist looks like this (as expected, I suppose) image

However, there is no com.apple.Bluetooth.plist in /private/var/root/Library/Preferences.

mahas@MacBook-Pro ~ % sudo ls /private/var/root/Library/Preferences
.GlobalPreferences.plist
.GlobalPreferences_m.plist
ByHost
applessdstatistics.plist
com.apple.ASPCarryLog.plist
com.apple.AppleMultitouchMouse.plist
com.apple.AppleMultitouchTrackpad.plist
com.apple.BTServer.plist
com.apple.CoreBrightness.plist
com.apple.CoreGraphics.plist
com.apple.CrashReporterSupportHelper.plist
com.apple.GEO.plist
com.apple.MobileAsset.plist
com.apple.MobileSoftwareUpdate.plist
com.apple.ReportCrash.plist
com.apple.UserAccountUpdater.plist
com.apple.WirelessRadioManager.debug.plist
com.apple.airplay.plist
com.apple.awdd.persistent.plist
com.apple.cloudd.plist
com.apple.contextstored.plist
com.apple.corecaptured.plist
com.apple.coreduetd.plist
com.apple.das.fairscheduling.plist
com.apple.driver.AppleBluetoothMultitouch.mouse.plist
com.apple.driver.AppleBluetoothMultitouch.trackpad.plist
com.apple.driver.AppleHIDMouse.plist
com.apple.duetactivityscheduler.plist
com.apple.iCal.plist
com.apple.icloud.findmydeviced.notbackedup.plist
com.apple.icloud.findmydeviced.plist
com.apple.icloud.searchpartyd.plist
com.apple.mediaremote.plist
com.apple.mediaremoted.plist
com.apple.powerd.lowpowermode.state.plist
com.apple.rtcreporting.plist
com.apple.security.ctkd-db.plist
com.apple.smartcharging.topoffprotection.plist
com.apple.symptomsd-diag.plist
com.apple.systempreferences.plist
com.apple.systemstats.microstackshot.plist
com.apple.tailspin.plist
com.apple.uarp.database.plist
com.apple.universalaccess.plist
com.apple.xpc.activity2.plist
com.logitech.LogiOptions-Installer.plist
memoryanalyticsd.plist
sharedfilelistd.plist

com.apple.BTServer.plist looks like this Screen Shot 2021-11-25 at 11 38 21 AM

I am aware the bluetooth stack was rewritten in Monterey, so I am guessing the file which has the necessary keys has changed. Does anyone have any info about this?

whatnameisit commented 2 years ago

/Library/Preferences/com.apple.Bluetooth.plist looks like this (as expected, I suppose)

That's probably a residual file from previous OS. After fresh installing macOS Monterey, I have no such file with multiple BT devices connected. BCM94360NG. The creator of Hackintool has come up with a fix for porting keys of generic(?) BT devices in Monterey: https://github.com/headkaze/Hackintool/commit/6398a4b24ffd693ec4b8cf7c05a882bc1711c758 https://github.com/headkaze/Hackintool/commit/c12446db8b0a5457a9fbf477c006705007a248bb and I have connected Logitech K380 keyboard on both macOS and Windows with a single profile. But as of now, the tool has never supported porting keys of BLE devices, and I have no idea what's going on in the source code. @headkaze, would it be possible for you to give us any information?

benbaker76 commented 2 years ago

@whatnameisit you can view this post on Reddit for manual instructions.

whatnameisit commented 2 years ago

@whatnameisit you can view this post on Reddit for manual instructions.

Thanks, headkaze. I am now able to use BLE devices on macOS and Windows with single profiles! For anyone if they would like to know, I edited four properties:

EDIV:modify IRK:modify LTK:copy RAND:copy

benbaker76 commented 2 years ago

@whatnameisit you can view this post on Reddit for manual instructions.

Thanks, headkaze. I am now able to use BLE devices on macOS and Windows with single profiles! For anyone if they would like to know, I edited four properties:

EDIV:modify IRK:modify LTK:copy RAND:copy

I'd be interested in adding support for these 4 additional attributes to Hackintool. Can you please post the output to the following commands (as well as your final working Windows .reg file).

  1. security find-generic-password -s MobileBluetooth -w
  2. system_profiler SPBluetoothDataType -xml
whatnameisit commented 2 years ago

@headkaze, I don't think the first command would do anything meaningful because BLE devices have their own respective "key" like below: 스크린샷 2021-12-09 오전 10 44 49 I used the above key to extract relevant information. If you still need them, here is the output.

  1. 1.txt
  2. 2.txt

Windows .reg file 8863df8a2d80.zip

I double-clicked the BLE device with familiar "Account"; clicked "Show Password" as stated in the reddit post; 3.txt found four attributes Encrypted Diversifier(EDIV), Long-term Key(LTK), Random Number(RAND), and Remote IRK(IRK); endian swapped EDIV and IRK; copied swapped EDIV, LTK, RAND, and swapped IRK over to Windows; and pasted them in Windows regedit accordingly. IRK was pasted in two respective places which I will show later. IRK once here: 4 and again with other keys marked with blue lines: 5 I noticed the "Account" name in Keychain Access is the same as the "Address" in Windows regedit in red.

benbaker76 commented 2 years ago

Thanks @whatnameisit. I've pretty much got it implemented in Hackintool.

Can you please try the attached version and see if it will generate a matching reg file.

whatnameisit commented 2 years ago

@headkaze Hackintool has managed to generate reg keys for devices other than the very device I'm using right now. Honestly, I have no idea what devices those keys are for because I only have one BLE mouse. Keychain through Apple account copied from previous BLE devices which I don't know of, maybe?

Bluetooth.reg.zip

One other thing I noticed is that the "Account" name of those two is "Public xx:xx:xx:xx:xx:xx" whereas that for the actual device I'm using is "Random xx:xx:xx:xx:xx:xx".

스크린샷 2021-12-09 오후 7 20 19 스크린샷 2021-12-09 오후 7 20 17 스크린샷 2021-12-09 오후 7 20 21

If you know anything about them, I'm pretty sure you will have everything sorted. If you don't, please let me know and I may do a fresh installation of macOS 12 and do the test before logging into Apple ID.

benbaker76 commented 2 years ago

@whatnameisit yes those devices you're seeing are old BT devices you've connected to in the past. You don't need to do a fresh installation you can safely delete them from the keychain.

I have two devices connected and one has a Public and the other has a Random entry. The Public version has no Remote Encryption->Random Number entry whereas Random does.

First issue I'm seeing is the "MasterIRK" value will be overwritten with each device so there must be some other way to deal with this.

Second issue is the file you sent me only has a "Remote Encryption" entry but mine also contain "Local Encryption->Encrypted Diversifier" entries. These could in fact be another layer of encryption. What version of macOS do you have? Mine is macOS Monterey 12.1 Beta (21C5031d)

I've also added the following entries manually although I'm not sure what they mean or what they relate to.

"AddressType"=dword:00000001
"MasterIRKStatus"=dword:00000001
"AuthReq"=dword:0000002d

Please try the attached version and see if you can get two BT devices (preferably with Public and Random entries) working. What happens if you remove the "MasterIRK" entry?

whatnameisit commented 2 years ago

My OS version is 12.0.1(21A559). I only have one Random BLE device, so I can't test with Public BLE device. The newly attached version recognized my Random BLE mouse. It did not reverse the ERand or EDIV though. Hackintool generated: Bluetooth.reg.zip Windows exported: 8863df8a2d80.zip

I deleted "MasterIRK" entry yet the mouse is still working after reboot: bluetooth.zip

benbaker76 commented 2 years ago

I've just done a release of Hackintool with ERand and EDIV reversed and removed "MasterIRK". Can you please give it a try and let me know if it looks correct to you.

whatnameisit commented 2 years ago

Yes, it's working all right! Thank you for your work :)

trintin94 commented 2 years ago

@headkaze, I don't think the first command would do anything meaningful because BLE devices have their own respective "key" like below: 스크린샷 2021-12-09 오전 10 44 49 I used the above key to extract relevant information. If you still need them, here is the output.

  1. 1.txt
  2. 2.txt

Windows .reg file 8863df8a2d80.zip

I double-clicked the BLE device with familiar "Account"; clicked "Show Password" as stated in the reddit post; 3.txt found four attributes Encrypted Diversifier(EDIV), Long-term Key(LTK), Random Number(RAND), and Remote IRK(IRK); endian swapped EDIV and IRK; copied swapped EDIV, LTK, RAND, and swapped IRK over to Windows; and pasted them in Windows regedit accordingly. IRK was pasted in two respective places which I will show later. IRK once here: 4 and again with other keys marked with blue lines: 5 I noticed the "Account" name in Keychain Access is the same as the "Address" in Windows regedit in red.

Sorry if this is a silly question, but how did you convert the format of the values from 3.txt into the correct format for the registry? Following the reddit post I was able to get an output in the same format as yours, but I can't copy paste the values as they aren't hexadecimals Key.txt

benbaker76 commented 2 years ago

Sorry if this is a silly question, but how did you convert the format of the values from 3.txt into the correct format for the registry?

You can use Hackintool to generate the Windows registry file (it's in the Tools tab)

trintin94 commented 2 years ago

Sorry if this is a silly question, but how did you convert the format of the values from 3.txt into the correct format for the registry?

You can use Hackintool to generate the Windows registry file (it's in the Tools tab)

I tried that, but after importing, I found my headphones had started working, but not my mouse, so I tried looking at the generated reg file and comparing addresses there appeared to be no entry for the mouse at all, and so using Keychain Access I noticed that only the headphones had a "MobileBluetooth" entry, while the mouse had an entry similar to above.

Screenshot 2022-03-29 at 21 51 07

Bluetooth.reg.zip

thelittlefox commented 2 years ago

``Monterey has changed bluetooth architecture. Chanzong write a blog of synchronizing bluetooth between Monterey and Windows in Chinese. https://zhuanlan.zhihu.com/p/483454678

headkaze's hackintool can export windows reg files. My mouse works fine both macOS and win11. Export reg file with bluetooth devices disconnected. it's the first choice to sync BLE device between windows and mac.

But keyboard does not work, there is both Local Encryption key and Remote Encryption key in macOS keychain xml. I tried to replace EDVI and ERand in reg file with the value in Local Encryption key. It did not work.

Keyboard still works after deleting Local Encryption keys. It seems Local Encryption does not affect BLE device connection.

20220411update: After replacing all old MAC address with new MAC address in all the keys and values of windows registry。 BLE keyborad gets to work。

截屏2022-04-06 09 49 41 截屏2022-04-06 09 51 57