class_cryptokey.rst 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/CryptoKey.xml.
  6. .. _class_CryptoKey:
  7. CryptoKey
  8. =========
  9. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. A cryptographic key (RSA or elliptic-curve).
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. The CryptoKey class represents a cryptographic key. Keys can be loaded and saved like any other :ref:`Resource<class_Resource>`.
  15. They can be used to generate a self-signed :ref:`X509Certificate<class_X509Certificate>` via :ref:`Crypto.generate_self_signed_certificate<class_Crypto_method_generate_self_signed_certificate>` and as private key in :ref:`StreamPeerTLS.accept_stream<class_StreamPeerTLS_method_accept_stream>` along with the appropriate certificate.
  16. .. rst-class:: classref-introduction-group
  17. Tutorials
  18. ---------
  19. - :doc:`SSL certificates <../tutorials/networking/ssl_certificates>`
  20. .. rst-class:: classref-reftable-group
  21. Methods
  22. -------
  23. .. table::
  24. :widths: auto
  25. +---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`bool<class_bool>` | :ref:`is_public_only<class_CryptoKey_method_is_public_only>`\ (\ ) |const| |
  27. +---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`load<class_CryptoKey_method_load>`\ (\ path\: :ref:`String<class_String>`, public_only\: :ref:`bool<class_bool>` = false\ ) |
  29. +---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`load_from_string<class_CryptoKey_method_load_from_string>`\ (\ string_key\: :ref:`String<class_String>`, public_only\: :ref:`bool<class_bool>` = false\ ) |
  31. +---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`save<class_CryptoKey_method_save>`\ (\ path\: :ref:`String<class_String>`, public_only\: :ref:`bool<class_bool>` = false\ ) |
  33. +---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`String<class_String>` | :ref:`save_to_string<class_CryptoKey_method_save_to_string>`\ (\ public_only\: :ref:`bool<class_bool>` = false\ ) |
  35. +---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. .. rst-class:: classref-section-separator
  37. ----
  38. .. rst-class:: classref-descriptions-group
  39. Method Descriptions
  40. -------------------
  41. .. _class_CryptoKey_method_is_public_only:
  42. .. rst-class:: classref-method
  43. :ref:`bool<class_bool>` **is_public_only**\ (\ ) |const| :ref:`🔗<class_CryptoKey_method_is_public_only>`
  44. Returns ``true`` if this CryptoKey only has the public part, and not the private one.
  45. .. rst-class:: classref-item-separator
  46. ----
  47. .. _class_CryptoKey_method_load:
  48. .. rst-class:: classref-method
  49. :ref:`Error<enum_@GlobalScope_Error>` **load**\ (\ path\: :ref:`String<class_String>`, public_only\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_CryptoKey_method_load>`
  50. Loads a key from ``path``. If ``public_only`` is ``true``, only the public key will be loaded.
  51. \ **Note:** ``path`` should be a "\*.pub" file if ``public_only`` is ``true``, a "\*.key" file otherwise.
  52. .. rst-class:: classref-item-separator
  53. ----
  54. .. _class_CryptoKey_method_load_from_string:
  55. .. rst-class:: classref-method
  56. :ref:`Error<enum_@GlobalScope_Error>` **load_from_string**\ (\ string_key\: :ref:`String<class_String>`, public_only\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_CryptoKey_method_load_from_string>`
  57. Loads a key from the given ``string_key``. If ``public_only`` is ``true``, only the public key will be loaded.
  58. .. rst-class:: classref-item-separator
  59. ----
  60. .. _class_CryptoKey_method_save:
  61. .. rst-class:: classref-method
  62. :ref:`Error<enum_@GlobalScope_Error>` **save**\ (\ path\: :ref:`String<class_String>`, public_only\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_CryptoKey_method_save>`
  63. Saves a key to the given ``path``. If ``public_only`` is ``true``, only the public key will be saved.
  64. \ **Note:** ``path`` should be a "\*.pub" file if ``public_only`` is ``true``, a "\*.key" file otherwise.
  65. .. rst-class:: classref-item-separator
  66. ----
  67. .. _class_CryptoKey_method_save_to_string:
  68. .. rst-class:: classref-method
  69. :ref:`String<class_String>` **save_to_string**\ (\ public_only\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_CryptoKey_method_save_to_string>`
  70. Returns a string containing the key in PEM format. If ``public_only`` is ``true``, only the public key will be included.
  71. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  72. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  73. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  74. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  75. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  76. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  77. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  78. .. |void| replace:: :abbr:`void (No return value.)`