CryptoKey.xml 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="CryptoKey" inherits="Resource" version="3.4">
  3. <brief_description>
  4. A cryptographic key (RSA).
  5. </brief_description>
  6. <description>
  7. The CryptoKey class represents a cryptographic key. Keys can be loaded and saved like any other [Resource].
  8. They can be used to generate a self-signed [X509Certificate] via [method Crypto.generate_self_signed_certificate] and as private key in [method StreamPeerSSL.accept_stream] along with the appropriate certificate.
  9. [b]Note:[/b] Not available in HTML5 exports.
  10. </description>
  11. <tutorials>
  12. </tutorials>
  13. <methods>
  14. <method name="is_public_only" qualifiers="const">
  15. <return type="bool" />
  16. <description>
  17. Return [code]true[/code] if this CryptoKey only has the public part, and not the private one.
  18. </description>
  19. </method>
  20. <method name="load">
  21. <return type="int" enum="Error" />
  22. <argument index="0" name="path" type="String" />
  23. <argument index="1" name="public_only" type="bool" default="false" />
  24. <description>
  25. Loads a key from [code]path[/code]. If [code]public_only[/code] is [code]true[/code], only the public key will be loaded.
  26. [b]Note:[/b] [code]path[/code] should be a "*.pub" file if [code]public_only[/code] is [code]true[/code], a "*.key" file otherwise.
  27. </description>
  28. </method>
  29. <method name="load_from_string">
  30. <return type="int" enum="Error" />
  31. <argument index="0" name="string_key" type="String" />
  32. <argument index="1" name="public_only" type="bool" default="false" />
  33. <description>
  34. Loads a key from the given [code]string[/code]. If [code]public_only[/code] is [code]true[/code], only the public key will be loaded.
  35. </description>
  36. </method>
  37. <method name="save">
  38. <return type="int" enum="Error" />
  39. <argument index="0" name="path" type="String" />
  40. <argument index="1" name="public_only" type="bool" default="false" />
  41. <description>
  42. Saves a key to the given [code]path[/code]. If [code]public_only[/code] is [code]true[/code], only the public key will be saved.
  43. [b]Note:[/b] [code]path[/code] should be a "*.pub" file if [code]public_only[/code] is [code]true[/code], a "*.key" file otherwise.
  44. </description>
  45. </method>
  46. <method name="save_to_string">
  47. <return type="String" />
  48. <argument index="0" name="public_only" type="bool" default="false" />
  49. <description>
  50. Returns a string containing the key in PEM format. If [code]public_only[/code] is [code]true[/code], only the public key will be included.
  51. </description>
  52. </method>
  53. </methods>
  54. <constants>
  55. </constants>
  56. </class>