| > Yes, but the packet replay protection is due to the sequence number of the packet that happens after the session is established. The TLS does not use pre-shared keys. Instead, every time a client establishes a new connection, there is a "key exchange" phase. Here is a simplified explanation: 1. client generates a random number, does some math on it, encrypts with server's certifcate, and sends to server; 2. server generates another random number, does some math on it, and sends to client. 3. after more math (see https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exc... ), both client and server get the session key. If the exchange was not tampered with, both client and server get the same session key. 4. client and server exchange messages encrypted with session key. If they both have the same session key, they will be able to decrypt the message properly; otherwise, the connection is closed. 5. Now client can send a command, such as "open door" The reason replay protection works is because every time session is established, the server will choose a different random number in step 2. So if you try to replay, then step 3 will generate different session keys, and step 4 will fail. Once the connection is established, there is a separate counter for replay protection, but it does not have to be complicated -- because we know that the session key is unique to this session alone. This is how TLS / DTLS / QUIC do replay protection. Do you agree that these protocols are fully replay-protected? |