@khm @silverwizard You either need a second layer of authenticated encryption inside the TLS with unauthenticated key, or you need some sort of coupling between the layers (I would deem this very bad design) where you go back and look at the key the TLS session was established with and validate it based on data communicated at the application layer, before transferring anything sensitive.
I deem this *extremely* bad security design, because it means the application layer is parsing protocol data from an untrusted source, and now is attack surface not just for a malicious server, but for any MITM actor.
In any case, it's also incompatible with the document request model of the web. Which you might deem to be a bad model, but it's what we have.