I am not really sure what the real solution is beyond creating the out of band method of validating the public key. Historically, this would be done by publishing your public gpg key to a 3rd party key server. Most modern apps use a qr code (I don’t know how this works, may require research) you can scan when you physically meet, or scan over a different medium (email, SMS etc).
The problem with relying on the random number is that E can decrypt the message from A, and then reencrypt it and send it to B. B won’t know it has been inspected enroute. So B could call A and tell them the random number, but it wouldnt actually be secure. Also, if later in the chat A were to tell B, “My public key is XYZ”, E could detect that and alter it to " My public key is ABC" before sending it on to B.
If A can generate a hash of the B’s public key, and B also makes a hash, they can call each other and compare, and if the hashes don’t match, E is listening. I think that is all you need, a way to present the public key to the users so they can validate it manually.
Aside, but I don’t think it is a good idea for you to spend money on an audit yet. Spend some time trying to break your own system, by creating the malicious E server. You can then tweak and adjust your scheme until E is either impossible or trivially detectable. Unless this become a large scale venture, an audit isn’t worth it, and I get the impression this is more of a learning exercise for yourself? Also, once you are finalised, write up a paper on your scheme. Something like: https://signal.org/docs/specifications/x3dh/. Crypto experts will be able to easily validate that your scheme based on the paper. Crypto people can easily validate your scheme based on the paper…
I think both solutions are fine, but 2 might be the best usability?
I think those docs are typically called white papers.
Its hard to get past those biases, but its a valuable skill to critically review your own work. And it feels better on your wallet to find bugs before paying for a third party review :)
I’m not an expert in this field, so I have never heard of ProVerif, it definitely looks interesting though, and wouldn’t hurt to try?