A client is communicating with a server through https using two-way authentication. I would like to add an extra layer of security.
The protocol would look something like :
An 128-bit symmetric key is stored in a file on the server.
Client connects to the server's IP address using https:// and gets access through his client certificate that is trusted by the server.
Client is shown empty html page with one input box in which he has to type the symmetric key, which is then locally stored as a js variable in the browser.
A verification step is done by sending an AES-encrypted message to the server using the client's symmetric key, which the server then decrypts with his version of the symmetric key. If this is successful, the client is given access to the rest of the html.
All subsequent data that is exchanged by the client and the server is being encrypted/decrypted using the symmetric key for AES-CBC.
Two examples of why this extra layer can provide extra security:
- If the attacker gets hold of a certificate that is trusted by the client, and acts as the server. He would not be able to read the messages sent by a client.
- If the attacker gets hold of a certificate that is trusted by the server, he/she would still need to type in the symmetric key.
Am I right about the two examples, and secondly, do you see any flaws / attacks that I am unaware of?
P.S. To clarify: the same symmetric key would be used for every session, as it is the one that is fixed and stored on the server. A random IV is used for each AES-CBC encryption, and is sent along with the encrypted message.