I would like to have a reliable (as in TCP) encrypted (authenticity, integrity, confidentiality) connection between program A and program B. I am the creator of both A and B. I want A to communicate only with B and vice versa. A and B have no malicious intents against each other, so if A says to B that it is A, B can trust it.
Now there are quite a few ways how to do this, including, but not limited to:
- A and B have the same self-signed certificate
- A and B have each their own certificate which is:
- self-signed; in this case A adds B's certificate to its list of certificate authorities and vice versa
- signed by the other party; I believe that each party trusts itself.
- signed by me, a one-man certificate authority, using my private key.
...
Which approach is the best and why?
I am quite new to cryptography in general and I find this very confusing. I am sure that this is a problem that arises frequently in many applications, so I am sure that each approach has its pros and cons, and that quite possibly I didn't even list the best approach. I know that information security is a minefield so any advice is most welcome.