Gck – 2
Description: Reference for Gck-2

### Namespace

# Gck – 2

GObject bindings for PKCS#11

Version | 2
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-2`

#### 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: 2
Module | Holds a loaded PKCS#11 module. A PKCS#11 module is a shared library. since: 2
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: 2
Password | Represents a password which is requested of the user. since: 2
Session | Represents an open PKCS11 session. since: 2
Slot | Represents a PKCS#11 slot that can contain a token. since: 2

#### Interfaces

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

#### 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: 2
Attributes | A set of `GckAttribute` structures. since: 2
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: 2
Mechanism | Represents a mechanism used with crypto operations. since: 2
MechanismInfo | Represents information about a PKCS11 mechanism. since: 2
ModuleInfo | Holds information about the PKCS#11 module. since: 2
SessionInfo | Information about the session. This is analogous to a CK_SESSION_INFO structure. since: 2
SlotInfo | Represents information about a PKCS11 slot. since: 2
TokenInfo | Represents information about a PKCS#11 token. since: 2
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: 2

#### Enumerations

BuilderFlags | Flags to be used with a `gck_builder_init_full()` and `gck_builder_new()`. since: 2

#### Bitfields

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

#### Error Domains

Error | Various error codes. All the `CKR_XXX` error codes from PKCS#11 are also relevant error codes. since: 2
UriError | Various error codes used with PKCS#11 URIs. since: 2

#### Callbacks

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

#### Functions

mechanisms_check | Check whether all the mechanism types are in the list. since: 2
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: 2
modules_enumerate_objects | Setup an enumerator for listing matching objects on the modules. since: 2
modules_enumerate_uri | Enumerate objects that match a URI. since: 2
modules_get_slots | Get a list of slots for across all of the modules. since: 2
modules_initialize_registered | Load and initialize all the registered modules. since: 2
modules_initialize_registered_async | Load and initialize all the registered modules asynchronously. since: 2
modules_initialize_registered_finish | Finishes the asynchronous operation to initialize the registered PKCS#11 modules. since: 2
modules_object_for_uri | Find an object that matches a URI. since: 2
modules_objects_for_uri | Find objects that match a URI. since: 2
modules_token_for_uri | Lookup a token that matches the URI. since: 2
modules_tokens_for_uri | Lookup a token that matches the URI. since: 2
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: 2
slots_enumerate_objects | Setup an enumerator for listing matching objects on the slots. since: 2
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: 2
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: 2
value_to_boolean | Convert `CK_BBOOL` type memory to a boolean. since: 2
value_to_ulong | Convert `CK_ULONG` type memory to a boolean. since: 2

#### Function Macros

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

#### Constants

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