Namespace

Gck – 1

GObject bindings for PKCS#11

Version1
AuthorsGCK contributors
LicenseLGPL-2.0-or-later
Website
Sourcehttps://gitlab.gnome.org/GNOME/gcr/

Build

C headersgck/gck.h
pkg-config filesgck-1

Dependencies

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

Additional documentation

Classes

Enumerator

Can be used to enumerate through PKCS#11 objects. It will automatically create sessions as necessary.

Module

Holds a loaded PKCS#11 module. A PKCS#11 module is a shared library.

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.

Password

Represents a password which is requested of the user.

Session

Represents an open PKCS11 session.

Slot

Represents a PKCS#11 slot that can contain a token.

Interfaces

ObjectCache

An interface implemented by derived classes of GckObject to indicate which attributes they’d like an enumerator to retrieve.

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.

Attributes

A set of GckAttribute structures.

Builder

A builder for a set of attributes. Add attributes to a builder, and then use gck_builder_end() to get the completed GckAttributes.

Mechanism

Represents a mechanism used with crypto operations.

MechanismInfo

Represents information about a PKCS11 mechanism.

ModuleInfo

Holds information about the PKCS#11 module.

SessionInfo

Information about the session. This is analogous to a CK_SESSION_INFO structure.

SlotInfo

Represents information about a PKCS11 slot.

TokenInfo

Represents information about a PKCS11 token.

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.

Enumerations

BuilderFlags

Flags to be used with a gck_builder_init_full() and gck_builder_new().

Error

Various error codes. All the CKR_XXX error codes from PKCS#11 are also relevant error codes.

UriError

Various error codes used with PKCS#11 URIs.

Bitfields

SessionOptions

Options for creating sessions.

UriFlags

Which parts of the PKCS#11 URI will be parsed or formatted. These can be combined.

Callbacks

Allocator

An allocator used to allocate data for the attributes in this GckAttributes set.

Functions

list_get_boxed_type
list_ref_copy

Copy a list of GObject based pointers. All objects in the list will be reffed and the list will be copied.

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.

mechanisms_check

Check whether all the mechanism types are in the list.

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.

modules_enumerate_objects

Setup an enumerator for listing matching objects on the modules.

modules_enumerate_uri

Enumerate objects that match a URI.

modules_get_slots

Get a list of slots for across all of the modules.

modules_initialize_registered

Load and initialize all the registered modules.

modules_initialize_registered_async

Load and initialize all the registered modules asynchronously.

modules_initialize_registered_finish

Finishes the asynchronous operation to initialize the registered PKCS#11 modules.

modules_object_for_uri

Find an object that matches a URI.

modules_objects_for_uri

Find objects that match a URI.

modules_token_for_uri

Lookup a token that matches the URI.

modules_tokens_for_uri

Lookup a token that matches the URI.

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.

slots_enumerate_objects

Setup an enumerator for listing matching objects on the slots.

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.

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.

uri_build

Build a PKCS#11 URI. The various parts relevant to the flags specified will be used to build the URI.

uri_parse

Parse a PKCS#11 URI for use in a given context.

value_to_boolean

Convert CK_BBOOL type memory to a boolean.

value_to_ulong

Convert CK_ULONG type memory to a boolean.

Function Macros

CHECK_VERSION

Checks the version of the Gck library that is being compiled against.

mechanisms_at

Get a specific mechanism in a the set.

mechanisms_length

Get the number of GckMechanismInfo in the set.

Constants

INVALID

Used as a terminator at the end of variable argument lists.

MAJOR_VERSION

The major version number of the Gck library.

MICRO_VERSION

The micro version number of the Gck library.

MINOR_VERSION

The minor version number of the Gck library.

URI_FOR_MODULE_WITH_VERSION

The URI will match specific version of modules. To be used as a GckUriFlags argument.

URI_FOR_OBJECT_ON_TOKEN

The URI will match objects on a specific token. To be used as a GckUriFlags argument.

URI_FOR_OBJECT_ON_TOKEN_AND_MODULE

The token inserted into a device with a specific module.

VENDOR_CODE

Custom PKCS#11 errors that originate from the gck library, are based at this error code.