## JcatContext

JcatContext

## Functions

JcatContext * | jcat_context_new ()
void | jcat_context_add_public_key ()
void | jcat_context_add_public_keys ()
JcatEngine * | jcat_context_get_engine ()
void | jcat_context_set_keyring_path ()
const gchar * | jcat_context_get_keyring_path ()
JcatResult * | jcat_context_verify_blob ()
GPtrArray * | jcat_context_verify_item ()

## Types and Values

#define | JCAT_TYPE_CONTEXT
struct | JcatContextClass
| JcatContext

## 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 automartically if requried.

#### 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_kind=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

## 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;