Now, I can send data to Nordic board through ble, and I can get the data from it. But , I can not sure that when I disconnect the board, then someone connect the board.
If I use the board to mark my box. When Someone connect the board, he can say that the box is his box.
So, we need safe connect.
Search for Whitelist functionality in InforCenter
You can read more about whitelisting here.
You can try to test with the ble_app_proximity example if you SDK v10 or earlier we demonstrated whitelist in that example. Or have a look at ble_app_keyboard ifyou use SDK v11 and later.
I have read it. I think that, Let the master use public address, and when the slave receive the data, I use a button trig the program, and let the slave remember the public key, and add the address to the whitelisting. I think this is the only method to solve the question. But, I can not know this is the only correct. and I want to know that whether somebody have betters.
Yes, it's the most common solution (note: there is nothing called public key unless you are talking about LESecure connection).
Another solution is to let the application disconnect the connection if the central device can't provide correct "password". For example, the central must write to a characteristic a "code" in the first 30 seconds after connected or it will be disconnected. But this is not very common only used when whitelisting can't be used.