Patent Publication Number: US-11647552-B2

Title: Communication device, non-transitory computer-readable recording medium storing computer-readable instructions for communication device, and non-transitory computer-readable recording medium storing computer-readable instructions for first external device

Description:
CROSS-REFERENCE TO RELATED APPLICATION 
     This application is a Continuation of U.S. application Ser. No. 17/326,961, filed on May 21, 2021, which is a Continuation of U.S. application Ser. No. 16/727,568, filed on Dec. 26, 2019, now U.S. Pat. No. 11,044,770, issued Jun. 22, 2021, which claims priority to Japanese Patent Application No. 2018-247065, filed on Dec. 28, 2018, the entire contents of which are hereby incorporated by reference into the present application. 
    
    
     TECHNICAL FIELD 
     The disclosure herein discloses a technique for establishing a wireless connection between a communication device and an external device. 
     BACKGROUND ART 
     DPP (Device Provisioning Protocol) scheme, which is a connection scheme developed by the Wi-Fi Alliance, is described in “Device Provisioning Protocol Specification Version 1.0”. In the DPP scheme, for example, a wireless communication according to the DPP scheme is executed in response to establishment of an NFC connection between a first device and a second device. 
     SUMMARY 
     In response to the establishment of an NFC connection between the first device and the second device, there are a situation where wireless communication according to the DPP scheme is to be executed, and a situation where wireless communication according to a connection scheme different from the DPP scheme is to be executed. 
     The disclosure herein discloses a technique whereby, in response to the establishment of a wireless connection between a communication device and an external device, the communication device establishes a wireless connection different from the aforementioned wireless connection according to an appropriate connection scheme among a plurality of connection schemes. 
     The disclosure herein discloses a communication device. The communication device may comprise: a first wireless interface; one or more wireless interfaces different from the first wireless interface; a processor; and a memory storing computer-readable instructions therein, the computer-readable instructions, when executed by the processor, causing the communication device to: establish a first wireless connection with a first external device via the first wireless interface; and supply a first public key that is a public key of the communication device and specific information to the first wireless interface, the first public key and the specific information being sent to the first external device by using the first wireless connection via the first wireless interface; in a case where a first authentication request in which the first public key is used is received from the first external device via a second wireless interface among the one or more wireless interfaces after the first public key and the specific information have been sent to the first external device: send a first authentication response that is a response to the first authentication request to the first external device via the second wireless interface; receive first connection information from the first external device via the second wireless interface after the first authentication response has been sent to the first external device, the first connection information being for establishing a second wireless connection between the communication device and a second external device via the second wireless interface; and in a case where the first connection information is received from the first external device, establish, according to a first connection scheme, the second wireless connection between the communication device and the second external device via the second wireless interface by using the first connection information; and in a case where a specific signal including the specific information is received from the first external device via a third wireless interface among the one or more wireless interfaces after the first public key and the specific information have been sent to the first external device, establish, according to a second connection scheme different from the first connection scheme, a third wireless connection between the communication device and the first external device via the third wireless interface. 
     A computer program for implementing the above communication device, and a computer-readable medium storing the computer program are also novel and useful. Moreover, a method carried out by the communication device is also novel and useful. 
     The disclosure further discloses a non-transitory computer-readable recording medium storing computer-readable instructions for a first external device. The first external device may comprise a first wireless interface and one or more wireless interfaces different from the first wireless interface, and the computer-readable instructions, when executed by a processor of the first external device, may cause the first external device to: establish a first wireless connection with a communication device via the first wireless interface; receive a public key of the communication device and specific information from the communication device by using the first wireless connection via the first wireless interface; in a case where the public key and the specific information are received from the communication device, determine which of a second wireless connection and a third wireless connection is to be established; in a case where it is determined that the second wireless connection is to be established: send an authentication request in which the public key is used to the communication device via a second wireless interface among the one or more wireless interfaces; in a case where the authentication request is sent to the communication device, receive an authentication response that is a response to the authentication request from the communication device via the second wireless interface; and in a case where the authentication response is received from the communication device, send connection information to the communication device via the second wireless interface, the connection information being for establishing the second wireless connection according to a first connection scheme between the communication device and the second external device, wherein in the communication device, the second wireless connection is established between the communication device and the second external device by using the connection information in a case where the connection information is received from the first external device; and in a case where it is determined that the third wireless connection is to be established: send a specific signal including the specific information to the communication device via a third wireless interface among the one or more wireless interfaces; and establish, according to a second connection scheme different from the first connection scheme, the third wireless connection via the third wireless interface between the communication device and the first external device after the specific signal has been sent to the communication device. 
     A computer-readable medium storing the above computer program is also novel and useful. Further, the first external device itself, and a method carried out by the first external device are also novel and useful. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         FIG.  1    shows a configuration of a communication system. 
         FIG.  2    shows an explanatory diagram for explaining an outline of Case A in which a Wi-Fi connection according to DPP scheme is established between a printer and an access point. 
         FIG.  3    shows a sequence view of a process of Bootstrapping. 
         FIG.  4    shows a sequence view of a process of Authentication. 
         FIG.  5    shows a sequence view of a process of Configuration. 
         FIG.  6    shows a sequence view of a process of Network Access. 
         FIG.  7    shows a sequence view of a process of Case B in which a WFD connection is established between a terminal and the printer. 
         FIG.  8    shows a sequence view of a process of Case C in which the terminal and the printer have established a Wi-Fi connection with an access point. 
         FIG.  9    shows a sequence view of a process of Case D in which a mode shifting operation is executed in the printer. 
         FIG.  10    shows a flowchart of a process executed by the terminal. 
         FIG.  11    shows a flowchart of a process executed by the printer. 
         FIG.  12    shows a flowchart of a process executed by a terminal of a second embodiment. 
         FIG.  13    shows a flowchart of a process executed by a printer of the second embodiment. 
     
    
    
     EMBODIMENTS 
     (Configuration of Communication System  2 ;  FIG.  1   ) 
     As shown in  FIG.  1   , a communication system  2  comprises an access point (hereinbelow termed simply as “AP”)  6 , a terminal  10 , and a printer  100 . In this embodiment, a situation is assumed in which a user uses the terminal  10  to establish a wireless connection according to the Wi-Fi scheme (hereinbelow termed as “Wi-Fi connection”) between the printer  100  and the AP  6 . 
     (Configuration of Terminal  10 ) 
     The terminal  10  is a portable terminal device such as a cellphone (e.g., a smartphone), a PDA, and a tablet PC. In a variant, the terminal  10  may be a desktop PC, a laptop PC or the like. The terminal  10  comprises an operation unit  12 , a display unit  14 , a Wi-Fi interface  16 , an NFC interface  18 , and a controller  30 . The units  12  to  30  are connected to a bus line (reference number omitted). Hereinbelow, interface is termed simply as “U/F”. 
     The operation unit  12  comprises a plurality of keys. The user can input various instructions to the terminal  10  by operating the operation unit  12 . The display unit  14  is a display for displaying various information. 
     The Wi-Fi I/F  16  is a wireless interface configured to execute a Wi-Fi communication according to the Wi-Fi scheme. The Wi-Fi scheme is a wireless communication scheme for executing wireless communication according to, for example, 802.11 standard of IEEE (The Institute of Electrical and Electronics Engineers, Inc.) and standards complying thereto (such as 802.11a, 11b, 11g, 11n, etc.). The Wi-Fi I/F  16  can establish a Wi-Fi connection with the AP  6  in a case where an SSID (Service Set Identifier) for identifying a wireless network in which the AP  6  operates as a parent station, and a password used in that wireless network are input via the operation unit  12 . Further, even if this information is not input via the operation unit  12 , the Wi-Fi I/F  16  can establish a Wi-Fi connection with the AP  6  by using a so-called PIN code scheme or PBC (Push Button Configuration) scheme. Hereinbelow, a Wi-Fi connection established in this manner may be termed “normal Wi-Fi connection”. 
     Further, the Wi-Fi I/F  16  supports the WFD (Wi-Fi Direct (registered trademark)) scheme that has been formulated by the Wi-Fi Alliance, and the DPP (Device Provisioning Protocol) scheme that has been formulated by the Wi-Fi Alliance. The WFD scheme is a connection scheme described in the standard “Wi-Fi Peer-to-Peer (P2P) Technical Specification Version1.1” created by the Wi-Fi Alliance. In the WFD standard, three states are defined as states of a WFD device: Group Owner state (hereinbelow termed “G/O state”), client state, and device state. The WFD device is capable of selectively operating in one of the above three states. The DPP scheme is described in the standard “Device Provisioning Protocol Specification Version 1.0” created by the Wi-Fi Alliance, and is a connection scheme for easily establishing a Wi-Fi connection between a pair of devices (such as the printer  100  and the AP  6 ) by using the terminal  10 . Hereinbelow, a Wi-Fi connection established according to the DPP scheme may be termed “DPP connection”, and a Wi-Fi connection established according to the WFD scheme may be termed “WFD connection”. 
     The NFC I/F  18  is an I/F for executing NFC communication according to the NFC scheme. The NFC scheme is a wireless communication scheme based on, e.g. international standards ISO/IEC 14443, 15693, 18092, etc. I/Fs called NFC Forum Devices, and I/Fs called NFC Forum Tags are known as types of I/F for executing NFC communication. In this embodiment, the NFC I/F  18  is an NFC Forum Device. 
     Here, differences between the Wi-Fi I/F and the NFC I/F will be described. A communication speed of a wireless communication via a Wi-Fi I/F (e.g., maximum communication speed is 11 to 600 Mbps) is faster than a communication speed of a wireless communication via an NFC I/F (e.g., maximum communication speed is 100 to 424 Kbps). Further, a frequency used in wireless communication via a Wi-Fi I/F (e.g. a 2.4 GHz band or 5.0 GHz band) is different from a frequency used in wireless communication via an NFC I/F (e.g. a 13.56 MHz band). Further, a maximum distance at which wireless communication via a Wi-Fi I/F can be executed (e.g., about 100 m at maximum) is greater than a maximum distance at which wireless communication via an NFC I/F can be executed (e.g., about 10 cm at maximum). 
     The controller  30  comprises a CPU  32  and a memory  34 . The CPU  32  executes various processes in accordance with an OS (Operating System) program  36  stored in the memory  34 . The memory  34  is configured by a volatile memory, a non-volatile memory, or the like. Further, the memory  34  stores a print application  38  (hereinbelow simply termed “app  38 ”). The app  38  is a program for causing the printer  100  to execute printing, and is installed on the terminal  10  from, for example, a server on the Internet provided by a vendor of the printer  100 . 
     (Configuration of Printer  100 ) 
     The printer  100  is a peripheral device (e.g., a peripheral device of the terminal  10 , etc.) capable of executing a print function. The printer  100  comprises an operation unit  112 , a display unit  114 , a Wi-Fi I/F  116 , an NFC I/F  118 , a print executing unit  120 , and a controller  130 . The units  112  to  130  are connected to a bus line (reference number omitted). 
     The operation unit  112  comprises a plurality of keys. The user can input various instructions to the printer  100  by operating the operation unit  112 . The display unit  114  is a display for displaying various information. The print executing unit  120  comprises printing mechanism such as an ink jet scheme, laser scheme, etc. 
     The Wi-Fi I/F  116  is identical to the Wi-Fi I/F  16  of the terminal  10 . That is, the Wi-Fi I/F  116  supports the WFD scheme and the DPP scheme. For this reason, the printer  100  can establish a Wi-Fi connection with the AP  6  according to the DPP scheme (that is, a DPP connection), and can further establish a Wi-Fi connection with the terminal  10  according to the WFD scheme (that is, a WFD connection). The printer  100  can also establish a normal Wi-Fi connection with the AP  6 . 
     The controller  130  comprises a CPU  132  and a memory  134 . The CPU  132  executes various processes in accordance with a program  136  stored in the memory  134 . The memory  134  is configured by a volatile memory, a non-volatile memory, or the like. 
     The memory  134  further stores a WFD flag  138 . The WFD flag  138  indicates either a value “ON”, meaning that the printer  100  is in a state of being capable of operating according to the WFD scheme, or “OFF”, meaning that the printer  100  is in a state of being incapable of operating according to the WFD scheme. The state in which the WFD flag  138  is “ON” means that the operation state of the printer  100  is one of the three states (that is, G/O state, client state, and device state) of the WFD scheme. The state in which the WFD flag  138  is “OFF” means that the operation state of the printer  100  is not any of the three states of the WFD scheme. 
     Specific Examples; FIG.  2  to FIG.  9   
     Next, specific examples of processes executed by each of the devices  6 ,  10 ,  100  will be described with reference to  FIGS.  2  to  9   . Firstly, a process of Case A in which a DPP connection between the printer  100  and the AP  6  is established will be described with reference to  FIGS.  2  to  6   . 
     (Overview of Case A;  FIG.  2   ) 
     Firstly, an overview of the Case A will be described with reference to  FIG.  2   . As aforementioned, the terminal  10  and the printer  100  support the DPP scheme, and further the AP  6  also supports the DPP scheme. In this embodiment, the DPP connection between the printer  100  and the AP  6  is established by each of the devices  6 ,  10 ,  100  executing communication according to the DPP scheme. Hereinbelow, to facilitate understanding, operations which CPUs (such as the CPUs  32 ,  132 ) of the respective devices execute will be described with the devices (such as the terminal  10 , the printer  100 ) as subjects of action instead of describing the operations with the CPUs as the subjects of action. 
     In T 5 , the terminal  10  executes Bootstrapping (hereinbelow termed simply as “BS”) according to the DPP scheme with the AP  6 . This BS is a process of providing information that is to be used in Authentication (hereinbelow termed simply as “Auth”) of T 10  (to be described later) from the AP  6  to the terminal  10  in response to a QR code (registered trademark) attached to the AP  6  being captured by the terminal  10 . 
     In T 10 , the terminal  10  executes Auth according to the DPP scheme with the AP  6  by using the information obtained in the BS of T 5 . This Auth is a process for each of the terminal  10  and the AP  6  to authenticate their communication counterpart. 
     In T 15 , the terminal  10  executes Configuration (hereinbelow termed simply as “Config”) according to the DPP scheme with the AP  6 . This Config is a process of sending information for establishing the DPP connection between the printer  100  and the AP  6  to the AP  6 . Specifically, in the Config, the terminal  10  creates a Configuration Object (hereinbelow, Configuration Object is simply be termed “CO”) for AP for establishing the DPP connection between the printer  100  and the AP  6 , and sends the CO for AP to the AP  6 . As a result, the CO for AP is stored in the AP  6 . 
     Next, the terminal  10  executes BS according to the DPP scheme with the printer  100  in T 20 . This BS is a process of providing information that is to be used in Auth of T 25  (to be described later) from the printer  100  to the terminal  10  by using the NFC connection established between the NFC I/F  18  of the terminal  10  and the NFC I/F  118  of the printer  100 . 
     In T 25 , the terminal  10  executes Auth according to the DPP scheme with the printer  100  by using the information obtained in the BS of T 20 . This Auth is a process for each of the terminal  10  and the printer  100  to authenticate their communication counterpart. 
     In T 30 , the terminal  10  executes Config according to the DPP scheme with the printer  100 . This Config is a process of sending information for establishing the DPP connection between the printer  100  and the AP  6  to the printer  100 . In this Config, the terminal  10  creates a CO for printer for establishing the DPP connection between the printer  100  and the AP  6 , and sends the CO for printer to the printer  100 . As a result, the CO for printer is stored in the printer  100 . 
     In T 35 , the printer  100  and the AP  6  use the stored Cos for AP and for printer to execute Network Access (hereinbelow termed simply as “NA”) according to the DPP scheme. The NA is a process of sharing a connection key for establishing the DPP connection between the printer  100  and the AP  6 . 
     In T 40 , the printer  100  and the AP  6  execute 4 way-handshake communication. In at least a part of the 4 way-handshake communication, the printer  100  and the AP  6  communicate encrypted information encrypted by the connection key that has been already shared in the NA in T 35 . Further, in a case where decryption of the encrypted information succeeds, the DPP connection is established between the printer  100  and the AP  6 . Due to this, the printer  100  can participate, as a child station, in a wireless network formed by the AP  6 , as a result of which the printer  100  can execute communication via the AP  6  with other device(s) participating in the wireless network. In a variant, the printer  100  and the AP  6  may execute Simultaneous Authentication of Equals (SAE, also called “Dragonfly”) communication, instead of the 4 way-handshake communication. 
     In T 45 , the printer  100  causes the display unit  114  to display a completion screen indicating that the DPP connection has been established with the AP  6 . When the process of T 45  is completed, the process of  FIG.  2    is terminated. 
     In the DPP scheme, in order to establish the Wi-Fi connection between the printer  100  and the AP  6 , the user does not need to input information of the wireless network in which the AP  6  operates as a parent station (such as an SSID and a password) to the printer  100 . As such, the user can easily establish the Wi-Fi connection between the printer  100  and the AP  6 . 
     (Description on Respective Processes;  FIGS.  3  to  6   ) 
     Next, details of the respective processes executed in T 20  to T 35  of  FIG.  2    will be described with reference to  FIGS.  3  to  9   . Since the processes of T 5  to T 15  are similar to the processes of T 20  to T 30  except that the AP  6  is used instead of the printer  100 , the detailed description thereof will be omitted. 
     (Bootstrapping (BS);  FIG.  3   ) 
     First, the process of BS of T 20  of  FIG.  2    will be described with reference to  FIG.  3   . In an initial state of  FIG.  3   , the memory  134  of the printer  100  stores the public key PPK 1  and the secret key psk 1  of the printer  100  in advance. Further, in the initial state of  FIG.  3   , the WFD flag  138  of the printer  100  indicates “OFF”. 
     In response to accepting a power ON operation from the user in T 100 , the printer  100  determines in T 102  that a normal Wi-Fi connection with the AP  6  has not been established, and shifts an operation mode of the printer  100  from non-setting mode to setting mode. The printer  100  determines that a normal Wi-Fi connection with the AP  6  has not been established in a case where AP information (for example, SSID, password, etc.) for establishing the normal Wi-Fi connection with the AP  6  is not stored in the memory  134 , or in a case where a confirmation signal for confirming whether a normal Wi-Fi connection has been established is sent via the Wi-Fi I/F  116  and a response to this confirmation signal is not received from the AP  6 . The non-setting mode is a mode in which BS information used for establishing a DPP connection between the printer  100  and the AP  6  is not supplied to the NFC I/F  118  in response to the establishment of the NFC connection. The setting mode is a mode in which the BS information is supplied to the NFC I/F  118  in response to the establishment of the NFC connection. In other words, the non-setting mode is a mode in which a DPP connection scheme cannot be established according to the DPP, and the setting mode is a mode in which a DPP connection can be established according to the DPP scheme. 
     In response to the app  38  of the terminal  10  being activated, and the terminal  10  being brought close to the printer  100  by the user in T 103 , an NFC connection is established between the NFC I/F  18  of the terminal  10  and the NFC I/F  118  of the printer  100  in T 104 . In this case, in T 105  the printer  100  obtains a signal indicating that the NFC connection has been established from the NFC I/F  118 , determines that the operation mode of the printer  100  is the setting mode, and supplies WFD information and the BS information to the NFC I/F  118 . The WFD information is information used for establishing a WFD connection between the terminal  10  and the printer  100 , and includes an SSID “wfd”. The SSID “wfd” is information for identifying wireless network in which the printer  100  operating in the G/O state operates as a parent station. The SSID “wfd” may be stored in advance in the memory  134 , or may be created by the printer  100  in response to the establishment of the NFC connection. The BS information includes the public key PPK 1  of the printer  100  stored in the memory  134 , a channel list stored in advance in the memory  134 , and a MAC address of the printer  100 . The channel list is information indicating a plurality of communication channels determined in advance in the printer  100  (that is, a plurality of communication channels that can be used by the printer  100 ). 
     In T 106 , the printer  100  changes the WFD flag  138  in the memory  134  from “OFF” to “ON”, and shifts from the device state to the G/O state. 
     In T 108 , the printer  100  shifts from a non-respondent state to a respondent state. The non-respondent state is a state in which the Wi-Fi I/F  116  does not send a DPP Authentication Response (hereinbelow simply termed “ARes”) (see T 210  of  FIG.  4    to be described later) even when a DPP Authentication Request (hereinbelow simply termed “AReq”) is received from the terminal  10  (see T 220  to be described later). The respondent state is a state in which the Wi-Fi I/F  116  sends the ARes to the terminal  10  in response to receiving the AReq from the terminal  10 . That is, the printer  100  shifts to a state of being able to execute the Auth (see T 25  of  FIG.  2   ) by shifting from the non-respondent state to the respondent state. Specifically, in this embodiment, the non-respondent state is a state in which even when the Wi-Fi I/F  116  receives a signal from outside, the Wi-Fi I/F  116  does not supply the signal to the CPU  132 . Further, the respondent state is a state in which in response to receiving a signal from outside, the Wi-Fi I/F  116  supplies the signal to the CPU  132  and sends a response to this signal. Since the respondent state is a state in which the CPU  132  processes the signal received from outside, processing load in that state is higher than that in the non-respondent state. In a variant, the non-respondent state may be a state in which electricity is not supplied to the Wi-Fi I/F  116 , and the respondent state may be a state in which electricity is supplied to the Wi-Fi I/F  116 . Further, in another variant, the non-respondent state may be a state in which even when the Wi-Fi I/F  116  receives the AReq from outside, the Wi-Fi I/F  116  does not supply a notification that the AReq has been received to the CPU  132 , and the respondent state may be a state in which in response to receiving the AReq from outside, the Wi-Fi I/F  116  supplies the notification that the AReq has been received to the CPU  132 . 
     In T 110 , the NFC I/F  118  of the printer  100  sends the WFD information and the BS information to the terminal  10  by using the established NFC connection. 
     When the app  38  is activated in T 103 , the terminal  10  executes following processes in accordance with the app  38 . In a case where the terminal  10  receives the WFD information and the BS information from the printer  100  via the NFC I/F  18  in T 110 , the terminal  10  causes the display unit  14  to display a selection screen in T 112 . The selection screen includes an “AP” button indicating that a process for establishing a DPP connection between the printer  100  and the AP  6  is to be executed, and a “terminal” button indicating that a process for establishing a WFD connection between the terminal  10  and the printer  100  is to be executed. That is, in other words, the selection screen is a screen for causing the user to select one connection scheme from among the DPP scheme and the WFD scheme. 
     In T 120 , the terminal  10  accepts from the user an operation for selecting the “AP” button in the selection screen. When the process of T 120  is completed, the process of  FIG.  3    is terminated. 
     (Authentication (Auth);  FIG.  4   ) 
     Next, the process of the Auth in T 25  of  FIG.  2    will be described with reference to  FIG.  4   . In response to the “AP” button in the selection screen being selected by the user in T 120  of  FIG.  3   , the terminal  10  creates a public key TPK 1  and a secret key tsk 1  of the terminal  10  in T 200 . Next, in T 202 , the terminal  10  creates a shared key SK 1  according to Elliptic curve Diffie—Hellman key exchange (ECDH) by using the created secret key tsk 1  and the public key PPK 1  of the printer  100  received in T 110  of  FIG.  3   . Then, in T 204 , the terminal  10  creates encrypted data ED 1  by using the created shared key SK 1  to encrypt a random value RV 1 . 
     In T 210 , the terminal  10  sends an AReq via the Wi-Fi I/F  16  to the printer  100  by setting the MAC address of the printer  100  received in T 110  of  FIG.  3    as its destination. The AReq is a signal for requesting the printer  100  to execute authentication. Here, the terminal  10  repeats sending the AReq to the printer  100  by sequentially using the plurality of communication channels in the channel list received in T 110 . The AReq includes the public key TPK 1  of the terminal  10  created in T 200 , the encrypted data ED 1  created in T 204 , and a capability of the terminal  10 . 
     The capability is information that is pre-designated in a device supporting the DPP scheme, and includes any one of following values: a value indicating that this device is capable of operating only as a Configurator according to the DPP scheme, a value indicating that this device is capable of operating only as an Enrollee according to the DPP scheme, and a value indicating that this device is capable of operating as whichever one of the Configurator and the Enrollee. The Configurator refers to a device configured to send a CO used in the NA (T 35  of  FIG.  2   ) to an Enrollee in the Config (T 30  of  FIG.  2   ). On the other hand, the Enrollee refers to a device that receives the CO used in the NA from the Configurator in the Config. As above, in this embodiment, the terminal  10  creates the COs for AP and for printer and sends them respectively to the AP  6  and the printer  100 . As such, the capability of the terminal  10  includes the value indicating that it is capable of operating only as the Configurator. 
     The printer  100  receives the AReq from the terminal  10  via the Wi-Fi I/F  116  in T 210 . As above, this AReq is sent with the MAC address of the printer  100  as the destination. As such, the printer  100  can suitably receive this AReq from the terminal  10 . 
     Further, when the printer  100  shifts to the respondent state in T 108  of  FIG.  3   , it monitors receipt of the AReq using one communication channel among the plurality of communication channels in the channel list. As above, the AReq in T 210  is sent by sequentially using the plurality of communication channels in the channel list. As such, the printer  100  can suitably receive this AReq from the terminal  10 . 
     Next, the printer  100  executes following processes for authenticating the sender of the AReq (that is, the terminal  10 ). Specifically, firstly, in T 212 , the printer  100  creates a shared key SK 1  according to the ECDH by using the public key TPK 1  of the terminal  10  in the AReq and the secret key psk 1  of the printer  100  stored in advance in the memory  134 . Here, the shared key SK 1  created by the terminal  10  in T 202  and the shared key SK 1  created by the printer  100  in T 212  are identical to each other. Thus, the printer  100  can suitably decrypt the encrypted data ED 1  in the AReq by using the created shared key SK 1  in T 214 , as a result of which it can obtain the random value RV 1 . In a case where the decryption of the encrypted data ED 1  succeeds, the printer  100  determines that the sender of the AReq is the device with which the NFC connection has been established in T 104  of  FIG.  3   , that is, determines that the authentication succeeded, and executes subsequent processes from T 216 . On the other hand, in a case where the decryption of the encrypted data ED 1  does not succeed, the printer  100  determines that the sender of the AReq is not the device with which the NFC connection has been established in T 104 , that is, determines that the authentication failed, and does not execute the subsequent processes from T 216 . 
     In T 216 , the printer  100  creates a new public key PPK 2  and a new secret key psk 2  of the printer  100 . In a variant, the public key PPK 2  and the secret key psk 2  may be stored in advance in the memory  134 . Next, in T 217 , the printer  100  creates a shared key SK 2  according to the ECDH by using the public key TPK 1  of the terminal  10  in the AReq of T 210  and the created secret key psk 2  of the printer  100 . Then, in T 218 , the printer  100  creates encrypted data ED 2  by using the created shared key SK 2  to encrypt the obtained random value RV 1  and a new random value RV 2 . 
     In T 220 , the printer  100  sends an ARes to the terminal  10  via the Wi-Fi I/F  116 . This ARes includes the public key PPK 2  of the printer  100  created in T 216 , the encrypted data ED 2  created in T 218 , and a capability of the printer  100 . This capability includes the value indicating that the printer  100  is capable of operating only as the Enrollee. 
     In response to receiving the ARes from the printer  100  via the Wi-Fi I/F  16  in T 220 , the terminal  10  executes following processes for authenticating the sender of the ARes (that is, the printer  100 ). Specifically, firstly in T 222 , the terminal  10  creates a shared key SK 2  according to the ECDH by using the secret key tsk 1  of the terminal  10  created in T 200  and the public key PPK 2  of the printer  100  in the ARes. Here, the shared key SK 2  created by the printer  100  in T 217  and the shared key SK 2  created by the terminal  10  in T 222  are identical to each other. Thus, the terminal  10  can suitably decrypt the encrypted data ED 2  in the ARes by using the created shared key SK 2  in T 224 , as a result of which it can obtain the random values RV 1  and RV 2 . In a case where the decryption of the encrypted data ED 2  succeeds, the terminal  10  determines that the sender of the ARes is the device with which the NFC connection has been established in T 104  of  FIG.  3   , that is, determines that the authentication succeeded, and executes subsequent processes from T 230 . On the other hand, in a case where the decryption of the encrypted data ED 2  does not succeed, the terminal  10  determines that the sender of the ARes is not the device with which the NFC connection has been established in T 104 , that is, determines that the authentication failed, and does not execute the subsequent processes from T 230 . 
     In T 230 , the terminal  10  sends a Confirm to the printer  100  via the Wi-Fi I/F  16 . The Confirm includes information indicating that the terminal  10  operates as the Configurator and the printer  100  operates as the Enrollee. As a result, the terminal  10  determines to operate as the Configurator in T 232 , and the printer  100  determines to operate as the Enrollee in T 234 . When the process of T 234  is completed, the process of  FIG.  4    is terminated. 
     (Configuration (Config);  FIG.  5   ) 
     Next, the process of Config in T 30  of  FIG.  2    will be described with reference to  FIG.  5   . In T 300 , the printer  100  sends a DPP Configuration Request (hereinbelow termed simply as “CReq”) to the terminal  10  via the Wi-Fi I/F  116 . This CReq is a signal requesting the CO (that is, the information for establishing the DPP connection between the printer  100  and the AP  6 ) to be sent. 
     The terminal  10  receives the CReq from the printer  100  in T 300  via the Wi-Fi I/F  16 . In this case, the terminal  10  obtains a group ID “Group”, a public key TPK 2 , and a secret key tsk 2  from a memory  34  of the terminal  10  in T 301 . As aforementioned, the terminal  10  have already executed the Config in T 15  of  FIG.  2    with the AP  6 , and at that occasion the terminal  10  creates the group ID “Group”, the public key TPK 2 , and the secret key tsk 2  and stored the same in the memory. The group ID “Group” is information for identifying a wireless network formed by the DPP connection being established between the printer  100  and the AP  6 . In a variant, a character string designated by the user may be used as the group ID. That is, in T 301 , the terminal  10  obtains the respective information that were stored in T 15  of  FIG.  2   . Next, in T 302 , the terminal  10  creates the CO for printer (see T 30  of  FIG.  2   ). Specifically, the terminal  10  executes following processes. 
     The terminal  10  creates a hash value HV by hashing the public key TPK 2  of the terminal  10 . Further, the terminal  10  creates a specific value by hashing a combination of the hash value HV, the group ID “Group”, and the public key PPK 2  of the printer  100  in the ARes in T 220  of  FIG.  4   . Then, the terminal  10  creates a digital signature DSpr by using the secret key tsk 2  of the terminal  10  to encrypt the created specific value in accordance with an Elliptic Curve Digital Signature Algorithm (ECDSA). As a result, the terminal  10  can create a Signed-Connector for printer (hereinbelow, the Signed-Connector is termed simply as “SCont”) including the hash value HV, the group ID “Group”, the public key PPK 2  of the printer  100 , and the digital signature DSpr. Further, the terminal  10  creates the CO for printer including the SCont for printer and the public key TPK 2  of the terminal  10 . 
     In T 310 , the terminal  10  sends a DPP Configuration Response (hereinbelow termed simply as “CRes”) including the CO for printer to the printer  100  via the Wi-Fi I/F  16 . 
     The printer  100  receives the CRes from the terminal  10  in T 310  via the Wi-Fi I/F  116 . In this case, the printer  100  stores the CO for printer in the CRes in the memory  134  in T 312 . When the process of T 312  is completed, the process of  FIG.  5    is terminated. 
     (Network Access (NA);  FIG.  6   ) 
     Next, the process of the NA in T 35  of  FIG.  2    executed between the printer  100  and the AP  6  will be described with reference to  FIG.  6   . As aforementioned, the processes of T 5  to T 15  of  FIG.  2    have already been executed between the terminal  10  and the AP  6 , similarly to T 20  to T 30  of  FIG.  2   . However, the AP  6  does not execute the processes of T 102  to T 110  of  FIG.  3   . The AP  6  stores in advance a public key APK 1  and a secret key ask 1  of the AP  6 . Further, a QR code, which is obtained by coding the public key APK 1  of the AP  6 , a channel list of the AP  6 , and a MAC address of the AP  6 , is adhered to a housing of the AP  6 . Processes similar to the processes from T 200  of  FIG.  4    onward are executed between the terminal  10  and the AP  6  when the terminal  10  captures this QR code. As a result, the AP  6  stores a public key APK 2  and a secret key ask 2  of the AP  6  (see T 216  of  FIG.  4   ), and further stores the CO for AP received from the terminal  10  (see T 312  of  FIG.  5   ). The CO for AP includes a SCont for AP and a public key TPK 2  of the terminal  10 . This public key TPK 2  is identical to the public key TPK 2  included in the CO for printer. Further, the SCont for AP includes a hash value HV, a group ID “Group”, the public key APK 2  of the AP  6 , and a digital signature DSap. This hash value HV and this group ID “Group” are respectively identical to the hash value HV and the group ID “Group 1” included in the CO for printer. The digital signature DSap is information in which a specific value, which is obtained by hashing a combination of the hash value HV, the group ID “Group”, and the public key APK 2 , is encrypted by the secret key tsk 2  of the terminal  10 , and is a value different from the digital signature DSpr included in the CO for printer. 
     In T 400 , the printer  100  sends a DPP Peer Discovery Request (hereinbelow termed simply as “DReq”) including the SCont for printer to the AP  6  via the Wi-Fi I/F  116 . This DReq is a signal requesting the AP  6  to execute authentication and send the SCont for AP. 
     In response to receiving the DReq from the printer  100  in T 400 , the AP  6  executes a process for authenticating the sender of the DReq (that is, the printer  100 ) and the respective information in the DReq (that is, the hash value HV, the “Group”, and the public key PPK 2 ). Specifically, in T 402 , the AP  6  firstly executes a first AP determination process that is regarding whether or not the hash value HV and the group ID “Group” in the received SCont for printer are respectively identical to the hash value HV and the group ID “Group” in the SCont for AP included in the stored CO for AP. In the case of  FIG.  6   , the AP  6  determines “identical” in the first AP determination process, thus it determines that the authentication of the sender of the DReq (that is, the printer  100 ) succeeds. Here, the fact that the hash value HV in the received SCont for printer is identical to the hash value HV in the SCont for AP included in the stored CO for AP means that the SCont for printer and the SCont for AP were created by the same device (that is, the terminal  10 ). As such, the AP  6  also determines that authentication of the creator of the received SCont for printer (that is, the terminal  10 ) succeeds. Further, the AP  6  decrypts the digital signature DSpr in the received SCont for printer by using the public key TPK 2  of the terminal  10  included in the stored CO for AP. Since the decryption of the digital signature DSpr succeeds in the case of  FIG.  6   , the AP  6  executes a second AP determination process that is regarding whether or not a specific value obtained by decrypting the digital signature DSpr is identical to a value obtained by hashing the respective information in the received SCont for printer (that is, the hash value HV, the “Group”, and the public key PPK 2 ). In the case of  FIG.  6   , the AP  6  determines “identical” in the second AP determination process, thus it determines that the authentication of the respective information in the DReq succeeds, and executes processes from T 404  onward. The fact that the AP  6  determines “identical” in the second AP determination process means that the respective information in the received SCont for printer (that is, the hash value HV, the “Group”, and the public key PPK 2 ) has not been tampered by a third party since the CO for printer was stored in the printer  100 . On the other hand, in a case where the AP  6  determines “not identical” in the first AP determination process, in a case where the decryption of the digital signature DSpr fails, or in a case where the AP  6  determines “not identical” in the second AP determination process, the AP  6  determines that the authentication fails and does not execute the processes from T 404 . 
     Next, in T 404 , the AP  6  creates a connection key CK (that is, a shared key) by using the obtained public key PPK 2  of the printer  100  and the stored secret key ask 2  of the AP  6  in accordance with the ECDH. 
     In T 410 , the AP  6  sends a DPP Peer Discovery Response (hereinbelow termed simply as “DRes”) including the SCont for AP to the printer  100 . 
     In response to receiving the DRes from the AP  6  in T 410  via the Wi-Fi I/F  116 , the printer  100  executes a process for authenticating the sender of the DRes (that is, the AP  6 ) and the respective information in the DRes (that is, the hash value HV, the “Group 1 ”, and the public key APK 2 ). Specifically, in T 412 , the printer  100  firstly executes a first PR determination process that is regarding whether or not the hash value HV and the group ID “Group” in the received SCont for AP are respectively identical to the hash value HV and the group ID “Group” in the SCont for printer included in the stored CO for printer. In the case of  FIG.  6   , the printer  100  determines “identical” in the first PR determination process, thus it determines that the authentication of the sender of the DRes (that is, the AP  6 ) succeeds. The fact that the hash value HV in the received SCont for AP is identical to the hash value HV in the SCont for printer included in the stored CO for printer means that the SCont for printer and the SCont for AP were created by the same device (that is, the terminal  10 ). As such, the printer  100  also determines that authentication of the creator of the received SCont for AP (that is, the terminal  10 ) succeeds. Further, the printer  100  decrypts the digital signature DSap in the received SCont for AP by using the public key TPK 2  of the terminal  10  included in the stored CO for printer. Since the decryption of the digital signature DSap succeeds in the case of  FIG.  6   , the printer  100  executes a second PR determination process that is regarding whether or not a specific value obtained by decrypting the digital signature DSap is identical to a value obtained by hashing the respective information in the received SCont for AP (that is, the hash value HV, the “Group”, and the public key APK 2 ). In the case of  FIG.  6   , the printer  100  determines “identical” in the second PR determination process, thus it determines that the authentication of the respective information in the DRes succeeds, and executes processes from T 414  onward. The fact that the printer  100  determines “identical” in the second PR determination process means that the respective information in the SCont for AP (that is, the hash value HV, the “Group”, and the public key APK 2 ) has not been tampered by a third party since the CO for AP was stored in the AP  6 . On the other hand, in a case where the printer  100  determines “not identical” in the first PR determination process, in a case where the decryption of the digital signature DSap fails, or in a case where the printer  100  determines “not identical” in the second PR determination process, the printer  100  determines that the authentication fails and does not execute the processes from T 414 . 
     In T 414 , the printer  100  creates a connection key CK by using the stored secret key psk 2  of the printer  100  and the public key APK 2  of the AP  6  in the received SCont for AP in accordance with the ECDH. Here, the connection key CK created by the AP  6  in T 404  and the connection key CK created by the printer  100  in T 414  are identical to each other. Due to this, the connection key CK for establishing the DPP connection is shared between the printer  100  and the AP  6 . When T 414  is completed, the process of  FIG.  6    is terminated. 
     As above, after the connection key CK has been shared between the printer  100  and the AP  6 , in T 40  of  FIG.  2    the printer  100  and the AP  6  use the connection key CK to execute communication of a 4 way-handshake. As a result, a DPP connection is established between the printer  100  and the AP  6 . The printer  100  changes the WFD flag  138  from “ON” to “OFF” in a case of establishing the DPP connection with the AP  6 . 
     (Case B;  FIG.  7   ) 
     Next, the process of Case B in which a WFD connection is established between the terminal  10  and the printer  100  will be described with reference to  FIG.  7   . T 500  to T 512  are similar to T 100  to T 112  of  FIG.  3   . In response to the “terminal” button being selected by the user in the selection screen in T 520 , the terminal  10  executes a search process for searching for a device that is a connection target of the terminal  10  (that is, the printer  100 ) in T 522 . Specifically, the following processes are executed. 
     Firstly, the terminal  10  sends a Probe Request (hereinbelow termed simply as “PReq”) by broadcast via the Wi-Fi I/F  16 . When the terminal  10  sends the PReq by broadcast, the terminal  10  receives a respective Probe Response (hereinbelow termed simply as “PRes”) from one or more devices including the printer  100 . In this case, the terminal  10  specifies the printer  100  that is the connection target by specifying a PRes including the SSID “wfd” received in T 510  from among the one or more PRes. Then, the terminal  10  sends a PReq including the SSID “wfd” of the specified printer  100  to the printer  100  via the Wi-Fi I/F  16  (that is, sends by unicast). 
     In response to receiving the PReq including the SSID “wfd” from the terminal  10 , the printer  100  sends a PRes to the terminal  10  via the Wi-Fi I/F  116 . 
     In T 530 , the terminal  10  executes various communications with the printer  100  (Provision Discovery, Association, WPS Negotiation, 4 way-handshake). In the WPS Negotiation, the terminal  10  receives wireless setting information including the SSID “wfd” and password being stored in the memory  134  from the printer  100 . Then, the terminal  10  executes the 4 way-handshake communication with the printer  100  by using the SSID “wfd” and the password to establish a WFD connection with the printer  100 . 
     In a case where a WFD connection with the terminal  10  is established in T 530 , the printer  100  shifts from the respondent state to the non-respondent state in T 540 . In a situation where a WFD connection is established between the terminal  10  and the printer  100 , a possibility is low that communication according to the DPP scheme is executed between the terminal  10  and the printer  100 . In such a situation, since the printer  100  shifts from the respondent state to the non-respondent state, it is possible to suppress maintenance of the respondent state which has a higher processing load than the non-respondent state. 
     In response to accepting a print operation at T 550  from the user for causing the printer  100  to execute printing, in T 552  the terminal  10  sends print data to the printer  100  via the Wi-Fi I/F  16  by using the established WFD connection. 
     In a case of receiving the print data from the terminal  10  via the Wi-Fi I/F  116  in T 552 , the printer  100  causes the print executing unit  120  to execute printing according to the print data in T 554 . When the process of T 554  is completed, the process of  FIG.  7    is terminated. 
     (Case C;  FIG.  8   ) 
     Next, a process of Case C will be described with reference to  FIG.  8   . In Case C, the terminal  10  and the printer  100  has established a normal Wi-Fi connection with the AP  6 . For this reason, the memory  34  of the terminal  10  and the memory  134  of the printer  100  are storing AP information for establishing the normal Wi-Fi connection with the AP  6 . The AP information includes an SSID “ap 6 ” for identifying the wireless network formed by the AP  6 . In an initial state of  FIG.  8   , since the AP information is being stored in the memory  134 , the printer  100  is operating in the non-setting mode. 
     T 600  and T 602  are similar to T 100  and T 102  of  FIG.  3   . In T 604 , the printer  100  acquires a signal indicating that the NFC connection is established from the NFC I/F  118 , determines that the operation mode of the printer  100  is the non-setting mode, and supplies the WFD information including the SSID “wfd” and the AP information including the SSID “ap 6 ” to the NFC I/F  118 . 
     T 606  is similar to T 106  of  FIG.  3   . In T 610 , the NFC I/F  118  of the printer  100  sends the WFD information and the AP information to the terminal  10  by using the established NFC connection. 
     In T 610 , in a case of receiving the WFD information and the AP information from the printer  100  via the NFC I/F  18 , the terminal  10  determines that the SSID “ap 6 ” included in the received AP information is identical to the SSID “ap 6 ” in the AP information stored in the memory  34 . In this case, the terminal  10  determines that communication with the printer  100  is currently possible and, in T 612 , displays a notification screen indicating that communication with the printer  100  is currently possible. 
     T 650  to T 654  are similar to T 550  to T 554  of  FIG.  7   . In T 660 , the printer  100  determines that a predetermined time has elapsed since the WFD  138  was changed to “ON” in T 606  and, in T 662 , changes the WFD  138  from “ON” to “OFF”. When the process of T 662  is completed, the process of  FIG.  8    is terminated. 
     As above, in a case where an NFC connection is established with the terminal  10  (T 602 ) in a situation of a normal Wi-Fi connection with the AP  6  being established, the printer  100  supplies the AP information to the NFC I/F  118  (T 604 ). Due to this, the AP information is sent from the NFC I/F  118  to the terminal  10 , so that the terminal  10  can use the received AP information to determine whether communication with the printer  100  is currently possible. Then, in a case of determining that communication with the printer  100  is currently possible, the terminal  10  displays the notification screen. That is, in a situation where the terminal  10  and the printer  100  are currently capable of communicating with each other, the printer  100  does not execute the process for establishing a DPP connection between the printer  100  and the AP  6 , or the process for establishing a WFD connection between the terminal  10  and the printer  100 . As such, the processing load of the terminal  10  and the printer  100  can be reduced. 
     (Case D;  FIG.  9   ) 
     Next, the process of Case D, in which a mode shifting operation is executed in the printer  100 , will be described with reference to  FIG.  9   . In Case D, the printer  100  has established a normal Wi-Fi connection with the AP  6 . As such, the printer  100  is storing the AP information including the SSID “ap 6 ” in the memory  134 . Further, in an initial state of  FIG.  9   , the printer  100  is operating in the non-setting mode. 
     In a case where a shift instruction for shifting the operation mode of the printer  100  is accepted from the user in T 700 , the printer  100  shifts from the non-setting mode to the setting mode in T 702 . T 703  and T 704  are similar to T 103  and T 104  of  FIG.  3   . 
     In T 705 , the printer  100  acquires a signal from the NFC I/F  118  indicating that the NFC connection has been established, determines that the operation mode of the printer  100  is the setting mode, and supplies the WFD information and the BS information to the NFC I/F  118 . T 706  to T 712  are similar to T 106  to T 112  of  FIG.  3   . That is, the WFD information and the BS information are sent from the NFC I/F  118  of the printer  100  to the terminal  10 , and a selection screen is displayed on the terminal  10 . When the process of T 712  is completed, the process of  FIG.  9    is terminated. 
     As above, in a situation where a normal Wi-Fi connection is established between the printer  100  and the AP  6 , that is, in a situation where the printer  100  is operating in the non-setting mode, the printer  100  shifts to the setting mode in a case where the shift instruction is accepted from the user (T 702 ). Then, the printer  100  supplies the WFD information and the BS information to the NFC I/F  118  in response to the establishment of the NFC connection with the terminal  10  (T 705 ). As a result, the WFD information and the BS information are sent from the NFC I/F  118  to the terminal  10  (T 710 ). Due to this, in a situation where the user desires to execute communication according to the DPP scheme between the terminal  10  and the printer  100 , for example, in a situation where the user desires to establish a DPP connection between the printer  100  and an AP different from the AP  6 , the user can cause communication according to the DPP scheme to be executed between the terminal  10  and the printer  100  by executing the shift instruction in the printer  100  that is operating in the non-setting mode. 
     (Process of Terminal  10 ;  FIG.  10   ) 
     Next, a process executed by the CPU  32  of the terminal  10  in order to realize the processes of  FIGS.  2  to  9    will be described with reference to  FIG.  10   . A process of  FIG.  10    is executed in a case where an NFC connection is established between the NFC I/F  18  of the terminal  10  and the NFC I/F  118  of the printer  100 . 
     In S 10 , the terminal  10  determines whether the BS information has been received from the printer  100  via the NFC I/F  18  by using the established NFC connection. In a case where the WFD information and the BS information are received from the printer  100  (for example, T 110  of  FIG.  3   ), the terminal  10  determines YES in S 10 , and proceeds to S 15 . On the other hand, in a case where the WFD information and the AP information are received from the printer  100  (for example, T 610  of  FIG.  8   ), the terminal  10  determines NO in S 10 , and proceeds to S 35 . 
     In S 15 , the terminal  10  displays the selection screen on the display unit  14  (for example, T 112  of  FIG.  3   ). 
     In S 20 , the terminal  10  determines whether the “terminal” button in the selection screen has been selected by the user. In a case where the “terminal” button in the selection screen has been selected by the user (for example, T 520  of  FIG.  7   ), the terminal  10  determines YES in S 20 , and proceeds to S 25 . On the other hand, in a case where the “AP” button in the selection screen has been selected (for example, T 120  of  FIG.  3   ), the terminal  10  determines NO in S 20 , and proceeds to S 30 . 
     In S 25 , the terminal  10  executes various communications with the printer  100  (Probe, Provision Discovery, Association, WPS Negotiation, 4 way-handshake) according to the WFD scheme via the Wi-Fi I/F  16 , and establishes a WFD connection with the printer  100  (for example, T 522  and T 530  of  FIG.  7   ). When the process of S 25  is completed, the process of  FIG.  10    is terminated. 
     In S 30 , the terminal  10  executes the Auth and the Config with the printer  100  via the Wi-Fi I/F  16  ( FIG.  4    and  FIG.  5   ). When the process of S 30  is completed, the process of  FIG.  10    is terminated. 
     In S 35 , the terminal  10  determines whether communication with the printer  100  is currently possible by using the received AP information. In a case of determining that communication with the printer  100  is currently possible, the terminal  10  determines YES in S 35  and, in S 40 , causes the display unit  14  to display a notification screen (for example, T 612  of  FIG.  8   ). On the other hand, in a case of determining that communication with the printer  100  is not currently possible, the terminal  10  determines NO in S 35  and, in S 25 , establishes a WFD connection with the printer  100  by using the received WFD information. When the process of S 25  or S 40  is completed, the process of  FIG.  10    is terminated. 
     (Process of Printer  100 ;  FIG.  11   ) 
     Next, a process executed by the CPU  132  of the printer  100  in order to realize the processes of  FIGS.  2  to  9    will be described with reference to  FIG.  11   . The process of  FIG.  11    is executed in a case where an NFC connection is established between the NFC I/F  18  of the terminal  10  and the NFC I/F  118  of the printer  100 . 
     In S 100 , the printer  100  determines whether a normal Wi-Fi connection with the AP  6  is being established. In a case where the AP information is being stored in the memory  134 , the printer  100  determines YES in S 100 , and proceeds to S 103 . On the other hand, in a case where the AP information is not being stored in the memory  134 , the printer  100  determines NO in S 100 , and proceeds to S 135 . 
     In S 103 , the printer  100  determines whether it is operating in the non-setting mode. In case of determining that the printer  100  is operating in the non-setting mode (YES in S 103 ), the printer  100  proceeds to S 105 . On the other hand, in case of determining that the printer  100  is operating in the setting mode (NO in S 103 ), the printer  100  proceeds to S 135 . 
     In S 105 , the printer  100  supplies the WFD information and the AP information to the NFC I/F  118  (for example, T 604  of  FIG.  8   ). The WFD information includes an SSID for identifying the wireless network in which the printer  100  that is operating in the G/O state operates as a parent station. The AP information includes an SSID for identifying the wireless network in which the AP with which the printer  100  has established a normal Wi-Fi connection operates as a parent station. 
     In S 110 , the printer  100  determines whether the WFD flag  138  stored in the memory  134  indicates “ON”. In a case where the WFD flag  138  indicates “ON”, the printer  100  determines YES in S 110 , and proceeds to S 120 . On the other hand, in a case where the WFD flag  138  indicates “OFF”, the printer  100  determines NO in S 110 , and proceeds to S 115 . 
     In S 115 , the printer  100  changes the WFD flag  138  stored in the memory  134  from “OFF” to “ON” (for example, T 606  of  FIG.  8   ). As a result, the printer  100  operates in the device state. 
     In S 120 , the printer  100  shifts from the device state to the G/O state (for example, T 606  of  FIG.  8   ). 
     In S 125 , the printer  100  monitors receipt of a PReq from the terminal  10  via the Wi-Fi I/F  116 . In a case of receiving a PReq from the terminal  10 , the printer  100  determines YES in S 125 , and proceeds to S 130 . On the other hand, in a case where a predetermined time elapses without receiving a PReq from the terminal  10  (for example, T 660  of  FIG.  8   ), the printer  100  determines NO in S 125 , and proceeds to S 132 . 
     In S 130 , the printer  100  executes various communications (Probe, Provision Discovery, Association, WPS Negotiation, 4 way-handshake) according to the WFD scheme with the terminal  10 , and establishes a WFD connection with the terminal  10 . When the process of S 130  is completed, the process of  FIG.  11    is terminated. 
     In S 132 , the printer  100  changes the WFD flag stored in the memory  134  from “ON” to “OFF” (for example, T 662  of  FIG.  8   ). When the process of S 132  is completed, the process of  FIG.  11    is terminated. 
     In S 135 , the printer  100  supplies the WFD information and the BS information to the NFC I/F  118  (for example, T 105  of  FIG.  3   ). The BS information includes the public key of the printer  100 , the channel list, and the MAC address of the printer  100 . 
     S 140  and S 145  are similar to S 110  and S 115 . In S 150 , the printer  100  shifts from the device state to the G/O state, and shifts from the non-respondent state to the respondent state (for example, T 106  and T 108  of  FIG.  3   ). 
     S 155  is similar to S 125 . In case of receiving a PReq from the terminal  10  via the Wi-Fi I/F  116  (for example, T 522  of  FIG.  7   ), the printer  100  determines YES in S 155 , and proceeds to S 160 . On the other hand, in case of receiving an AReq from the terminal  10  via the Wi-Fi I/F  116  (for example, T 210  of  FIG.  4   ), the printer  100  determines NO in S 155 , and proceeds to S 170 . 
     S 160  is similar to S 130 . In S 165 , the printer  100  shifts from the respondent state to the non-respondent state (for example, T 540  of  FIG.  7   ). When the process of S 165  is completed, the process of  FIG.  11    is terminated. 
     In S 170 , the printer  100  executes the Auth and the Config with the terminal  10  (for example,  FIG.  4    and  FIG.  5   ), and executes the NA and 4 way-handshake with the AP  6  (for example,  FIG.  6   , T 40  of  FIG.  2   ) to establish a DPP connection with the AP  6 . 
     In S 175 , the printer  100  changes the WFD flag stored in the memory  134  from “ON” to “OFF”. When the process of S 175  is completed, the process of  FIG.  11    is terminated. 
     Effect of the Present Embodiment 
     According to the present embodiment, the printer  100  supplies the BS information including the public key PPK 1  of the printer  100 , and the WFD information including the SSID “wfd” to the NFC I/F  118  (T 105  of  FIG.  3   ). As a result, in a case where an NFC connection with the printer  100  is established (T 104  of  FIG.  3   ), the terminal  10  receives the BS information and the WFD information from the printer  100  (T 110 ), and displays the selection screen (T 112 ). In a case where the “AP” button in the selection screen is selected by the user (T 120 ), that is, in a case of determining that a DPP connection is to be established between the printer  100  and the AP  6 , the terminal  10  sends an AReq to the printer  100  (T 210  of  FIG.  4   ). In a case of receiving the AReq from the terminal  10 , the printer  100  sends an ARes to the terminal  10  (T 220 ). In a case of receiving the ARes from the printer  100 , the terminal  10  sends a CRes including the CO for printer to the printer  100  (T 310  of  FIG.  5   ). In a case of receiving the CRes from the terminal  10 , the printer  100  establishes a DPP connection between the printer  100  and the AP  6  by using the CO for printer (T 35  and T 40  of  FIG.  2   ). That is, the printer  100  can establish a Wi-Fi connection according to the DPP scheme (that is, a DPP connection) with the AP  6 . On the other hand, in a case where the “terminal” button in the selection screen is selected by the user (T 520  of  FIG.  7   ), that is, in a case of determining that a WFD connection is to be established between the terminal  10  and the printer  100 , the terminal  10  sends a PReq including the SSID “wfd” included in the WFD information to the printer  100  (T 522 ). In a case of receiving the PReq from the terminal  10 , the printer  100  establishes a WFD connection between the terminal  10  and the printer  100  (T 530 ). That is, the printer  100  can establish a WFD connection according to the WFD scheme with the terminal  10 . As such, in response to the establishment of an NFC connection between the printer  100  and the terminal  10 , the printer  100  can establish a DPP connection or a WFD connection different from the NFC connection according to an appropriate connection scheme among plurality of connection schemes. 
     (Correspondence Relationship) 
     The printer  100 , the terminal  10 , the AP  6  are an example of “a communication device”, “a first external device”, “a second external device”, respectively. The NFC I/F  18 , the NFC I/F  118  are an example of “a first wireless interface” of the “first external device”, “a first wireless interface” of the “communication device” respectively, and the Wi-Fi I/F  16  is an example of “a second wireless interface” and “a third wireless interface” of the “first external device”. The Wi-Fi I/F  116  is an example of the “second wireless interface” and “third wireless interface” of the “communication device”. The public key PPK 1 , the SSID “wfd” of the printer  100  are an example of “a first public key (or a public key)”, “specific information”, respectively. The NFC connection of T 104  of  FIG.  3   , the DPP connection of T 40  of  FIG.  2   , the WFD connection of T 530  of  FIG.  7    are an example of “a first wireless connection”, “a second wireless connection”, “a third wireless connection”, respectively. The DPP scheme, the WFD scheme are an example of “first connection scheme”, “second connection scheme”, respectively. The AReq of T 210 , the ARes of T 220 , the CO for printer of  FIG.  4    are an example of “a first authentication request (or an authentication request)”, “a first authentication response (or an authentication response)”, “first connection information (or connection information)”, respectively. The PReq including the SSID “wfd” sent from the terminal  10  in the search process of T 522  is an example of the “specific information”. 
     The print data of T 552  of  FIG.  7    is an example of “object data”. The non-setting mode, the setting mode are an example of “a first mode”, “a second mode”, respectively. The AP information of T 610  of  FIG.  8    is an example of “determination information”. The case where NO is determined in S 20  of  FIG.  10    is an example of “a case where it is determined that the second wireless connection is to be established”, and the case where YES is determined in S 20  is an example of “a case where it is determined that the third wireless connection is to be established”. 
     The process of T 504  of  FIG.  7   , the process of S 135  of  FIG.  11   , the process of T 220  of  FIG.  4   , the process of T 310  of  FIG.  5   , the process of T 35  and T 40  of  FIG.  2   , and the process of T 530  of  FIG.  7    are an example of processes executed by “establish a first wireless connection”, “supply a first public key that is a public key of the communication device and specific information to the first wireless interface”, “send a first authentication response that is a response to the first authentication request to the first external device via the second wireless interface”, “receive first connection information from the first external device via the second wireless interface”, “establish, according to a first connection scheme, the second wireless connection between the communication device and the second external device via the second wireless interface by using the first connection information”, “establish, according to a second connection scheme different from the first connection scheme, the third wireless connection between the communication device and the first external device via the third wireless interface” of the “communication device”, respectively. 
     The process of T 504  of  FIG.  7   , the process of S 10 , the process of S 20  of  FIG.  10   , the process of T 210 , the process of T 220  of  FIG.  4   , the process of T 310  of  FIG.  5   , the process of T 522 , the process of T 530  of  FIG.  7    are an example of processes executed by “establish a first wireless connection”, “receive a public key of the communication device and specific information from the communication device by using the first wireless connection via the first wireless interface”, “determine which of the second wireless connection and the third wireless connection is to be established”, “send an authentication request in which the public key is used to the communication device via the second wireless interface”, “receive an authentication response that is a response to the authentication request from the communication device via the second wireless interface”, “send connection information to the communication device via the second wireless interface”, “send a specific signal including the specific information to the communication device via the third wireless interface”, “establish, according to a second connection scheme different from the first connection scheme, the third wireless connection via the third wireless interface between the communication device and the first external device” of the “first external device”, respectively. 
     Second Embodiment; FIG.  12  and FIG.  13   
     Next, a second embodiment will be described with reference to  FIGS.  12  and  13   . The second embodiment differs from the first embodiment in that the terminal  10  executes the process of  FIG.  12    instead of the process of  FIG.  10   , and the printer  100  executes the process of  FIG.  12    instead of the process of  FIG.  11   . Firstly, the process executed by the CPU  32  of the terminal  10  will be described with reference to  FIG.  12   . 
     S 210  is similar to S 10  of  FIG.  10   . In a case of receiving the WFD information and the BS information from the printer  100 , the terminal  10  determines YES in S 210 , and proceeds to S 215 . S 215  to S 230  are similar to S 15  to S 30  of  FIG.  10   . On the other hand, in a case of receiving a Read Command according to the NFC scheme from the printer  100 , the terminal  10  determines NO in S 210 , and proceeds to S 235 . 
     In S 235 , the terminal  10  supplies, to the NFC I/F  18 , the public key of the terminal  10 , the channel list indicating the plurality of communication channels determined in advance in the terminal  10  (that is, the plurality of communication channels that can be used by the terminal  10 ), and the MAC address of the terminal  10 . As a result, the NFC I/F  18  sends the public key, the channel list, and the MAC address to the printer  100  by using the established NFC connection. 
     In S 240 , the terminal  10  changes a value of the capability of the terminal  10  from a value indicating that the terminal  10  is capable of operating as the Configurator to a value indicating that the terminal  10  is capable of operating as the Enrollee. 
     In S 245 , the terminal  10  shifts from a non-respondent state to a respondent state. That is, the terminal  10  starts a process of monitoring receipt of an AReq using one communication channel among the plurality of communication channels in the channel list. 
     In S 250 , firstly, the terminal  10  executes the Auth and the Config with the printer  100 . In the Auth, the terminal  10  receives the AReq from the printer  100 , sends an ARes to the printer  100 , receives the Confirm from the printer  100 , and determines to operate as the Enrollee. Further, in the Config, the terminal  10  sends a CReq to the printer  100 , receives a CRes including a CO for terminal from the printer  100 , and stores the CO for terminal for establishing a DPP connection between the terminal  10  and the AP  6 . Next, by using the CO for terminal, the terminal  10  executes the NA with the AP  6 , shares, with the AP  6 , a connection key for establishing a DPP connection with the AP  6 , executes a 4 way-handshake with the AP  6 , and establishes a DPP connection with the AP  6 . When the process of S 250  is completed, the process of  FIG.  12    is terminated. 
     (Process of Printer;  FIG.  13   ) 
     Next, a process executed by the CPU  132  of the printer  100  will be described with reference to  FIG.  13   . S 300  is similar to S 100  of  FIG.  11   . The printer  100  proceeds to S 305  in a case of determining that a normal Wi-Fi connection with the AP  6  is being established (YES in S 300 ). On the other hand, the printer  100  proceeds to S 335  in a case of determining that a normal Wi-Fi connection with the AP  6  is not being established (NO in S 300 ). S 335  to S 375  are similar to S 135  to S 175  of  FIG.  11   . 
     In S 305 , the printer  100  changes a value of the capability of the printer  100  from the value indicating that the printer  100  is capable of operating as the Enrollee to the value indicating that the printer  100  is capable of operating as the Configurator. 
     In S 310 , the printer  100  causes the NFC I/F  118  to send a Read Command. As a result, the NFC I/F  118  sends the Read Command to the terminal  10  by using the established NFC connection. 
     In S 315 , the printer  100  receives the public key, the channel list, and the MAC address of the terminal  10  from the terminal  10  via the NFC I/F  118 . 
     In S 320 , the printer  100  executes the Auth and the Config with the terminal  10 . In the Auth, the printer  100  sends an AReq to the terminal  10 , receives an ARes from the terminal  10 , sends the Confirm to the terminal  10 , and determines to operate as the Configurator. Further, in the Config, the printer  100  receives a CReq from the terminal  10 , creates a CO for terminal, and sends a CRes including the CO for terminal to the terminal  10 . When the process of S 320  is completed, the process of  FIG.  13    is terminated. 
     Effect of the Present Embodiment 
     In this embodiment, in a case of determining that a normal Wi-Fi connection with the AP  6  is being established (YES in S 300 ), the printer  100  sends a Read Command to the terminal  10  via the NFC I/F  118  (S 310 ), receives the public key, the channel list, and the MAC address of the terminal  10  from the terminal  10  (S 315 ), executes the Auth and the Config with the terminal  10  via the Wi-Fi I/F  116 , and sends the CO for terminal to the terminal  10  (S 320 ). As a result, the terminal  10  can receive the CO for terminal from the printer  100 , execute an NA with the AP  6  by using the CO for terminal, and execute a 4 way-handshake with the AP  6  to establish a DPP connection with the AP  6 . Due to this, the printer  100  becomes capable of executing communication with the terminal  10  via the AP  6 . 
     (Correspondence Relationship) 
     The public key of the terminal  10  of S 315  of  FIG.  13    is an example of “a second public key”. The AReq sent from the printer  100  to the terminal  10  and the ARes sent from the terminal  10  to the printer  100  in the Auth of S 320  are an example of “a second authentication request”, “a second authentication response”, respectively. The CO for terminal is an example of “second connection information”. 
     (Variant 1) In T 35  of  FIG.  2   , the process of NA may be executed between the terminal  10  and the printer  100  to establish a DPP connection between the terminal  10  and the printer  100 . That is, “a second external device” may be the same device as the “first external device”. 
     (Variant 2) In the above embodiments, the terminal  10  is used to establish a DPP connection between the printer  100  and the AP  6 . Alternatively, for example, the terminal  10  may be used to establish a DPP connection between the printer  100  and another device operating as the G/O (that is, a device operating as a parent station). Further, for example, the terminal  10  may be used to establish a DPP connection between the printer  100  operating as the G/O (that is, a device operating as a parent station) and another device (that is, a device operating as a child station). That is, the “second external device” may not be “an access point”. 
     (Variant 3) The terminal  10  and the printer  100  may further comprise a BT I/F for executing a wireless communication according to the Bluetooth (registered trademark, hereinbelow termed simply as “BT”) scheme. The above BT scheme includes BT scheme version 4.0 and above (so-called Blue Tooth Low Energy). In this case, for example, in T 105  of  FIG.  3   , the printer  100  supplies, instead of the WFD information, BT information for establishing a wireless connection according to the BT scheme (hereinbelow termed simply as “BT connection”) to the NFC I/F  118 . As a result, the NFC I/F  118  sends the BT information and the BS information to the terminal  10  by using the NFC connection. In a case of receiving the BT information and the BS information from the printer  100 , the terminal  10  causes the display unit  14  to display a selection screen in response to the “terminal” button being selected in the selection screen, and establishes a BT connection with the printer  100  by using the received BT information. In the present variant, the BT I/F of the terminal  10  is an example of “a third wireless interface” of the “first external device”, and the BT I/F of the printer  100  is an example of “a third wireless interface” of the “communication device”. Further, the BT scheme, and the BT connection are an example of “a second connection scheme”, “a third wireless connection”, respectively. 
     (Variant 4) The printer  100  may also operate in the setting mode in a case where a normal Wi-Fi connection with the AP  6  is established. In the present variant, “shift the operation mode of the communication device from a first mode to a second mode”, “supply the specific information and determination information to the first wireless interface” may be omitted. 
     (Variant 5) The process of S 165  of  FIG.  11    (or S 365  of  FIG.  13   ) may be omitted. In the present variant, “shift the operation state of the communication device from the respondent state to the non-respondent state” may be omitted. 
     (Variant 6) The process of S 15  of  FIG.  10    (or S 215  of  FIG.  12   ) may be omitted. In this case, in a case of receiving the WFD information and the BS information from the printer  100 , the terminal  10  may determine whether the public key TPK 2  and the secret key tsk 2  are being stored in the memory  34 , that is, may determine whether the Config with the AP  6  has been executed. In case of determining that the Config with the AP  6  has been executed, the terminal  10  executes the Auth and the Config with the printer  100  in S 30 . On the other hand, in case of determining that the Config with the AP  6  has not been executed, the terminal  10  establishes a WFD connection with the printer  100  in S 25 . In the present variant, the case of determining that the Config with the AP  6  has been executed is an example of “a case where it is determined that the second wireless connection is to be established”, and the case of determining that the Config with the AP  6  has not been executed is an example of “a case where it is determined that the third wireless connection is to be established”. 
     (Variant 7) In S 105  of  FIG.  11   , the printer  100  may supply the MAC address of the printer  100 , instead of the AP information, to the NFC I/F  118 . In a case of receiving the WFD information and the MAC address from the printer  100  via the NFC I/F  18 , the terminal  10  determines that the BS information has not been received from the printer  100  (NO in S 10  of  FIG.  10   ) and, in S 35 , determines whether communication with the printer  100  is currently possible by using the received MAC address. Specifically, the terminal  10  firstly determines whether a normal Wi-Fi connection with the AP  6  has been established. In a case of determining that a normal Wi-Fi connection with the AP  6  has not been established, the terminal  10  determines NO in S 35 , and proceeds to S 25 . On the other hand, in a case of determining that a normal Wi-Fi connection with the AP  6  has been established, the terminal  10  sends a request signal by broadcast via the Wi-Fi I/F  16  by using the AP  6 . In response to the sending of the request signal by broadcast, the terminal  10  receives respective response signals to the request signal from each of the one or more devices connected to the AP  6 . In this case, the terminal  10  determines whether a response signal including the received MAC address of the printer  100  is included in the one or more response signals. In a case of determining that the response signal including the MAC address of the printer  100  is included in the one or more response signals, the terminal  10  determines YES in S 35 , and proceeds to S 40 . On the other hand, in a case of determining that the response signal including the MAC address of the printer  100  is not included in the one or more response signals, the terminal  10  determines NO in S 35 , and proceeds to S 25 . In the present variant, the MAC address of the printer  100  is an example of the “determination information”. 
     (Variant 8) In the above embodiments, the terminal  10  executed each process according to the app  38 , but may execute the following processes according to the OS program  36 . That is, the terminal  10  establishes an NFC connection with the printer  100 , and receives the WFD information and the BS information from the printer  100  via the NFC I/F  18  according to the OS program  36 . In this case, the terminal  10  determines whether the app  38  has been activated. In a case of determining that the app  38  has not been activated, the terminal  10  determines that a DPP connection is to be established between the printer  100  and the AP  6 , and executes the same processes as in  FIG.  4    and  FIG.  5   . On the other hand, in a case of determining that the app  38  has been activated, the terminal  10  determines that a WFD connection is to be established between the terminal  10  and the AP  6 , and executes the same processes as in T 522  and T 530  of  FIG.  7   . In the present variant, also, in the case of receiving an AReq from the terminal  10 , the printer  100  can send an ARes to the terminal  10 , receive a CRes including the CO for printer from the terminal  10 , and establish a DPP connection with the AP  6  by using the CO for printer. On the other hand, in the case of receiving a PReq including the SSID “wfd” from the terminal  10 , the printer  100  can establish a WFD connection with the terminal  10 . As such, in response to the establishment of the NFC connection between the printer  100  and the terminal  10 , the printer  100  can establish a DPP connection or WFD connection different from the NFC connection according to an appropriate connection scheme among the plurality of connection schemes. 
     (Variant 9) The process (for example, T 202 , T 212  of  FIG.  4   ) for creating the shared key (for example, SK 1 ) is not limited to the process described above according to the ECDH, but may be another process according to the ECDH. Further, the process for creating the shared key is not limited to processes according to the ECDH, and a process according to another scheme (for example, DH (Diffie-Hellman key exchange), etc.) may be executed. Further, in the above embodiments, the digital signatures DSap and DSpr were created according to ECDSA, but may be created according to another scheme (for example, DSA (Digital Signature Algorithm), RAS (Rivest-Shamir-Adleman cryptosystem) etc.). 
     (Variant 10) Instead of the NFC I/F  18 , the terminal  10  may comprise a different wireless interface according to a wireless scheme different from the NFC scheme (for example, BT scheme, TransferJet scheme). In this case, the printer  100  may also comprise, instead of the NFC I/F  118 , a different wireless interface according to the wireless scheme different from the NFC scheme. For example, in T 110  of  FIG.  3    the printer  100  sends the WFD information and the BS information to the terminal  10  via that wireless interface. In the present variant, the different wireless interface according to the wireless scheme different from the NFC scheme is an example of the “first wireless interface”. 
     (Variant 11) For example, instead of operating as the G/O of the WFD scheme, the printer  100  may operate as a so-called Soft AP. In this case, for example, in T 105  of  FIG.  3   , the printer  100  creates an SSID and password used in the wireless network in which the printer  100  operates as the Soft AP, and supplies Soft AP information including the SSID and password to the NFC I/F  118 . As a result, in T 110 , the NFC I/F  118  sends the Soft AP information and the BS information to the NFC I/F  18  by using the established NFC connection. In the present variant, the SSID in the Soft AP information is an example of the “specific information”. 
     (Variant 12) In the case of determining NO in S 155  of  FIG.  11    (or S 355  of  FIG.  13   ), that is, in the case of receiving an AReq from the terminal  10  via the Wi-Fi I/F  116  (for example, T 210  of  FIG.  4   ), the printer  100  may change the WFD flag from “ON” to “OFF” before executing the process of S 170 . In this case, when the process of S 170  (or S 370 ) ends, the printer  100  terminates the process of  FIG.  11    (or  FIG.  13   ). In a situation where an AReq is received from the terminal  10 , the possibility is low of a communication according to the WFD scheme being executed between the terminal  10  and the printer  100 . In such a situation, since the printer  100  changes the WFD flag from “ON” to “OFF”, it is possible to suppress a state in which the WFD flag indicates “ON”, that is, to suppress maintenance of a state in which the printer  100  can operate according to the WFD scheme. 
     (Variant 13) The “communication device” may not be a printer, but may be another device such a scanner, a multi-function peripheral, a portable terminal, a PC, a server, etc. 
     (Variant 14) In each of the above embodiments, the respective processes of  FIGS.  2  to  13    are implemented by software (that is, the app  38 , the program  136 ). Instead of this, one or more of the processes may be implemented by hardware such as a logic circuit.