While there are detail differences between SSL and TLS the following descriptions apply to both protocols.
Note: SSLv2 was banned by RFC 6176 which contains a dire list of its shortcomings.
You can either buy an SSL (X.509) certificate or generate your own (a self-signed certificate) for testing or, depending on the application, even in a production environment.
All references to SSL below are retained for reasons of common usage (the term is still more frequently used than TLS) but should be simultaneously translated by the reader into TLS.
In the case of HTTPS the well-known port number is 443, in the case of IMAPS - port 993, POP3S - port 995 etc..
The next level of description requires some familiarity with the terms MAC (Message Authentication Code), Secure hashes, symmetric and asymmetric cryptographic algorithms.
And if your eyes glaze over when people start talking about SSL, security and certificates - start glazing now. The RFC hyperlinks in the page below link to a plain text version which was copied to our site when the RFC was issued.
We started doing this a long, long time ago when RFCs were maintained in some strange places, occasionally moved location, and performance and reliability of the repositories was very variable (being generous). The IETF, like IANA, have solid web sites with excellent performance and continually improving features.
This is a survival guide to the eye-glazing topic of TLS/SSL and X.509 (SSL) certificates - including self-signed certificates.