I have a hardware device (H)
, phone (P)
and web server (S)
. I would like P
to be able to send commands to H
, but only if it is authorized to do so. Permissions are stored on server. Technically I could do this with Kerberos, but that seems overkill. The protocol I currently have is the following:
- P requests nonce from H (prevent replay attack)
- H sends nonce to P
- P forwards nonce, along with the command it wants to send to H, to S
- If P has permission to execute the command on H, S sends Encrypt(Nonce|Command) to phone. This is encrypted with a key that H and S share in advance. (P authenticates itself to S with username/password)
- P forwards Encrypt(Nonce|Command) to H.
- H decrypts and verifies nonce. If correct, it executes command.
Is this safe? I know you shouldn't create protocols yourself so I'm curious if this already exists and if it is used in other places?