I want to develop an app which allows to pair between pc using bluetooth then you can send the signal from the phone to unlock the PC(on the same network). I need help with the process after bluetooth pairing. My idea is the app on the phone will generate a secret key send to PC for storage. The pc will then encrypt the PIN code using the secret key then send back to the app. Everytime u need to open log in, the app will send the encrypted key to the PC. The PC will then decrypt and allows you to log in. Is it possible to work ? If not, why ?
Your approach is vulnerable to man-in-the-middle attack, if an intruder is listening to the channel, he will be able to get secret key, and he will be able to unlock the PC.
I would suggest using certificate to share your key for this kind of application. An advantage of using the digital certificate is non-repudiation(assuming a user of the app having unlock the PC, he can not deny his/her action he made).