-
Notifications
You must be signed in to change notification settings - Fork 2
Security Model
When a the node js server is loaded:
- a cryptographic
server-secret-id
random string is generated - a cryptographic
server-secret
random string is generated
When the home page loads:
- a
server-session-id
random string is generated by the server (and is given to the client javascript) - a
server-session-id-validation
string is generated by the server (and is given to the client javascript) using the following algorithm: hash(server-secret-id
+ ":" +server-session-id
+ ":" +server-secret
) - the previously generated
server-secret-id
is sent to the javascript client - a cryptographic
server-session-salt
random string is generated by the server (and is given to the client javascript) - a cryptographic
server-session-key
random string is generated by the server (and is given to the client javascript) - a cryptographic
client-session-key
random string is generated by the client javascript (which is NOT sent to the server)
NOTE: The server-secret
is NEVER given to the javascript client.
The end-user picks a question from the preset questions (or types their own). The answer is then normalized.
The answer
normalization process:
- strip all pre/post white space from the string
- collapse all white space between words to a single space
- collapse spaces before and after and
-
symbol - make all characters uppercase (or perhaps lowercase; doesn't matter but we have to be consistent)
- remove any trailing punctuation (no
.
or?
) - ensure the minimum 4 character rule is satisfied
NOTE: All of this normalization processing must be done entire on the client side javascript as the server will never receive the answer.
The javascript client must generate proof for the remote party to prove that the remote party's javascript client indeed know the correct answer
.
Generating proof of the correct answer:
answer-proof
= hash("answer:" +server-secret-id
+ ":" +server-session-id
+ ":" +server-session-id-validation
+ ":" +server-session-salt
+ ":" +server-session-key
+client-session-key
)
This proof is used to validate both client know the same answer.
Generate the client-to-client encryption/decryption cipher key:
cipher-key
= hash("cipher:" +server-secret-id
+ ":" +server-session-id
+ ":" +server-session-id-validation
+ ":" +server-session-salt
+ ":" +server-session-key
+client-session-key
)
This cipher key is the master key used to encrypt or decrypt data send between two clients.