Files
godot-docs-l10n/classes/zh_TW/class_cryptokey.rst
Max Hilbrunner 2ba6d25aa9 Revert "Rename zh_CN/zh_TW to zh_Hans/zh_Hant"
This reverts commit 57781dc0bc.
The rename, although in line with what we did in the engine, caused problems with RTD we need to fix (or push for a fix) first.
2025-12-24 07:14:31 +01:00

126 lines
6.3 KiB
ReStructuredText
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

:github_url: hide
.. _class_CryptoKey:
CryptoKey
=========
**繼承:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
A cryptographic key (RSA or elliptic-curve).
.. rst-class:: classref-introduction-group
說明
----
CryptoKey 類表示加密金鑰。金鑰可以像其他任何 :ref:`Resource<class_Resource>` 一樣進行載入和保存。
金鑰可以通過 :ref:`Crypto.generate_self_signed_certificate()<class_Crypto_method_generate_self_signed_certificate>` 生成自簽章的 :ref:`X509Certificate<class_X509Certificate>`\ ,並可作為 :ref:`StreamPeerTLS.accept_stream()<class_StreamPeerTLS_method_accept_stream>` 中相應的憑證的私密金鑰。
.. rst-class:: classref-introduction-group
教學
----
- :doc:`SSL 憑證 <../tutorials/networking/ssl_certificates>`
.. rst-class:: classref-reftable-group
方法
----
.. table::
:widths: auto
+---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_public_only<class_CryptoKey_method_is_public_only>`\ (\ ) |const| |
+---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`load<class_CryptoKey_method_load>`\ (\ path\: :ref:`String<class_String>`, public_only\: :ref:`bool<class_bool>` = false\ ) |
+---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :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\ ) |
+---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`save<class_CryptoKey_method_save>`\ (\ path\: :ref:`String<class_String>`, public_only\: :ref:`bool<class_bool>` = false\ ) |
+---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`save_to_string<class_CryptoKey_method_save_to_string>`\ (\ public_only\: :ref:`bool<class_bool>` = false\ ) |
+---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
方法說明
--------
.. _class_CryptoKey_method_is_public_only:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **is_public_only**\ (\ ) |const| :ref:`🔗<class_CryptoKey_method_is_public_only>`
如果該 CryptoKey 僅具有公開金鑰部分,沒有私密金鑰部分,則返回 ``true``\ 。
.. rst-class:: classref-item-separator
----
.. _class_CryptoKey_method_load:
.. rst-class:: classref-method
:ref:`Error<enum_@GlobalScope_Error>` **load**\ (\ path\: :ref:`String<class_String>`, public_only\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_CryptoKey_method_load>`
從路徑 ``path`` 載入金鑰。如果 ``public_only````true``\ ,將只載入公開金鑰。
\ **注意:**\ 如果 ``public_only````true``\ ,則 ``path`` 應該是“\*.pub”檔否則是“\*.key”檔案。
.. rst-class:: classref-item-separator
----
.. _class_CryptoKey_method_load_from_string:
.. rst-class:: classref-method
: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>`
從給定的 ``string_key`` 載入金鑰。如果 ``public_only````true``\ ,則僅會載入公開金鑰。
.. rst-class:: classref-item-separator
----
.. _class_CryptoKey_method_save:
.. rst-class:: classref-method
:ref:`Error<enum_@GlobalScope_Error>` **save**\ (\ path\: :ref:`String<class_String>`, public_only\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_CryptoKey_method_save>`
將金鑰保存到給定的路徑 ``path``\ 。如果 ``public_only````true``\ ,則只會保存公開金鑰。
\ **注意:**\ 如果 ``public_only````true``\ ,則 ``path`` 應該是“\*.pub”檔否則是“\*.key”檔案。
.. rst-class:: classref-item-separator
----
.. _class_CryptoKey_method_save_to_string:
.. rst-class:: classref-method
:ref:`String<class_String>` **save_to_string**\ (\ public_only\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_CryptoKey_method_save_to_string>`
返回包含 PEM 格式的金鑰的字串。如果 ``public_only````true``\ ,則僅包含公開金鑰。
.. |virtual| replace:: :abbr:`virtual (本方法通常需要使用者覆寫才能生效。)`
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
.. |const| replace:: :abbr:`const (本方法沒有副作用。不會修改該實例的任何成員變數。)`
.. |vararg| replace:: :abbr:`vararg (本方法除了這裡描述的參數外,還可以接受任意數量的參數。)`
.. |constructor| replace:: :abbr:`constructor (本方法用於建構一個型別。)`
.. |static| replace:: :abbr:`static (本方法無需實例即可呼叫,因此可以直接使用類別名稱呼叫。)`
.. |operator| replace:: :abbr:`operator (本方法描述將本型別作為左運算元時可用的有效運算子。)`
.. |bitfield| replace:: :abbr:`BitField (此值是由下列旗標組成的位元遮罩整數。)`
.. |void| replace:: :abbr:`void (無回傳值。)`