Table of Contents

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

method godot_string_name

Name of the method to check for.

Returns

bool

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

signal godot_string_name

Name of the signal to check for.

Returns

bool

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

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

IsPublicOnly()

Returns true if this CryptoKey only has the public part, and not the private one.

public bool IsPublicOnly()

Returns

bool

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

path string
publicOnly bool

Returns

Error

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

stringKey string
publicOnly bool

Returns

Error

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

path string
publicOnly bool

Returns

Error

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

publicOnly bool

Returns

string