Gck.Attributes¶
Fields¶
None
Methods¶
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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(reserved)[source]¶
- Parameters:
reserved (
int
) – Should be set to always be [constINVALID]- Returns:
a floating reference to the new attributes array; when done with the array release it with
Gck.Attributes.unref
().- Return type:
Create a new empty
GckAttributes
array.The returned set of attributes is floating, and should either be passed to another gck library function which consumes this floating reference, or if you wish to keep these attributes around you should ref them with
Gck.Attributes.ref_sink
() and unref them later withGck.Attributes.unref
().
- at(index)[source]¶
- Parameters:
index (
int
) – The attribute index to retrieve.- Returns:
the specified attribute
- Return type:
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:
Check whether the attributes contain a certain attribute.
- count()[source]¶
- Returns:
The number of contained attributes.
- Return type:
Get the number of attributes in this attribute array.
- 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:
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:
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:
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:
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:
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_sink()[source]¶
- Returns:
the referenced attributes
- Return type:
Gck.Attributes
uses a floating reference count system. [method`Builder`.end] and [ctor`Attributes`.new_empty] both return floating references.Calling this function on a
GckAttributes
with a floating reference will convert the floating reference into a full reference. Calling this function on a non-floatingGckAttributes
results in an additional normal reference being added.In other words, if the self is floating, then this call “assumes ownership” of the floating reference, converting it to a normal reference. If the self is not floating, then this call adds a new normal reference increasing the reference count by one.
All Gck library functions that assume ownership of floating references are documented as such. Essentially any Gck function that performs an operation using a
Gck.Attributes
argument rather than operating on the attributes themselves, will accept a floating reference.