Gck.Attributes

Fields

None

Methods

class

new ()

at (index)

contains (match)

count ()

dump ()

find (attr_type)

find_boolean (attr_type)

find_date (attr_type)

find_string (attr_type)

find_ulong (attr_type)

ref ()

to_string ()

unref ()

Details

class Gck.Attributes

A set of [struct`Attribute`] structures.

These attributes contain information about a PKCS11 object. Use [method`Object`.get] or [method`Object`.set] to set and retrieve attributes on an object.

classmethod new()[source]
Returns:

a reference to the new attributes array; when done with the array release it with Gck.Attributes.unref().

Return type:

Gck.Attributes

Create a new empty GckAttributes array.

at(index)[source]
Parameters:

index (int) – The attribute index to retrieve.

Returns:

the specified attribute

Return type:

Gck.Attribute

Get attribute at the specified index in the attribute array.

Use [method`Attributes`.count] to determine how many attributes are in the array.

contains(match)[source]
Parameters:

match (Gck.Attribute) – The attribute to find

Returns:

True if the attributes contain the attribute.

Return type:

bool

Check whether the attributes contain a certain attribute.

count()[source]
Returns:

The number of contained attributes.

Return type:

int

Get the number of attributes in this attribute array.

dump()[source]

Dump the attributes using g_printerr().

find(attr_type)[source]
Parameters:

attr_type (int) – The type of attribute to find.

Returns:

the first attribute found with the specified type, or None

Return type:

Gck.Attribute

Find an attribute with the specified type in the array.

find_boolean(attr_type)[source]
Parameters:

attr_type (int) – The type of attribute to find.

Returns:

Whether a value was found or not.

value:

The resulting bool value.

Return type:

(bool, value: bool)

Find an attribute with the specified type in the array.

The attribute (if found) must be of the right size to store a boolean value (ie: CK_BBOOL). If the attribute is marked invalid then it will be treated as not found.

find_date(attr_type)[source]
Parameters:

attr_type (int) – The type of attribute to find.

Returns:

Whether a value was found or not.

value:

The resulting GLib.Date value.

Return type:

(bool, value: GLib.Date)

Find an attribute with the specified type in the array.

The attribute (if found) must be of the right size to store a date value (ie: CK_DATE). If the attribute is marked invalid then it will be treated as not found.

find_string(attr_type)[source]
Parameters:

attr_type (int) – The type of attribute to find.

Returns:

Whether a value was found or not.

value:

The resulting string value.

Return type:

(bool, value: str)

Find an attribute with the specified type in the array.

If the attribute is marked invalid then it will be treated as not found. The resulting string will be null-terminated, and must be freed by the caller using GLib.free().

find_ulong(attr_type)[source]
Parameters:

attr_type (int) – The type of attribute to find.

Returns:

Whether a value was found or not.

value:

The resulting int value.

Return type:

(bool, value: int)

Find an attribute with the specified type in the array.

The attribute (if found) must be of the right size to store a unsigned long value (ie: CK_ULONG). If the attribute is marked invalid then it will be treated as not found.

ref()[source]
Returns:

the attributes

Return type:

Gck.Attributes

Reference this attributes array.

to_string()[source]
Returns:

a newly allocated string

Return type:

str

Print out attributes to a string in aform that’s useful for debugging or logging.

The format of the string returned may change in the future.

unref()[source]

Unreference this attribute array.

When all outstanding references are gone, the array will be freed.