Skip to content
0.2.0-dev Download ZIP
54 lines ·2.6 KB Raw
1<?xml version="1.0" encoding="UTF-8" ?>
2<class name="CryptoKey" inherits="Resource" api_type="core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
3 <brief_description>
4 A cryptographic key (RSA or elliptic-curve).
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 StreamPeerTLS.accept_stream] along with the appropriate certificate.
9 </description>
10 <tutorials>
11 <link title="SSL certificates">$DOCS_URL/tutorials/networking/ssl_certificates.html</link>
12 </tutorials>
13 <methods>
14 <method name="is_public_only" qualifiers="const">
15 <return type="bool" />
16 <description>
17 Returns [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 <param index="0" name="path" type="String" />
23 <param index="1" name="public_only" type="bool" default="false" />
24 <description>
25 Loads a key from [param path]. If [param public_only] is [code]true[/code], only the public key will be loaded.
26 [b]Note:[/b] [param path] should be a "*.pub" file if [param public_only] 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 <param index="0" name="string_key" type="String" />
32 <param index="1" name="public_only" type="bool" default="false" />
33 <description>
34 Loads a key from the given [param string_key]. If [param public_only] 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 <param index="0" name="path" type="String" />
40 <param index="1" name="public_only" type="bool" default="false" />
41 <description>
42 Saves a key to the given [param path]. If [param public_only] is [code]true[/code], only the public key will be saved.
43 [b]Note:[/b] [param path] should be a "*.pub" file if [param public_only] is [code]true[/code], a "*.key" file otherwise.
44 </description>
45 </method>
46 <method name="save_to_string">
47 <return type="String" />
48 <param index="0" name="public_only" type="bool" default="false" />
49 <description>
50 Returns a string containing the key in PEM format. If [param public_only] is [code]true[/code], only the public key will be included.
51 </description>
52 </method>
53 </methods>
54</class>