Files
godot-docs-l10n/classes/fr/class_tlsoptions.rst
2025-12-19 14:34:07 +01:00

195 lines
12 KiB
ReStructuredText
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

:github_url: hide
.. _class_TLSOptions:
TLSOptions
==========
**Hérite de:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
Configuration TLS pour des clients et des serveurs.
.. rst-class:: classref-introduction-group
Description
-----------
TLSOptions abstrait les options de configuration pour les classes :ref:`StreamPeerTLS<class_StreamPeerTLS>` et :ref:`PacketPeerDTLS<class_PacketPeerDTLS>`.
Les objets de cette classe ne peuvent être instanciés directement, et l'une des méthodes statiques :ref:`client()<class_TLSOptions_method_client>`, :ref:`client_unsafe()<class_TLSOptions_method_client_unsafe>` ou :ref:`server()<class_TLSOptions_method_server>` devraient être utilisées à la place.
.. tabs::
.. code-tab:: gdscript
# Créer une configuration de client TLS qui utilise notre chaîne de CA approuvée personnalisée.
var cas_approuves_client = load("res://mes_cas_approuves.crt")
var options_tls_client = TLSOptions.client(cas_approuves_client)
# Créer une configuration de serveur TLS.
var certificats_serveur = load("res://mes_cas_serveur.crt")
var cle_serveur = load("res://ma_cle_serveur.key")
var options_tls_serveur = TLSOptions.server(cle_serveur, certificats_serveur)
.. rst-class:: classref-reftable-group
Méthodes
----------------
.. table::
:widths: auto
+-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`TLSOptions<class_TLSOptions>` | :ref:`client<class_TLSOptions_method_client>`\ (\ trusted_chain\: :ref:`X509Certificate<class_X509Certificate>` = null, common_name_override\: :ref:`String<class_String>` = ""\ ) |static| |
+-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`TLSOptions<class_TLSOptions>` | :ref:`client_unsafe<class_TLSOptions_method_client_unsafe>`\ (\ trusted_chain\: :ref:`X509Certificate<class_X509Certificate>` = null\ ) |static| |
+-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`get_common_name_override<class_TLSOptions_method_get_common_name_override>`\ (\ ) |const| |
+-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`X509Certificate<class_X509Certificate>` | :ref:`get_own_certificate<class_TLSOptions_method_get_own_certificate>`\ (\ ) |const| |
+-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`CryptoKey<class_CryptoKey>` | :ref:`get_private_key<class_TLSOptions_method_get_private_key>`\ (\ ) |const| |
+-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`X509Certificate<class_X509Certificate>` | :ref:`get_trusted_ca_chain<class_TLSOptions_method_get_trusted_ca_chain>`\ (\ ) |const| |
+-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_server<class_TLSOptions_method_is_server>`\ (\ ) |const| |
+-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_unsafe_client<class_TLSOptions_method_is_unsafe_client>`\ (\ ) |const| |
+-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`TLSOptions<class_TLSOptions>` | :ref:`server<class_TLSOptions_method_server>`\ (\ key\: :ref:`CryptoKey<class_CryptoKey>`, certificate\: :ref:`X509Certificate<class_X509Certificate>`\ ) |static| |
+-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Descriptions des méthodes
--------------------------------------------------
.. _class_TLSOptions_method_client:
.. rst-class:: classref-method
:ref:`TLSOptions<class_TLSOptions>` **client**\ (\ trusted_chain\: :ref:`X509Certificate<class_X509Certificate>` = null, common_name_override\: :ref:`String<class_String>` = ""\ ) |static| :ref:`🔗<class_TLSOptions_method_client>`
Creates a TLS client configuration which validates certificates and their common names (fully qualified domain names).
You can specify a custom ``trusted_chain`` of certification authorities (the default CA list will be used if ``null``), and optionally provide a ``common_name_override`` if you expect the certificate to have a common name other than the server FQDN.
\ **Note:** On the Web platform, TLS verification is always enforced against the CA list of the web browser. This is considered a security feature.
.. rst-class:: classref-item-separator
----
.. _class_TLSOptions_method_client_unsafe:
.. rst-class:: classref-method
:ref:`TLSOptions<class_TLSOptions>` **client_unsafe**\ (\ trusted_chain\: :ref:`X509Certificate<class_X509Certificate>` = null\ ) |static| :ref:`🔗<class_TLSOptions_method_client_unsafe>`
Creates an **unsafe** TLS client configuration where certificate validation is optional. You can optionally provide a valid ``trusted_chain``, but the common name of the certificates will never be checked. Using this configuration for purposes other than testing **is not recommended**.
\ **Note:** On the Web platform, TLS verification is always enforced against the CA list of the web browser. This is considered a security feature.
.. rst-class:: classref-item-separator
----
.. _class_TLSOptions_method_get_common_name_override:
.. rst-class:: classref-method
:ref:`String<class_String>` **get_common_name_override**\ (\ ) |const| :ref:`🔗<class_TLSOptions_method_get_common_name_override>`
Returns the common name (domain name) override specified when creating with :ref:`client()<class_TLSOptions_method_client>`.
.. rst-class:: classref-item-separator
----
.. _class_TLSOptions_method_get_own_certificate:
.. rst-class:: classref-method
:ref:`X509Certificate<class_X509Certificate>` **get_own_certificate**\ (\ ) |const| :ref:`🔗<class_TLSOptions_method_get_own_certificate>`
Returns the :ref:`X509Certificate<class_X509Certificate>` specified when creating with :ref:`server()<class_TLSOptions_method_server>`.
.. rst-class:: classref-item-separator
----
.. _class_TLSOptions_method_get_private_key:
.. rst-class:: classref-method
:ref:`CryptoKey<class_CryptoKey>` **get_private_key**\ (\ ) |const| :ref:`🔗<class_TLSOptions_method_get_private_key>`
Returns the :ref:`CryptoKey<class_CryptoKey>` specified when creating with :ref:`server()<class_TLSOptions_method_server>`.
.. rst-class:: classref-item-separator
----
.. _class_TLSOptions_method_get_trusted_ca_chain:
.. rst-class:: classref-method
:ref:`X509Certificate<class_X509Certificate>` **get_trusted_ca_chain**\ (\ ) |const| :ref:`🔗<class_TLSOptions_method_get_trusted_ca_chain>`
Returns the CA :ref:`X509Certificate<class_X509Certificate>` chain specified when creating with :ref:`client()<class_TLSOptions_method_client>` or :ref:`client_unsafe()<class_TLSOptions_method_client_unsafe>`.
.. rst-class:: classref-item-separator
----
.. _class_TLSOptions_method_is_server:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **is_server**\ (\ ) |const| :ref:`🔗<class_TLSOptions_method_is_server>`
Returns ``true`` if created with :ref:`server()<class_TLSOptions_method_server>`, ``false`` otherwise.
.. rst-class:: classref-item-separator
----
.. _class_TLSOptions_method_is_unsafe_client:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **is_unsafe_client**\ (\ ) |const| :ref:`🔗<class_TLSOptions_method_is_unsafe_client>`
Returns ``true`` if created with :ref:`client_unsafe()<class_TLSOptions_method_client_unsafe>`, ``false`` otherwise.
.. rst-class:: classref-item-separator
----
.. _class_TLSOptions_method_server:
.. rst-class:: classref-method
:ref:`TLSOptions<class_TLSOptions>` **server**\ (\ key\: :ref:`CryptoKey<class_CryptoKey>`, certificate\: :ref:`X509Certificate<class_X509Certificate>`\ ) |static| :ref:`🔗<class_TLSOptions_method_server>`
Creates a TLS server configuration using the provided ``key`` and ``certificate``.
\ **Note:** The ``certificate`` should include the full certificate chain up to the signing CA (certificates file can be concatenated using a general purpose text editor).
.. |virtual| replace:: :abbr:`virtual (Cette méthode doit typiquement être redéfinie par l'utilisateur pour avoir un effet.)`
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
.. |const| replace:: :abbr:`const (Cette méthode n'a pas d'effets de bord. Elle ne modifie aucune des variables membres de l'instance.)`
.. |vararg| replace:: :abbr:`vararg (Cette méthode accepte n'importe quel nombre d'arguments après ceux décris ici.)`
.. |constructor| replace:: :abbr:`constructor (Cette méthode est utilisée pour construire un type.)`
.. |static| replace:: :abbr:`static (Cette méthode n'a pas besoin d'instance pour être appelée, elle peut donc être directement appelée en utilisant le nom de la classe.)`
.. |operator| replace:: :abbr:`operator (Cette méthode décrit un opérateur valide à utiliser avec ce type en tant qu'opérande gauche.)`
.. |bitfield| replace:: :abbr:`BitField (Cette valeur est un nombre entier composé d'un masque de bits des options suivantes.)`
.. |void| replace:: :abbr:`void (Aucune valeur de retour.)`