Class CryptoKey
- Namespace
- Godot
- Assembly
- GodotSharp.dll
The CryptoKey class represents a cryptographic key. Keys can be loaded and saved like any other Resource.
They can be used to generate a self-signed X509Certificate via GenerateSelfSignedCertificate(CryptoKey, string, string, string) and as private key in AcceptStream(StreamPeer, TlsOptions) along with the appropriate certificate.
public class CryptoKey : Resource, IDisposable
- Inheritance
-
CryptoKey
- Implements
- Inherited Members
Constructors
CryptoKey()
public CryptoKey()
Methods
HasGodotClassMethod(in godot_string_name)
Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.
protected override bool HasGodotClassMethod(in godot_string_name method)
Parameters
methodgodot_string_nameName of the method to check for.
Returns
HasGodotClassSignal(in godot_string_name)
Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.
protected override bool HasGodotClassSignal(in godot_string_name signal)
Parameters
signalgodot_string_nameName of the signal to check for.
Returns
InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)
Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.
protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)
Parameters
methodgodot_string_nameName of the method to invoke.
argsNativeVariantPtrArgsArguments to use with the invoked method.
retgodot_variantValue returned by the invoked method.
Returns
IsPublicOnly()
Returns true if this CryptoKey only has the public part, and not the private one.
public bool IsPublicOnly()
Returns
Load(string, bool)
Loads a key from path. If publicOnly is true, only the public key will be loaded.
Note:
path should be a "*.pub" file if publicOnly is true, a "*.key" file otherwise.
public Error Load(string path, bool publicOnly = false)
Parameters
Returns
LoadFromString(string, bool)
Loads a key from the given stringKey. If publicOnly is true, only the public key will be loaded.
public Error LoadFromString(string stringKey, bool publicOnly = false)
Parameters
Returns
Save(string, bool)
Saves a key to the given path. If publicOnly is true, only the public key will be saved.
Note:
path should be a "*.pub" file if publicOnly is true, a "*.key" file otherwise.
public Error Save(string path, bool publicOnly = false)
Parameters
Returns
SaveToString(bool)
Returns a string containing the key in PEM format. If publicOnly is true, only the public key will be included.
public string SaveToString(bool publicOnly = false)
Parameters
publicOnlybool