Skip to content

PackageVerifier

Inherits: Resource

Verify cryptographic signatures on packages

Description

Provides method for validating cryptographic signatures on packages to ensure only valid packages are loaded.

Properties

Type Name Default
String public_key "res://assets/crypto/keys/opengamepadui.pub"
Crypto crypto
CryptoKey pubkey
CustomLogger logger

Methods

Returns Signature
bool has_valid_signature(data: PackedByteArray, signature: PackedByteArray)
bool file_has_valid_signature(path: String, signature: PackedByteArray)
PackedByteArray get_hash(data: PackedByteArray, type: int = 2)
String get_hash_string(data: PackedByteArray, type: int = 2)
PackedByteArray get_file_hash(path: String, type: int = 2)
String get_file_hash_string(path: String, type: int = 2)

Property Descriptions

public_key

String public_key = "res://assets/crypto/keys/opengamepadui.pub"

Path to the public key used to verify signatures

crypto

Crypto crypto

Note

There is currently no description for this property. Please help us by contributing one!

pubkey

CryptoKey pubkey

Note

There is currently no description for this property. Please help us by contributing one!

logger

CustomLogger logger

Note

There is currently no description for this property. Please help us by contributing one!


Method Descriptions

has_valid_signature()

bool has_valid_signature(data: PackedByteArray, signature: PackedByteArray)

Returns true if the given data matches the given signature data.

file_has_valid_signature()

bool file_has_valid_signature(path: String, signature: PackedByteArray)

Loads the file at the given path and returns true if its contents match the given signature.

get_hash()

PackedByteArray get_hash(data: PackedByteArray, type: int = 2)

Returns the hash of the given data

get_hash_string()

String get_hash_string(data: PackedByteArray, type: int = 2)

Get the hash of the given data as a hex encoded string

get_file_hash()

PackedByteArray get_file_hash(path: String, type: int = 2)

Returns the hash of the file at the given path

get_file_hash_string()

String get_file_hash_string(path: String, type: int = 2)

Get the hash of the file at the given path as a hex encoded string