diff --git a/examples/provisioning/wifi_prov_mgr/README.md b/examples/provisioning/wifi_prov_mgr/README.md index a9ed7a8a42..680b5442fa 100644 --- a/examples/provisioning/wifi_prov_mgr/README.md +++ b/examples/provisioning/wifi_prov_mgr/README.md @@ -79,10 +79,10 @@ I (1045) wifi_prov_mgr: Provisioning started with service name : PROV_261FCC Make sure to note down the BLE device name (starting with `PROV_`) displayed in the serial monitor log (eg. PROV_261FCC). This will depend on the MAC ID and will be unique for every device. -In a separate terminal run the `esp_prov.py` script under `$IDP_PATH/tools/esp_prov` directory (make sure to replace `myssid` and `mypassword` with the credentials of the AP to which the device is supposed to connect to after provisioning). Assuming default example configuration, which uses protocomm security scheme 1 and proof of possession PoP based authentication : +In a separate terminal run the `esp_prov.py` script under `$IDP_PATH/tools/esp_prov` directory (make sure to replace `myssid` and `mypassword` with the credentials of the AP to which the device is supposed to connect to after provisioning). Assuming default example configuration, which uses the protocomm security scheme 2 (based on Secure Remote Password protocol (SRP6a)) : ``` -python esp_prov.py --transport ble --service_name PROV_261FCC --sec_ver 1 --pop abcd1234 --ssid myssid --passphrase mypassword +python esp_prov.py --verbose --transport ble --service_name PROV_4C33E8 --sec_ver 2 --sec2_username testuser --sec2_pwd testpassword --ssid myssid --passphrase mypassword ``` Above command will perform the provisioning steps, and the monitor log should display something like this : @@ -114,6 +114,26 @@ I (54355) app: Hello World! I (55355) app: Hello World! ``` +**Note:** For generating the credentials for security version 2 (`SRP6a` salt and verifier) for the device-side, the following example command can be used. The output can then directly be used in this example. + +The config option `CONFIG_EXAMPLE_PROV_SEC2_USERNAME` should be set to the same username used in the salt-verifier generation. + +```log +$ python esp_prov.py --verbose --transport softap --sec_ver 2 --sec2_gen_cred --sec2_username testuser --sec2_pwd testpassword +==== Salt-verifier for security scheme 2 (SRP6a) ==== +static const char sec2_salt[] = { + 0x14, 0xdf, 0x42, 0x50, 0x3d, 0xec, 0x54, 0xc3, 0xe5, 0x0e, 0x0c, 0x9d, 0xb4, 0x84, 0xd7, 0xe4 +}; + +static const char sec2_verifier[] = { + 0xd7, 0xc2, 0xdb, 0x68, 0x3b, 0x98, 0xf0, 0xbf, 0x4f, 0x02, 0x21, 0xf6, 0x07, 0xe6, 0xfc, 0x0d, + ... + ... + 0x86, 0xf2, 0x78, 0xba, 0x1e, 0x12, 0xa9, 0x62, 0x9a, 0x47, 0x1b, 0x69, 0x42, 0xba, 0x37, 0xe2 +}; + +``` + ### QR Code Scanning Enabling `CONFIG_EXAMPLE_PROV_SHOW_QR` will display a QR code on the serial terminal, which can be scanned from the ESP Provisioning phone apps to start the Wi-Fi provisioning process. diff --git a/examples/provisioning/wifi_prov_mgr/main/app_main.c b/examples/provisioning/wifi_prov_mgr/main/app_main.c index cc0cdde1a7..0ad285af81 100644 --- a/examples/provisioning/wifi_prov_mgr/main/app_main.c +++ b/examples/provisioning/wifi_prov_mgr/main/app_main.c @@ -32,32 +32,33 @@ static const char *TAG = "app"; -static const char sec2_salt[4] = {0xc1, 0x85, 0x74, 0xfe}; +static const char sec2_salt[] = {0x75, 0x45, 0x54, 0xac}; + +static const char sec2_verifier[] = {0xf4, 0x3c, 0x43, 0x37, 0x1c, 0xf8, 0x69, 0x39, 0x40, 0x65, 0xd1, 0xdb, 0xb5, 0x2f, 0x5f, 0xd5, + 0xce, 0x3b, 0x2d, 0x95, 0xe9, 0x03, 0x4b, 0xfd, 0x84, 0x08, 0x5a, 0xf8, 0x9a, 0x29, 0x55, 0xe1, + 0xb9, 0x11, 0x8e, 0x91, 0xa0, 0xfa, 0x0f, 0x6a, 0x64, 0x24, 0x3c, 0xa6, 0xe8, 0x88, 0x36, 0x39, + 0xe1, 0x9a, 0x90, 0xb0, 0xd1, 0x2f, 0x8e, 0x19, 0x5e, 0xd6, 0xc6, 0xe7, 0xb6, 0x29, 0xfc, 0x5f, + 0x44, 0xc0, 0xcb, 0xba, 0x36, 0x9a, 0x4b, 0x8e, 0xcd, 0xa0, 0xf2, 0x10, 0xe8, 0x92, 0x78, 0xb6, + 0x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 0xab, 0x36, 0x5a, 0x7b, 0x67, 0x1c, 0x26, 0xd6, 0x03, 0x25, + 0x37, 0x7a, 0x41, 0xbd, 0x6e, 0x3c, 0x5f, 0x74, 0x74, 0x38, 0x5b, 0x7b, 0x75, 0x5e, 0x2f, 0xe0, + 0xb9, 0xd0, 0x99, 0x88, 0x02, 0x6c, 0xe7, 0x3f, 0x8a, 0x62, 0xb3, 0x54, 0x06, 0xe5, 0x84, 0xff, + 0xc5, 0x68, 0x20, 0x55, 0x80, 0x9e, 0x7f, 0x0f, 0xd5, 0x3d, 0xe2, 0xd3, 0x57, 0xee, 0x36, 0x7e, + 0xe8, 0x78, 0x05, 0x5a, 0xf5, 0xc2, 0x92, 0x6e, 0xac, 0x13, 0x3f, 0x27, 0x11, 0x54, 0x74, 0xd2, + 0x56, 0x1d, 0xac, 0x6f, 0x36, 0xbb, 0xaa, 0x9d, 0x4e, 0x7a, 0x61, 0x53, 0x47, 0x79, 0xcb, 0xb8, + 0x76, 0x99, 0x0f, 0x80, 0xc2, 0x62, 0x95, 0x5f, 0x7d, 0x85, 0xfe, 0xd8, 0xd9, 0x0d, 0x05, 0xee, + 0x78, 0xa1, 0x18, 0xa5, 0x71, 0x84, 0x6a, 0x2c, 0xc7, 0x05, 0xf1, 0x1a, 0x31, 0x31, 0xc3, 0x1d}; -static const char sec2_verifier[384] = {0x88, 0x98, 0x2a, 0xd3, 0xb1, 0x8a, 0xf6, 0xe3, 0x00, 0x5d, 0x34, 0x63, 0x56, 0x73, 0x2a, 0x03, - 0x7b, 0x1c, 0xae, 0xe8, 0x2e, 0x59, 0x03, 0x48, 0x68, 0x00, 0xba, 0xa1, 0xb0, 0xff, 0x12, 0xca, - 0xa7, 0xc9, 0xff, 0x69, 0xaf, 0x7a, 0x1e, 0x53, 0x98, 0x15, 0x79, 0xd1, 0x11, 0x83, 0x68, 0xf2, - 0x8c, 0x7a, 0xcf, 0x8b, 0x1b, 0x25, 0x2e, 0x0c, 0xcb, 0xdc, 0x6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, 0xe2, 0x81, 0x7e, 0x5e, 0x99, 0x15, 0x2a, 0xd7, 0x73, 0xbf, 0x0a, 0x00, 0xe8, 0xea, 0x3c, - 0xbe, 0xb7, 0x70, 0xb3, 0x63, 0xa2, 0x5c, 0xff, 0x37, 0xbd, 0x40, 0x9a, 0xa9, 0x6c, 0xde, 0x1e, - 0xc0, 0x73, 0xd3, 0x00, 0x00, 0x89, 0x78, 0x16, 0x3b, 0x86, 0x36, 0x99, 0x36, 0xa9, 0x7c, 0x92, - 0xa2, 0xea, 0x92, 0x37, 0x1f, 0x13, 0xd4, 0x1a, 0x88, 0x3d, 0x2b, 0x49, 0xb1, 0x27, 0xb6, 0x8c, - 0xa5, 0x54, 0xf7, 0xba, 0x1b, 0x3e, 0x13, 0xe4, 0x52, 0xfc, 0xa2, 0x92, 0xa1, 0x77, 0x21, 0x02, - 0x16, 0xd9, 0xd1, 0x52, 0xb5, 0x2a, 0x6a, 0xc7, 0xe6, 0x2d, 0x1c, 0x26, 0x33, 0x89, 0x28, 0x36, - 0xeb, 0xcb, 0x4b, 0x19, 0x77, 0x6a, 0xe7, 0x2e, 0x1a, 0x53, 0x3e, 0xe1, 0xf4, 0x12, 0x94, 0x2a, - 0x90, 0xca, 0x47, 0x65, 0xdc, 0xca, 0xc5, 0x5c, 0xb3, 0xea, 0x70, 0xf9, 0xf0, 0xe1, 0x17, 0xc3, - 0xfb, 0x9d, 0xbd, 0xf6, 0x27, 0x3d, 0xa9, 0xd0, 0x4c, 0xb7, 0x6f, 0xe6, 0x21, 0x25, 0x0f, 0x29}; /* Signal Wi-Fi events on this event-group */ const int WIFI_CONNECTED_EVENT = BIT0; diff --git a/examples/provisioning/wifi_prov_mgr/sdkconfig.defaults b/examples/provisioning/wifi_prov_mgr/sdkconfig.defaults index c3c976440b..9125e679d1 100644 --- a/examples/provisioning/wifi_prov_mgr/sdkconfig.defaults +++ b/examples/provisioning/wifi_prov_mgr/sdkconfig.defaults @@ -9,7 +9,3 @@ CONFIG_BT_NIMBLE_ENABLED=y CONFIG_PARTITION_TABLE_CUSTOM=y CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" CONFIG_PARTITION_TABLE_FILENAME="partitions.csv" - -CONFIG_EXAMPLE_RESET_PROVISIONED=y -CONFIG_WIFI_PROV_BLE_FORCE_ENCRYPTION=n -CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y