Posted 27 November 2016 - 03:54 AM
I am trying to make a lock program which can be communicated with via Rednet (for this example, a pocket computer), thus the transmission between the two needs to be secure (ie: you can unlock the computer via the pocket computer, just as you would via the computer itself - with the added obstacle of rednet).
To do this, I assume I need to generate a unique key for that pocket computer on the 'host' computer. Then, using a handshake get the same key to the pocket computer. This way, all messages are encrypted and decrypted with the same key.
My issue is that I don't feel this is as secure as the hash being used on the host computer. Right now, the users hashed password is stored in a file, along with the salt used to hash it. Then, when the user tries to 'login', their entry is hashed with the same salt.
However, using encryption opens up the possibility of the message being cracked, or others getting their hands on the secret key. My idea was that when a user entered a password on the pocket computer, it would be encrypted, sent to the host, decrypted, hashed and compared. Then, the host would respond with an encrypted message containing the status (ie: correct/incorrect). Is this the right way to do things?
I also thought that a better/more secure way would be to send the salt used to hash the password to the pocket computer. Then, when a value is entered it is hashed and sent to the host computer, and then a response is returned (correct/incorrect) - eliminating the need for a handshake as the salt doesn't really need to be kept secret (or does it, I don't really know).
This is my first time doing anything like this (hashing/encryption/handshakes/etc), so I may have a lot of core concepts wrong - any help would be appreciated.
To do this, I assume I need to generate a unique key for that pocket computer on the 'host' computer. Then, using a handshake get the same key to the pocket computer. This way, all messages are encrypted and decrypted with the same key.
My issue is that I don't feel this is as secure as the hash being used on the host computer. Right now, the users hashed password is stored in a file, along with the salt used to hash it. Then, when the user tries to 'login', their entry is hashed with the same salt.
However, using encryption opens up the possibility of the message being cracked, or others getting their hands on the secret key. My idea was that when a user entered a password on the pocket computer, it would be encrypted, sent to the host, decrypted, hashed and compared. Then, the host would respond with an encrypted message containing the status (ie: correct/incorrect). Is this the right way to do things?
I also thought that a better/more secure way would be to send the salt used to hash the password to the pocket computer. Then, when a value is entered it is hashed and sent to the host computer, and then a response is returned (correct/incorrect) - eliminating the need for a handshake as the salt doesn't really need to be kept secret (or does it, I don't really know).
This is my first time doing anything like this (hashing/encryption/handshakes/etc), so I may have a lot of core concepts wrong - any help would be appreciated.
Edited on 27 November 2016 - 02:58 AM