ssl_certificates.rst 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. .. _doc_ssl_certificates:
  2. SSL certificates
  3. ================
  4. Introduction
  5. ------------
  6. It is often desired to use SSL connections for communications to avoid
  7. "man in the middle" attacks. Godot has a connection wrapper,
  8. :ref:`StreamPeerSSL <class_StreamPeerSSL>`,
  9. which can take a regular connection and add security around it. The
  10. :ref:`HTTPClient <class_HTTPClient>`
  11. class also supports HTTPS by using this same wrapper.
  12. Godot includes SSL certificates from Mozilla, but you can provide your own
  13. with a .crt file in the project settings:
  14. .. image:: img/ssl_certs.png
  15. This file should contain any number of public certificates in
  16. `PEM format <https://en.wikipedia.org/wiki/Privacy-enhanced_Electronic_Mail>`__.
  17. Of course, remember to add .crt as filter so the exporter recognizes
  18. this when exporting your project.
  19. .. image:: img/add_crt.png
  20. There are two ways to obtain certificates:
  21. Approach 1: self signed cert
  22. ----------------------------
  23. The first approach is the simplest: generate a private and public
  24. key pair and add the public key (in PEM format) to the .crt file.
  25. The private key should go to your server.
  26. OpenSSL has `some
  27. documentation <https://raw.githubusercontent.com/openssl/openssl/master/doc/HOWTO/keys.txt>`__ about
  28. this. This approach also **does not require domain validation** nor
  29. requires you to spend a considerable amount of money in purchasing
  30. certificates from a CA.
  31. Approach 2: CA cert
  32. -------------------
  33. The second approach consists of using a certificate authority (CA)
  34. such as Verisign, Geotrust, etc. This is a more cumbersome process,
  35. but it's more "official" and ensures your identity is clearly
  36. represented.
  37. Unless you are working with large companies or corporations, or need
  38. to connect to someone else's servers (i.e., connecting to Google or some
  39. other REST API provider via HTTPS), this method is not as useful.
  40. Also, when using a CA issued cert, **you must enable domain
  41. validation**, to ensure the domain you are connecting to is the one
  42. intended, otherwise any website can issue any certificate in the same CA
  43. and it will work.
  44. If you are using Linux, you can use the supplied certs file, generally
  45. located in:
  46. .. code-block:: none
  47. /etc/ssl/certs/ca-certificates.crt
  48. This file allows HTTPS connections to virtually any website (i.e.,
  49. Google, Microsoft, etc.).
  50. Or pick any of the more specific certificates there if you are
  51. connecting to a specific one.