Just using official signed SSL certificates (for example bought by VerySign, Comodo, StartSSL, …) is kinda safe. These official certificates are issued from a trusted CA (CA - Certificate Authority) - assumed that you install the certificate correctly in your web server/backend application - they are able to encrypt your communication data safely.
But they do not protect against a man in the middle attack. Bad persons / bad governments / the NSA could easily use a proxy (http://mitmproxy.org) or surveillance software together with some fancy DNS spoofing or similar things and decrypt your communication data. They could read / capture your communication data in clear text including passwords or authentication tokens. After doing their evil thing they encrypt your data again and forward this encrypted data to you. They can not encrypt this data with your certificate (except they stole it from you). But they can use another valid trusted certificate from a trusted CA.
iOS or Android and Webbrowsers like Firefox are checking whether the domain you are surfing at is equal to the domain the certificate is issued for. They trust if this is true. Maybe they do some more checks. Unfortunately we know that CA’s have been hacked. Such a bad hacker / bad government / the NSA could easily create valid certificates for domains they do not own. No web browser will complain, the end user will notice nothing about this interception.
But if we are talking about a well coded application with an own backend, then this is, where certificate pinning comes in. Because our application only connects to a specific server it can know the serial number and hash codes of this specific server certificate. A hacker / bad government / the NSA is not able to fake this data in a consistent way. So if we check the server certificate for these values we can be sure that we are not intercepted. Unfortunately this is not possible with Corona SDK because Corona does not includes luasec 0.5 but an earlier version. If you look at the documentation from luasec 0.5 you see that brunoos added support for getting the certificate serial number and checksums (https://github.com/brunoos/luasec/wiki/LuaSec-0.5, cert:serial and cert:digest).
One more thing: A bad hacker / bad government / NSA could save your recorded, encrypted communication data in a file and keep it until they have enough processing power / better encryption breaking / whatever. This is a very real threat because processing power is growing fast and they are even evaluating quantum computers to break encryption (not hackers, government and NSA for sure
). This is where a mechanism called perfect forward secrecy comes in. I will investigate later what Corona SDK can do about this for us.