### Namespace

# Gck – 1

GObject bindings for PKCS#11

Version | 1
Authors | GCK contributors
License | LGPL-2.0-or-later
Website |
Source | https://gitlab.gnome.org/GNOME/gcr/

#### Build

C headers | `gck/gck.h`
pkg-config files | `gck-1`

#### Dependencies

GObject—2.0 | The base type system library
| Browse documentation
Gio—2.0 | GObject interfaces and objects
| Browse documentation

#### Additional documentation

- About PKCS#11
- Classes Hierarchy

#### Classes

Enumerator | Can be used to enumerate through PKCS#11 objects. It will automatically create sessions as necessary. since: 1
Module | Holds a loaded PKCS#11 module. A PKCS#11 module is a shared library. since: 1
Object | Holds a handle to a PKCS11 object such as a key or certificate. Token objects are stored on the token persistently. Others are transient and are called session objects. since: 1
Password | Represents a password which is requested of the user. since: 1
Session | Represents an open PKCS11 session. since: 1
Slot | Represents a PKCS#11 slot that can contain a token. since: 1

#### Interfaces

ObjectCache | An interface implemented by derived classes of `GckObject` to indicate which attributes they’d like an enumerator to retrieve. since: 1

#### Structs

Attribute | This structure represents a PKCS#11 `CK_ATTRIBUTE`. These attributes contain information about a PKCS#11 object. Use `gck_object_get()` or `gck_object_set()` to set and attributes on an object. since: 1
Attributes | A set of `GckAttribute` structures. since: 1
Builder | A builder for a set of attributes. Add attributes to a builder, and then use `gck_builder_end()` to get the completed `GckAttributes`. since: 1
Mechanism | Represents a mechanism used with crypto operations. since: 1
MechanismInfo | Represents information about a PKCS11 mechanism. since: 1
ModuleInfo | Holds information about the PKCS#11 module. since: 1
SessionInfo | Information about the session. This is analogous to a CK_SESSION_INFO structure. since: 1
SlotInfo | Represents information about a PKCS11 slot. since: 1
TokenInfo | Represents information about a PKCS11 token. since: 1
UriData | Information about the contents of a PKCS#11 URI. Various fields may be `NULL` depending on the context that the URI was parsed for. since: 1

#### Enumerations

BuilderFlags | Flags to be used with a `gck_builder_init_full()` and `gck_builder_new()`. since: 1
Error | Various error codes. All the `CKR_XXX` error codes from PKCS#11 are also relevant error codes. since: 1
UriError | Various error codes used with PKCS#11 URIs. since: 1

#### Bitfields

SessionOptions | Options for creating sessions. since: 1
UriFlags | Which parts of the PKCS#11 URI will be parsed or formatted. These can be combined. since: 1

#### Callbacks

Allocator | An allocator used to allocate data for the attributes in this `GckAttributes` set. since: 1

#### Functions

list_get_boxed_type | since: 1
list_ref_copy | Copy a list of GObject based pointers. All objects in the list will be reffed and the list will be copied. since: 1
list_unref_free | Free a list of GObject based pointers. All objects in the list will be unreffed and then the list itself will be freed. since: 1
mechanisms_check | Check whether all the mechanism types are in the list. since: 1
message_from_rv | Get a message for a PKCS#11 return value or error code. Do not pass `CKR_OK` or other non-errors to this function. since: 1
modules_enumerate_objects | Setup an enumerator for listing matching objects on the modules. since: 1
modules_enumerate_uri | Enumerate objects that match a URI. since: 1
modules_get_slots | Get a list of slots for across all of the modules. since: 1
modules_initialize_registered | Load and initialize all the registered modules. since: 1
modules_initialize_registered_async | Load and initialize all the registered modules asynchronously. since: 1
modules_initialize_registered_finish | Finishes the asynchronous operation to initialize the registered PKCS#11 modules. since: 1
modules_object_for_uri | Find an object that matches a URI. since: 1
modules_objects_for_uri | Find objects that match a URI. since: 1
modules_token_for_uri | Lookup a token that matches the URI. since: 1
modules_tokens_for_uri | Lookup a token that matches the URI. since: 1
objects_from_handle_array | Initialize a list of GckObject from raw PKCS#11 handles. The handles argument must contain contiguous CK_OBJECT_HANDLE handles in an array. since: 1
slots_enumerate_objects | Setup an enumerator for listing matching objects on the slots. since: 1
string_from_chars | Create a string from a set of PKCS#11 characters. This is similar to `g_strndup()`, except for that it also strips trailing spaces. These space padded strings are often used in PKCS#11 structures. since: 1
string_to_chars | Create a space padded PKCS#11 string from a null terminated string. The string must be shorter than the buffer or `FALSE` will be returned. since: 1
uri_build | Build a PKCS#11 URI. The various parts relevant to the flags specified will be used to build the URI. since: 1
uri_parse | Parse a PKCS#11 URI for use in a given context. since: 1
value_to_boolean | Convert `CK_BBOOL` type memory to a boolean. since: 1
value_to_ulong | Convert `CK_ULONG` type memory to a boolean. since: 1

#### Function Macros

CHECK_VERSION | Checks the version of the Gck library that is being compiled against. since: 1
mechanisms_at | Get a specific mechanism in a the set. since: 1
mechanisms_length | Get the number of GckMechanismInfo in the set. since: 1

#### Constants

INVALID | Used as a terminator at the end of variable argument lists. since: 1
MAJOR_VERSION | The major version number of the Gck library. since: 1
MICRO_VERSION | The micro version number of the Gck library. since: 1
MINOR_VERSION | The minor version number of the Gck library. since: 1
URI_FOR_MODULE_WITH_VERSION | The URI will match specific version of modules. To be used as a GckUriFlags argument. since: 1
URI_FOR_OBJECT_ON_TOKEN | The URI will match objects on a specific token. To be used as a GckUriFlags argument. since: 1
URI_FOR_OBJECT_ON_TOKEN_AND_MODULE | The token inserted into a device with a specific module. since: 1
VENDOR_CODE | Custom PKCS#11 errors that originate from the gck library, are based at this error code. since: 1