I am currently learning about networks and network security. As an exercise I created an application similar to Apple's AirDrop. Like AirDrop my application discovers peers (yet only in the same wifi network) and establishes a connection to share files. It all works great, however my application relies on a plain TCP connection and transferred data is not encrypted!! From some research I learned that AirDrop uses TLS to encrypt data.
My Question is, how is this possible in a peer to peer network connection? Doesn't TLS require a certificate issued by a CA? Does that mean that whenever a user activates AirDrop a certificate must be created?
How would one incorporate TLS in such an application where you could be the client (when accepting a file) or be the server (when sharing a file)?