JcatContext

JcatContext

Functions

Types and Values

Description

Functions

jcat_context_new ()

JcatContext *
jcat_context_new (void);

Creates a new context.

Returns

a JcatContext

Since: 0.1.0


jcat_context_add_public_key ()

void
jcat_context_add_public_key (JcatContext *self,
                             const gchar *filename);

Adds a single public key.

Parameters

self

JcatContext

 

filename

A filename

 

Since: 0.1.0


jcat_context_add_public_keys ()

void
jcat_context_add_public_keys (JcatContext *self,
                              const gchar *path);

Adds a public key directory.

Parameters

self

JcatContext

 

path

A directory of files

 

Since: 0.1.0


jcat_context_get_engine ()

JcatEngine *
jcat_context_get_engine (JcatContext *self,
                         JcatBlobKind kind,
                         GError **error);

Gets the engine for a specific engine kind, setting up the context automatically if required.

Parameters

self

JcatContext

 

kind

JcatBlobKind, e.g. JCAT_BLOB_KIND_GPG

 

error

GError, or NULL

 

Returns

JcatEngine, or NULL for unavailable.

[transfer full]

Since: 0.1.0


jcat_context_set_keyring_path ()

void
jcat_context_set_keyring_path (JcatContext *self,
                               const gchar *path);

Sets the local state directory for the engines to use.

Parameters

self

JcatContext

 

path

A directory

 

Since: 0.1.0


jcat_context_get_keyring_path ()

const gchar *
jcat_context_get_keyring_path (JcatContext *self);

Gets the local state directory the engines are using.

Parameters

self

JcatContext

 

Returns

path.

[nullable]

Since: 0.1.0


jcat_context_verify_blob ()

JcatResult *
jcat_context_verify_blob (JcatContext *self,
                          GBytes *data,
                          JcatBlob *blob,
                          JcatVerifyFlags flags,
                          GError **error);

Verifies a JcatBlob using the public keys added to the context.

Parameters

self

JcatContext

 

data

GBytes

 

blob

JcatBlob

 

flags

JcatVerifyFlags, e.g. JCAT_VERIFY_FLAG_DISABLE_TIME_CHECKS

 

error

GError, or NULL

 

Returns

JcatResult, or NULL for failed.

[transfer full]

Since: 0.1.0


jcat_context_verify_item ()

GPtrArray *
jcat_context_verify_item (JcatContext *self,
                          GBytes *data,
                          JcatItem *item,
                          JcatVerifyFlags flags,
                          GError **error);

Verifies a JcatItem using the public keys added to the context. All verify=CHECKSUM engines (e.g. SHA256) must verify correctly, but only one non-checksum signature has to verify.

Parameters

self

JcatContext

 

data

GBytes

 

item

JcatItem

 

flags

JcatVerifyFlags, e.g. JCAT_VERIFY_FLAG_REQUIRE_SIGNATURE

 

error

GError, or NULL

 

Returns

array of JcatResult, or NULL for failed.

[transfer container][element-type JcatResult]

Since: 0.1.0


jcat_context_verify_target ()

GPtrArray *
jcat_context_verify_target (JcatContext *self,
                            JcatItem *item_target,
                            JcatItem *item,
                            JcatVerifyFlags flags,
                            GError **error);

Verifies a JcatItem using the target to an item. At least one verify=CHECKSUM (e.g. SHA256) must exist and all checksum types that do exist must verify correctly.

Parameters

self

JcatContext

 

item_target

JcatItem containing checksums of the data

 

item

JcatItem

 

flags

JcatVerifyFlags, e.g. JCAT_VERIFY_FLAG_REQUIRE_SIGNATURE

 

error

GError, or NULL

 

Returns

results, or NULL for failed.

[transfer container][element-type JcatResult]

Since: 0.2.0


jcat_context_blob_kind_allow ()

void
jcat_context_blob_kind_allow (JcatContext *self,
                              JcatBlobKind kind);

Adds a blob kind to the allowlist. By default, JCat will use all signature and checksum schemes compiled in at build time. Once this function has been called only specific blob kinds will be used in functions like jcat_context_verify_blob().

Parameters

Since: 0.1.12


jcat_context_blob_kind_disallow ()

void
jcat_context_blob_kind_disallow (JcatContext *self,
                                 JcatBlobKind kind);

Removes a blob kind from the allowlist. By default, JCat will use all signature and checksum schemes compiled in at build time. Once this function has been called this kind will not be used in functions like jcat_context_verify_blob().

Parameters

Since: 0.1.12

Types and Values

JCAT_TYPE_CONTEXT

#define JCAT_TYPE_CONTEXT jcat_context_get_type()

struct JcatContextClass

struct JcatContextClass {
	GObjectClass parent_class;
	gpointer padding[15];
};

JcatContext

typedef struct _JcatContext JcatContext;