ssl_certificates.rst 2.4 KB

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