1*03f9172cSAndroid Build Coastguard Workerhostapd and Wi-Fi Protected Setup (WPS) 2*03f9172cSAndroid Build Coastguard Worker======================================= 3*03f9172cSAndroid Build Coastguard Worker 4*03f9172cSAndroid Build Coastguard WorkerThis document describes how the WPS implementation in hostapd can be 5*03f9172cSAndroid Build Coastguard Workerconfigured and how an external component on an AP (e.g., web UI) is 6*03f9172cSAndroid Build Coastguard Workerused to enable enrollment of client devices. 7*03f9172cSAndroid Build Coastguard Worker 8*03f9172cSAndroid Build Coastguard Worker 9*03f9172cSAndroid Build Coastguard WorkerIntroduction to WPS 10*03f9172cSAndroid Build Coastguard Worker------------------- 11*03f9172cSAndroid Build Coastguard Worker 12*03f9172cSAndroid Build Coastguard WorkerWi-Fi Protected Setup (WPS) is a mechanism for easy configuration of a 13*03f9172cSAndroid Build Coastguard Workerwireless network. It allows automated generation of random keys (WPA 14*03f9172cSAndroid Build Coastguard Workerpassphrase/PSK) and configuration of an access point and client 15*03f9172cSAndroid Build Coastguard Workerdevices. WPS includes number of methods for setting up connections 16*03f9172cSAndroid Build Coastguard Workerwith PIN method and push-button configuration (PBC) being the most 17*03f9172cSAndroid Build Coastguard Workercommonly deployed options. 18*03f9172cSAndroid Build Coastguard Worker 19*03f9172cSAndroid Build Coastguard WorkerWhile WPS can enable more home networks to use encryption in the 20*03f9172cSAndroid Build Coastguard Workerwireless network, it should be noted that the use of the PIN and 21*03f9172cSAndroid Build Coastguard Workerespecially PBC mechanisms for authenticating the initial key setup is 22*03f9172cSAndroid Build Coastguard Workernot very secure. As such, use of WPS may not be suitable for 23*03f9172cSAndroid Build Coastguard Workerenvironments that require secure network access without chance for 24*03f9172cSAndroid Build Coastguard Workerallowing outsiders to gain access during the setup phase. 25*03f9172cSAndroid Build Coastguard Worker 26*03f9172cSAndroid Build Coastguard WorkerWPS uses following terms to describe the entities participating in the 27*03f9172cSAndroid Build Coastguard Workernetwork setup: 28*03f9172cSAndroid Build Coastguard Worker- access point: the WLAN access point 29*03f9172cSAndroid Build Coastguard Worker- Registrar: a device that control a network and can authorize 30*03f9172cSAndroid Build Coastguard Worker addition of new devices); this may be either in the AP ("internal 31*03f9172cSAndroid Build Coastguard Worker Registrar") or in an external device, e.g., a laptop, ("external 32*03f9172cSAndroid Build Coastguard Worker Registrar") 33*03f9172cSAndroid Build Coastguard Worker- Enrollee: a device that is being authorized to use the network 34*03f9172cSAndroid Build Coastguard Worker 35*03f9172cSAndroid Build Coastguard WorkerIt should also be noted that the AP and a client device may change 36*03f9172cSAndroid Build Coastguard Workerroles (i.e., AP acts as an Enrollee and client device as a Registrar) 37*03f9172cSAndroid Build Coastguard Workerwhen WPS is used to configure the access point. 38*03f9172cSAndroid Build Coastguard Worker 39*03f9172cSAndroid Build Coastguard Worker 40*03f9172cSAndroid Build Coastguard WorkerMore information about WPS is available from Wi-Fi Alliance: 41*03f9172cSAndroid Build Coastguard Workerhttp://www.wi-fi.org/wifi-protected-setup 42*03f9172cSAndroid Build Coastguard Worker 43*03f9172cSAndroid Build Coastguard Worker 44*03f9172cSAndroid Build Coastguard Workerhostapd implementation 45*03f9172cSAndroid Build Coastguard Worker---------------------- 46*03f9172cSAndroid Build Coastguard Worker 47*03f9172cSAndroid Build Coastguard Workerhostapd includes an optional WPS component that can be used as an 48*03f9172cSAndroid Build Coastguard Workerinternal WPS Registrar to manage addition of new WPS enabled clients 49*03f9172cSAndroid Build Coastguard Workerto the network. In addition, WPS Enrollee functionality in hostapd can 50*03f9172cSAndroid Build Coastguard Workerbe used to allow external WPS Registrars to configure the access 51*03f9172cSAndroid Build Coastguard Workerpoint, e.g., for initial network setup. In addition, hostapd can proxy a 52*03f9172cSAndroid Build Coastguard WorkerWPS registration between a wireless Enrollee and an external Registrar 53*03f9172cSAndroid Build Coastguard Worker(e.g., Microsoft Vista or Atheros JumpStart) with UPnP. 54*03f9172cSAndroid Build Coastguard Worker 55*03f9172cSAndroid Build Coastguard Worker 56*03f9172cSAndroid Build Coastguard Workerhostapd configuration 57*03f9172cSAndroid Build Coastguard Worker--------------------- 58*03f9172cSAndroid Build Coastguard Worker 59*03f9172cSAndroid Build Coastguard WorkerWPS is an optional component that needs to be enabled in hostapd build 60*03f9172cSAndroid Build Coastguard Workerconfiguration (.config). Here is an example configuration that 61*03f9172cSAndroid Build Coastguard Workerincludes WPS support and uses nl80211 driver interface: 62*03f9172cSAndroid Build Coastguard Worker 63*03f9172cSAndroid Build Coastguard WorkerCONFIG_DRIVER_NL80211=y 64*03f9172cSAndroid Build Coastguard WorkerCONFIG_WPS=y 65*03f9172cSAndroid Build Coastguard WorkerCONFIG_WPS_UPNP=y 66*03f9172cSAndroid Build Coastguard Worker 67*03f9172cSAndroid Build Coastguard WorkerFollowing parameter can be used to enable support for NFC config method: 68*03f9172cSAndroid Build Coastguard Worker 69*03f9172cSAndroid Build Coastguard WorkerCONFIG_WPS_NFC=y 70*03f9172cSAndroid Build Coastguard Worker 71*03f9172cSAndroid Build Coastguard Worker 72*03f9172cSAndroid Build Coastguard WorkerFollowing section shows an example runtime configuration 73*03f9172cSAndroid Build Coastguard Worker(hostapd.conf) that enables WPS: 74*03f9172cSAndroid Build Coastguard Worker 75*03f9172cSAndroid Build Coastguard Worker# Configure the driver and network interface 76*03f9172cSAndroid Build Coastguard Workerdriver=nl80211 77*03f9172cSAndroid Build Coastguard Workerinterface=wlan0 78*03f9172cSAndroid Build Coastguard Worker 79*03f9172cSAndroid Build Coastguard Worker# WPA2-Personal configuration for the AP 80*03f9172cSAndroid Build Coastguard Workerssid=wps-test 81*03f9172cSAndroid Build Coastguard Workerwpa=2 82*03f9172cSAndroid Build Coastguard Workerwpa_key_mgmt=WPA-PSK 83*03f9172cSAndroid Build Coastguard Workerwpa_pairwise=CCMP 84*03f9172cSAndroid Build Coastguard Worker# Default WPA passphrase for legacy (non-WPS) clients 85*03f9172cSAndroid Build Coastguard Workerwpa_passphrase=12345678 86*03f9172cSAndroid Build Coastguard Worker# Enable random per-device PSK generation for WPS clients 87*03f9172cSAndroid Build Coastguard Worker# Please note that the file has to exists for hostapd to start (i.e., create an 88*03f9172cSAndroid Build Coastguard Worker# empty file as a starting point). 89*03f9172cSAndroid Build Coastguard Workerwpa_psk_file=/etc/hostapd.psk 90*03f9172cSAndroid Build Coastguard Worker 91*03f9172cSAndroid Build Coastguard Worker# Enable control interface for PBC/PIN entry 92*03f9172cSAndroid Build Coastguard Workerctrl_interface=/var/run/hostapd 93*03f9172cSAndroid Build Coastguard Worker 94*03f9172cSAndroid Build Coastguard Worker# Enable internal EAP server for EAP-WSC (part of Wi-Fi Protected Setup) 95*03f9172cSAndroid Build Coastguard Workereap_server=1 96*03f9172cSAndroid Build Coastguard Worker 97*03f9172cSAndroid Build Coastguard Worker# WPS configuration (AP configured, do not allow external WPS Registrars) 98*03f9172cSAndroid Build Coastguard Workerwps_state=2 99*03f9172cSAndroid Build Coastguard Workerap_setup_locked=1 100*03f9172cSAndroid Build Coastguard Worker# If UUID is not configured, it will be generated based on local MAC address. 101*03f9172cSAndroid Build Coastguard Workeruuid=87654321-9abc-def0-1234-56789abc0000 102*03f9172cSAndroid Build Coastguard Workerwps_pin_requests=/var/run/hostapd.pin-req 103*03f9172cSAndroid Build Coastguard Workerdevice_name=Wireless AP 104*03f9172cSAndroid Build Coastguard Workermanufacturer=Company 105*03f9172cSAndroid Build Coastguard Workermodel_name=WAP 106*03f9172cSAndroid Build Coastguard Workermodel_number=123 107*03f9172cSAndroid Build Coastguard Workerserial_number=12345 108*03f9172cSAndroid Build Coastguard Workerdevice_type=6-0050F204-1 109*03f9172cSAndroid Build Coastguard Workeros_version=01020300 110*03f9172cSAndroid Build Coastguard Workerconfig_methods=label display push_button keypad 111*03f9172cSAndroid Build Coastguard Worker 112*03f9172cSAndroid Build Coastguard Worker# if external Registrars are allowed, UPnP support could be added: 113*03f9172cSAndroid Build Coastguard Worker#upnp_iface=br0 114*03f9172cSAndroid Build Coastguard Worker#friendly_name=WPS Access Point 115*03f9172cSAndroid Build Coastguard Worker 116*03f9172cSAndroid Build Coastguard Worker 117*03f9172cSAndroid Build Coastguard WorkerExternal operations 118*03f9172cSAndroid Build Coastguard Worker------------------- 119*03f9172cSAndroid Build Coastguard Worker 120*03f9172cSAndroid Build Coastguard WorkerWPS requires either a device PIN code (usually, 8-digit number) or a 121*03f9172cSAndroid Build Coastguard Workerpushbutton event (for PBC) to allow a new WPS Enrollee to join the 122*03f9172cSAndroid Build Coastguard Workernetwork. hostapd uses the control interface as an input channel for 123*03f9172cSAndroid Build Coastguard Workerthese events. 124*03f9172cSAndroid Build Coastguard Worker 125*03f9172cSAndroid Build Coastguard WorkerThe PIN value used in the commands must be processed by an UI to 126*03f9172cSAndroid Build Coastguard Workerremove non-digit characters and potentially, to verify the checksum 127*03f9172cSAndroid Build Coastguard Workerdigit. "hostapd_cli wps_check_pin <PIN>" can be used to do such 128*03f9172cSAndroid Build Coastguard Workerprocessing. It returns FAIL if the PIN is invalid, or FAIL-CHECKSUM if 129*03f9172cSAndroid Build Coastguard Workerthe checksum digit is incorrect, or the processed PIN (non-digit 130*03f9172cSAndroid Build Coastguard Workercharacters removed) if the PIN is valid. 131*03f9172cSAndroid Build Coastguard Worker 132*03f9172cSAndroid Build Coastguard WorkerWhen a client device (WPS Enrollee) connects to hostapd (WPS 133*03f9172cSAndroid Build Coastguard WorkerRegistrar) in order to start PIN mode negotiation for WPS, an 134*03f9172cSAndroid Build Coastguard Workeridentifier (Enrollee UUID) is sent. hostapd will need to be configured 135*03f9172cSAndroid Build Coastguard Workerwith a device password (PIN) for this Enrollee. This is an operation 136*03f9172cSAndroid Build Coastguard Workerthat requires user interaction (assuming there are no pre-configured 137*03f9172cSAndroid Build Coastguard WorkerPINs on the AP for a set of Enrollee). 138*03f9172cSAndroid Build Coastguard Worker 139*03f9172cSAndroid Build Coastguard WorkerThe PIN request with information about the device is appended to the 140*03f9172cSAndroid Build Coastguard Workerwps_pin_requests file (/var/run/hostapd.pin-req in this example). In 141*03f9172cSAndroid Build Coastguard Workeraddition, hostapd control interface event is sent as a notification of 142*03f9172cSAndroid Build Coastguard Workera new device. The AP could use, e.g., a web UI for showing active 143*03f9172cSAndroid Build Coastguard WorkerEnrollees to the user and request a PIN for an Enrollee. 144*03f9172cSAndroid Build Coastguard Worker 145*03f9172cSAndroid Build Coastguard WorkerThe PIN request file has one line for every Enrollee that connected to 146*03f9172cSAndroid Build Coastguard Workerthe AP, but for which there was no PIN. Following information is 147*03f9172cSAndroid Build Coastguard Workerprovided for each Enrollee (separated with tabulators): 148*03f9172cSAndroid Build Coastguard Worker- timestamp (seconds from 1970-01-01) 149*03f9172cSAndroid Build Coastguard Worker- Enrollee UUID 150*03f9172cSAndroid Build Coastguard Worker- MAC address 151*03f9172cSAndroid Build Coastguard Worker- Device name 152*03f9172cSAndroid Build Coastguard Worker- Manufacturer 153*03f9172cSAndroid Build Coastguard Worker- Model Name 154*03f9172cSAndroid Build Coastguard Worker- Model Number 155*03f9172cSAndroid Build Coastguard Worker- Serial Number 156*03f9172cSAndroid Build Coastguard Worker- Device category 157*03f9172cSAndroid Build Coastguard Worker 158*03f9172cSAndroid Build Coastguard WorkerExample line in the /var/run/hostapd.pin-req file: 159*03f9172cSAndroid Build Coastguard Worker1200188391 53b63a98-d29e-4457-a2ed-094d7e6a669c Intel(R) Centrino(R) Intel Corporation Intel(R) Centrino(R) - - 1-0050F204-1 160*03f9172cSAndroid Build Coastguard Worker 161*03f9172cSAndroid Build Coastguard WorkerControl interface data: 162*03f9172cSAndroid Build Coastguard WorkerWPS-PIN-NEEDED [UUID-E|MAC Address|Device Name|Manufacturer|Model Name|Model Number|Serial Number|Device Category] 163*03f9172cSAndroid Build Coastguard WorkerFor example: 164*03f9172cSAndroid Build Coastguard Worker<2>WPS-PIN-NEEDED [53b63a98-d29e-4457-a2ed-094d7e6a669c|02:12:34:56:78:9a|Device|Manuf|Model|Model Number|Serial Number|1-0050F204-1] 165*03f9172cSAndroid Build Coastguard Worker 166*03f9172cSAndroid Build Coastguard WorkerWhen the user enters a PIN for a pending Enrollee, e.g., on the web 167*03f9172cSAndroid Build Coastguard WorkerUI), hostapd needs to be notified of the new PIN over the control 168*03f9172cSAndroid Build Coastguard Workerinterface. This can be done either by using the UNIX domain socket 169*03f9172cSAndroid Build Coastguard Worker-based control interface directly (src/common/wpa_ctrl.c provides 170*03f9172cSAndroid Build Coastguard Workerhelper functions for using the interface) or by calling hostapd_cli. 171*03f9172cSAndroid Build Coastguard Worker 172*03f9172cSAndroid Build Coastguard WorkerExample command to add a PIN (12345670) for an Enrollee: 173*03f9172cSAndroid Build Coastguard Worker 174*03f9172cSAndroid Build Coastguard Workerhostapd_cli wps_pin 53b63a98-d29e-4457-a2ed-094d7e6a669c 12345670 175*03f9172cSAndroid Build Coastguard Worker 176*03f9172cSAndroid Build Coastguard WorkerIf the UUID-E is not available (e.g., Enrollee waits for the Registrar 177*03f9172cSAndroid Build Coastguard Workerto be selected before connecting), wildcard UUID may be used to allow 178*03f9172cSAndroid Build Coastguard Workerthe PIN to be used once with any UUID: 179*03f9172cSAndroid Build Coastguard Worker 180*03f9172cSAndroid Build Coastguard Workerhostapd_cli wps_pin any 12345670 181*03f9172cSAndroid Build Coastguard Worker 182*03f9172cSAndroid Build Coastguard WorkerTo reduce likelihood of PIN being used with other devices or of 183*03f9172cSAndroid Build Coastguard Workerforgetting an active PIN available for potential attackers, expiration 184*03f9172cSAndroid Build Coastguard Workertime in seconds can be set for the new PIN (value 0 indicates no 185*03f9172cSAndroid Build Coastguard Workerexpiration): 186*03f9172cSAndroid Build Coastguard Worker 187*03f9172cSAndroid Build Coastguard Workerhostapd_cli wps_pin any 12345670 300 188*03f9172cSAndroid Build Coastguard Worker 189*03f9172cSAndroid Build Coastguard WorkerIf the MAC address of the enrollee is known, it should be configured 190*03f9172cSAndroid Build Coastguard Workerto allow the AP to advertise list of authorized enrollees: 191*03f9172cSAndroid Build Coastguard Worker 192*03f9172cSAndroid Build Coastguard Workerhostapd_cli wps_pin 53b63a98-d29e-4457-a2ed-094d7e6a669c \ 193*03f9172cSAndroid Build Coastguard Worker 12345670 300 00:11:22:33:44:55 194*03f9172cSAndroid Build Coastguard Worker 195*03f9172cSAndroid Build Coastguard Worker 196*03f9172cSAndroid Build Coastguard WorkerAfter this, the Enrollee can connect to the AP again and complete WPS 197*03f9172cSAndroid Build Coastguard Workernegotiation. At that point, a new, random WPA PSK is generated for the 198*03f9172cSAndroid Build Coastguard Workerclient device and the client can then use that key to connect to the 199*03f9172cSAndroid Build Coastguard WorkerAP to access the network. 200*03f9172cSAndroid Build Coastguard Worker 201*03f9172cSAndroid Build Coastguard Worker 202*03f9172cSAndroid Build Coastguard WorkerIf the AP includes a pushbutton, WPS PBC mode can be used. It is 203*03f9172cSAndroid Build Coastguard Workerenabled by pushing a button on both the AP and the client at about the 204*03f9172cSAndroid Build Coastguard Workersame time (2 minute window). hostapd needs to be notified about the AP 205*03f9172cSAndroid Build Coastguard Workerbutton pushed event over the control interface, e.g., by calling 206*03f9172cSAndroid Build Coastguard Workerhostapd_cli: 207*03f9172cSAndroid Build Coastguard Worker 208*03f9172cSAndroid Build Coastguard Workerhostapd_cli wps_pbc 209*03f9172cSAndroid Build Coastguard Worker 210*03f9172cSAndroid Build Coastguard WorkerAt this point, the client has two minutes to complete WPS negotiation 211*03f9172cSAndroid Build Coastguard Workerwhich will generate a new WPA PSK in the same way as the PIN method 212*03f9172cSAndroid Build Coastguard Workerdescribed above. 213*03f9172cSAndroid Build Coastguard Worker 214*03f9172cSAndroid Build Coastguard Worker 215*03f9172cSAndroid Build Coastguard WorkerWhen an external Registrar is used, the AP can act as an Enrollee and 216*03f9172cSAndroid Build Coastguard Workeruse its AP PIN. A static AP PIN (e.g., one one a label in the AP 217*03f9172cSAndroid Build Coastguard Workerdevice) can be configured in hostapd.conf (ap_pin parameter). A more 218*03f9172cSAndroid Build Coastguard Workersecure option is to use hostapd_cli wps_ap_pin command to enable the 219*03f9172cSAndroid Build Coastguard WorkerAP PIN only based on user action (and even better security by using a 220*03f9172cSAndroid Build Coastguard Workerrandom AP PIN for each session, i.e., by using "wps_ap_pin random" 221*03f9172cSAndroid Build Coastguard Workercommand with a timeout value). Following commands are available for 222*03f9172cSAndroid Build Coastguard Workermanaging the dynamic AP PIN operations: 223*03f9172cSAndroid Build Coastguard Worker 224*03f9172cSAndroid Build Coastguard Workerhostapd_cli wps_ap_pin disable 225*03f9172cSAndroid Build Coastguard Worker- disable AP PIN (i.e., do not allow external Registrars to use it to 226*03f9172cSAndroid Build Coastguard Worker learn the current AP settings or to reconfigure the AP) 227*03f9172cSAndroid Build Coastguard Worker 228*03f9172cSAndroid Build Coastguard Workerhostapd_cli wps_ap_pin random [timeout] 229*03f9172cSAndroid Build Coastguard Worker- generate a random AP PIN and enable it 230*03f9172cSAndroid Build Coastguard Worker- if the optional timeout parameter is given, the AP PIN will be enabled 231*03f9172cSAndroid Build Coastguard Worker for the specified number of seconds 232*03f9172cSAndroid Build Coastguard Worker 233*03f9172cSAndroid Build Coastguard Workerhostapd_cli wps_ap_pin get 234*03f9172cSAndroid Build Coastguard Worker- fetch the current AP PIN 235*03f9172cSAndroid Build Coastguard Worker 236*03f9172cSAndroid Build Coastguard Workerhostapd_cli wps_ap_pin set <PIN> [timeout] 237*03f9172cSAndroid Build Coastguard Worker- set the AP PIN and enable it 238*03f9172cSAndroid Build Coastguard Worker- if the optional timeout parameter is given, the AP PIN will be enabled 239*03f9172cSAndroid Build Coastguard Worker for the specified number of seconds 240*03f9172cSAndroid Build Coastguard Worker 241*03f9172cSAndroid Build Coastguard Workerhostapd_cli get_config 242*03f9172cSAndroid Build Coastguard Worker- display the current configuration 243*03f9172cSAndroid Build Coastguard Worker 244*03f9172cSAndroid Build Coastguard Workerhostapd_cli wps_config <new SSID> <auth> <encr> <new key> 245*03f9172cSAndroid Build Coastguard Workerexamples: 246*03f9172cSAndroid Build Coastguard Worker hostapd_cli wps_config testing WPA2PSK CCMP 12345678 247*03f9172cSAndroid Build Coastguard Worker hostapd_cli wps_config "no security" OPEN NONE "" 248*03f9172cSAndroid Build Coastguard Worker 249*03f9172cSAndroid Build Coastguard Worker<auth> must be one of the following: OPEN WPAPSK WPA2PSK 250*03f9172cSAndroid Build Coastguard Worker<encr> must be one of the following: NONE WEP TKIP CCMP 251*03f9172cSAndroid Build Coastguard Worker 252*03f9172cSAndroid Build Coastguard Worker 253*03f9172cSAndroid Build Coastguard WorkerCredential generation and configuration changes 254*03f9172cSAndroid Build Coastguard Worker----------------------------------------------- 255*03f9172cSAndroid Build Coastguard Worker 256*03f9172cSAndroid Build Coastguard WorkerBy default, hostapd generates credentials for Enrollees and processing 257*03f9172cSAndroid Build Coastguard WorkerAP configuration updates internally. However, it is possible to 258*03f9172cSAndroid Build Coastguard Workercontrol these operations from external programs, if desired. 259*03f9172cSAndroid Build Coastguard Worker 260*03f9172cSAndroid Build Coastguard WorkerThe internal credential generation can be disabled with 261*03f9172cSAndroid Build Coastguard Workerskip_cred_build=1 option in the configuration. extra_cred option will 262*03f9172cSAndroid Build Coastguard Workerthen need to be used to provide pre-configured Credential attribute(s) 263*03f9172cSAndroid Build Coastguard Workerfor hostapd to use. The exact data from this binary file will be sent, 264*03f9172cSAndroid Build Coastguard Workeri.e., it will have to include valid WPS attributes. extra_cred can 265*03f9172cSAndroid Build Coastguard Workeralso be used to add additional networks if the Registrar is used to 266*03f9172cSAndroid Build Coastguard Workerconfigure credentials for multiple networks. 267*03f9172cSAndroid Build Coastguard Worker 268*03f9172cSAndroid Build Coastguard WorkerProcessing of received configuration updates can be disabled with 269*03f9172cSAndroid Build Coastguard Workerwps_cred_processing=1 option. When this is used, an external program 270*03f9172cSAndroid Build Coastguard Workeris responsible for creating hostapd configuration files and processing 271*03f9172cSAndroid Build Coastguard Workerconfiguration updates based on messages received from hostapd over 272*03f9172cSAndroid Build Coastguard Workercontrol interface. This will also include the initial configuration on 273*03f9172cSAndroid Build Coastguard Workerfirst successful registration if the AP is initially set in 274*03f9172cSAndroid Build Coastguard Workerunconfigured state. 275*03f9172cSAndroid Build Coastguard Worker 276*03f9172cSAndroid Build Coastguard WorkerFollowing control interface messages are sent out for external programs: 277*03f9172cSAndroid Build Coastguard Worker 278*03f9172cSAndroid Build Coastguard WorkerWPS-REG-SUCCESS <Enrollee MAC address <UUID-E> 279*03f9172cSAndroid Build Coastguard WorkerFor example: 280*03f9172cSAndroid Build Coastguard Worker<2>WPS-REG-SUCCESS 02:66:a0:ee:17:27 2b7093f1-d6fb-5108-adbb-bea66bb87333 281*03f9172cSAndroid Build Coastguard Worker 282*03f9172cSAndroid Build Coastguard WorkerThis can be used to trigger change from unconfigured to configured 283*03f9172cSAndroid Build Coastguard Workerstate (random configuration based on the first successful WPS 284*03f9172cSAndroid Build Coastguard Workerregistration). In addition, this can be used to update AP UI about the 285*03f9172cSAndroid Build Coastguard Workerstatus of WPS registration progress. 286*03f9172cSAndroid Build Coastguard Worker 287*03f9172cSAndroid Build Coastguard Worker 288*03f9172cSAndroid Build Coastguard WorkerWPS-NEW-AP-SETTINGS <hexdump of AP Setup attributes> 289*03f9172cSAndroid Build Coastguard WorkerFor example: 290*03f9172cSAndroid Build Coastguard Worker<2>WPS-NEW-AP-SETTINGS 10260001011045000c6a6b6d2d7770732d74657374100300020020100f00020008102700403065346230343536633236366665306433396164313535346131663462663731323433376163666462376633393965353466316631623032306164343438623510200006024231cede15101e000844 291*03f9172cSAndroid Build Coastguard Worker 292*03f9172cSAndroid Build Coastguard WorkerThis can be used to update the externally stored AP configuration and 293*03f9172cSAndroid Build Coastguard Workerthen update hostapd configuration (followed by restarting of hostapd). 294*03f9172cSAndroid Build Coastguard Worker 295*03f9172cSAndroid Build Coastguard Worker 296*03f9172cSAndroid Build Coastguard WorkerWPS with NFC 297*03f9172cSAndroid Build Coastguard Worker------------ 298*03f9172cSAndroid Build Coastguard Worker 299*03f9172cSAndroid Build Coastguard WorkerWPS can be used with NFC-based configuration method. An NFC tag 300*03f9172cSAndroid Build Coastguard Workercontaining a password token from the Enrollee can be used to 301*03f9172cSAndroid Build Coastguard Workerauthenticate the connection instead of the PIN. In addition, an NFC tag 302*03f9172cSAndroid Build Coastguard Workerwith a configuration token can be used to transfer AP settings without 303*03f9172cSAndroid Build Coastguard Workergoing through the WPS protocol. 304*03f9172cSAndroid Build Coastguard Worker 305*03f9172cSAndroid Build Coastguard WorkerWhen the AP acts as an Enrollee, a local NFC tag with a password token 306*03f9172cSAndroid Build Coastguard Workercan be used by touching the NFC interface of an external Registrar. The 307*03f9172cSAndroid Build Coastguard Workerwps_nfc_token command is used to manage use of the NFC password token 308*03f9172cSAndroid Build Coastguard Workerfrom the AP. "wps_nfc_token enable" enables the use of the AP's NFC 309*03f9172cSAndroid Build Coastguard Workerpassword token (in place of AP PIN) and "wps_nfc_token disable" disables 310*03f9172cSAndroid Build Coastguard Workerthe NFC password token. 311*03f9172cSAndroid Build Coastguard Worker 312*03f9172cSAndroid Build Coastguard WorkerThe NFC password token that is either pre-configured in the 313*03f9172cSAndroid Build Coastguard Workerconfiguration file (wps_nfc_dev_pw_id, wps_nfc_dh_pubkey, 314*03f9172cSAndroid Build Coastguard Workerwps_nfc_dh_privkey, wps_nfc_dev_pw) or generated dynamically with 315*03f9172cSAndroid Build Coastguard Worker"wps_nfc_token <WPS|NDEF>" command. The nfc_pw_token tool from 316*03f9172cSAndroid Build Coastguard Workerwpa_supplicant can be used to generate NFC password tokens during 317*03f9172cSAndroid Build Coastguard Workermanufacturing (each AP needs to have its own random keys). 318*03f9172cSAndroid Build Coastguard Worker 319*03f9172cSAndroid Build Coastguard WorkerThe "wps_nfc_config_token <WPS/NDEF>" command can be used to build an 320*03f9172cSAndroid Build Coastguard WorkerNFC configuration token. The output value from this command is a hexdump 321*03f9172cSAndroid Build Coastguard Workerof the current AP configuration (WPS parameter requests this to include 322*03f9172cSAndroid Build Coastguard Workeronly the WPS attributes; NDEF parameter requests additional NDEF 323*03f9172cSAndroid Build Coastguard Workerencapsulation to be included). This data needs to be written to an NFC 324*03f9172cSAndroid Build Coastguard Workertag with an external program. Once written, the NFC configuration token 325*03f9172cSAndroid Build Coastguard Workercan be used to touch an NFC interface on a station to provision the 326*03f9172cSAndroid Build Coastguard Workercredentials needed to access the network. 327*03f9172cSAndroid Build Coastguard Worker 328*03f9172cSAndroid Build Coastguard WorkerWhen the NFC device on the AP reads an NFC tag with a MIME media type 329*03f9172cSAndroid Build Coastguard Worker"application/vnd.wfa.wsc", the NDEF message payload (with or without 330*03f9172cSAndroid Build Coastguard WorkerNDEF encapsulation) can be delivered to hostapd using the 331*03f9172cSAndroid Build Coastguard Workerfollowing hostapd_cli command: 332*03f9172cSAndroid Build Coastguard Worker 333*03f9172cSAndroid Build Coastguard Workerwps_nfc_tag_read <hexdump of payload> 334*03f9172cSAndroid Build Coastguard Worker 335*03f9172cSAndroid Build Coastguard WorkerIf the NFC tag contains a password token, the token is added to the 336*03f9172cSAndroid Build Coastguard Workerinternal Registrar. This allows station Enrollee from which the password 337*03f9172cSAndroid Build Coastguard Workertoken was received to run through WPS protocol to provision the 338*03f9172cSAndroid Build Coastguard Workercredential. 339*03f9172cSAndroid Build Coastguard Worker 340*03f9172cSAndroid Build Coastguard Worker"nfc_get_handover_sel <NDEF> <WPS>" command can be used to build the 341*03f9172cSAndroid Build Coastguard Workercontents of a Handover Select Message for connection handover when this 342*03f9172cSAndroid Build Coastguard Workerdoes not depend on the contents of the Handover Request Message. The 343*03f9172cSAndroid Build Coastguard Workerfirst argument selects the format of the output data and the second 344*03f9172cSAndroid Build Coastguard Workerargument selects which type of connection handover is requested (WPS = 345*03f9172cSAndroid Build Coastguard WorkerWi-Fi handover as specified in WSC 2.0). 346*03f9172cSAndroid Build Coastguard Worker 347*03f9172cSAndroid Build Coastguard Worker"nfc_report_handover <INIT/RESP> WPS <carrier from handover request> 348*03f9172cSAndroid Build Coastguard Worker<carrier from handover select>" is used to report completed NFC 349*03f9172cSAndroid Build Coastguard Workerconnection handover. The first parameter indicates whether the local 350*03f9172cSAndroid Build Coastguard Workerdevice initiated or responded to the connection handover and the carrier 351*03f9172cSAndroid Build Coastguard Workerrecords are the selected carrier from the handover request and select 352*03f9172cSAndroid Build Coastguard Workermessages as a hexdump. 353