:github_url: hide .. Generated automatically by doc/tools/make_rst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the CryptoKey.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_CryptoKey: CryptoKey ========= **Inherits:** :ref:`Resource` **<** :ref:`RefCounted` **<** :ref:`Object` A cryptographic key (RSA). Description ----------- The CryptoKey class represents a cryptographic key. Keys can be loaded and saved like any other :ref:`Resource`. They can be used to generate a self-signed :ref:`X509Certificate` via :ref:`Crypto.generate_self_signed_certificate` and as private key in :ref:`StreamPeerSSL.accept_stream` along with the appropriate certificate. \ **Note:** Not available in HTML5 exports. Methods ------- +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_public_only` **(** **)** |const| | +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Error` | :ref:`load` **(** :ref:`String` path, :ref:`bool` public_only=false **)** | +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Error` | :ref:`load_from_string` **(** :ref:`String` string_key, :ref:`bool` public_only=false **)** | +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Error` | :ref:`save` **(** :ref:`String` path, :ref:`bool` public_only=false **)** | +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`save_to_string` **(** :ref:`bool` public_only=false **)** | +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+ Method Descriptions ------------------- .. _class_CryptoKey_method_is_public_only: - :ref:`bool` **is_public_only** **(** **)** |const| Returns ``true`` if this CryptoKey only has the public part, and not the private one. ---- .. _class_CryptoKey_method_load: - :ref:`Error` **load** **(** :ref:`String` path, :ref:`bool` public_only=false **)** Loads a key from ``path``. If ``public_only`` is ``true``, only the public key will be loaded. \ **Note:** ``path`` should be a "\*.pub" file if ``public_only`` is ``true``, a "\*.key" file otherwise. ---- .. _class_CryptoKey_method_load_from_string: - :ref:`Error` **load_from_string** **(** :ref:`String` string_key, :ref:`bool` public_only=false **)** Loads a key from the given ``string``. If ``public_only`` is ``true``, only the public key will be loaded. ---- .. _class_CryptoKey_method_save: - :ref:`Error` **save** **(** :ref:`String` path, :ref:`bool` public_only=false **)** Saves a key to the given ``path``. If ``public_only`` is ``true``, only the public key will be saved. \ **Note:** ``path`` should be a "\*.pub" file if ``public_only`` is ``true``, a "\*.key" file otherwise. ---- .. _class_CryptoKey_method_save_to_string: - :ref:`String` **save_to_string** **(** :ref:`bool` public_only=false **)** Returns a string containing the key in PEM format. If ``public_only`` is ``true``, only the public key will be included. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`