| Gck Library Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | Object Hierarchy | ||||
GckAttributes; GckAttributes * gck_attributes_new (void); GckAttributes * gck_attributes_new_empty (gulong attr_type,...); GckAttribute * gck_attributes_at (GckAttributes *attrs,guint index); GckAttribute * gck_attributes_add (GckAttributes *attrs,GckAttribute *attr); GckAttribute * gck_attributes_add_data (GckAttributes *attrs,gulong attr_type,const guchar *value,gsize length); GckAttribute * gck_attributes_add_invalid (GckAttributes *attrs,gulong attr_type); GckAttribute * gck_attributes_add_empty (GckAttributes *attrs,gulong attr_type); GckAttribute * gck_attributes_add_boolean (GckAttributes *attrs,gulong attr_type,gboolean value); GckAttribute * gck_attributes_add_string (GckAttributes *attrs,gulong attr_type,const gchar *value); GckAttribute * gck_attributes_add_date (GckAttributes *attrs,gulong attr_type,const GDate *value); GckAttribute * gck_attributes_add_ulong (GckAttributes *attrs,gulong attr_type,gulong value); void gck_attributes_add_all (GckAttributes *attrs,GckAttributes *from); void gck_attributes_set_boolean (GckAttributes *attrs,gulong attr_type,gboolean value); void gck_attributes_set_string (GckAttributes *attrs,gulong attr_type,const gchar *value); void gck_attributes_set_date (GckAttributes *attrs,gulong attr_type,const GDate *value); void gck_attributes_set_ulong (GckAttributes *attrs,gulong attr_type,gulong value); GckAttribute * gck_attributes_find (GckAttributes *attrs,gulong attr_type); gboolean gck_attributes_find_boolean (GckAttributes *attrs,gulong attr_type,gboolean *value); gboolean gck_attributes_find_ulong (GckAttributes *attrs,gulong attr_type,gulong *value); gboolean gck_attributes_find_string (GckAttributes *attrs,gulong attr_type,gchar **value); gboolean gck_attributes_find_date (GckAttributes *attrs,gulong attr_type,GDate *value); gulong gck_attributes_count (GckAttributes *attrs); GckAttributes * gck_attributes_ref (GckAttributes *attrs); void gck_attributes_unref (GckAttributes *attrs); gboolean gck_attributes_contains (GckAttributes *attrs,GckAttribute *match); void gck_attributes_dump (GckAttributes *attrs); GckAttributes * gck_attributes_new_full (GckAllocator allocator); #define GCK_TYPE_ATTRIBUTES gpointer (*GckAllocator) (gpointer data,gsize length);
A set of GckAttribute structures. These attributes contain information
about a PKCS11 object. Use gck_object_get() or gck_object_set() to set and retrieve
attributes on an object.
GckAttributes * gck_attributes_new (void);
Create a new GckAttributes array.
Returns : |
the new attributes array; when done with the array
release it with gck_attributes_unref(). [transfer full]
|
GckAttributes * gck_attributes_new_empty (gulong attr_type,...);
Creates an GckAttributes array with empty attributes. The arguments should be values of attribute types, terminated with gck_INVALID.
|
The first attribute type to add as empty. |
|
The arguments should be values of attribute types, terminated with gck_INVALID. |
Returns : |
the new attributes array; when done with the array
release it with gck_attributes_unref(). [transfer full]
|
GckAttribute * gck_attributes_at (GckAttributes *attrs,guint index);
Get attribute at the specified index in the attribute array.
Use gck_attributes_count() to determine how many attributes are
in the array.
|
The attributes array. |
|
The attribute index to retrieve. |
Returns : |
the specified attribute. [transfer none] |
GckAttribute * gck_attributes_add (GckAttributes *attrs,GckAttribute *attr);
Add the specified attribute to the array.
The value stored in the attribute will be copied.
|
The attributes array to add to |
|
The attribute to add. |
Returns : |
the attribute that was added. [transfer none] |
GckAttribute * gck_attributes_add_data (GckAttributes *attrs,gulong attr_type,const guchar *value,gsize length);
Add an attribute with the specified type and value to the array.
The value stored in the attribute will be copied.
|
The attributes array to add to. |
|
The type of attribute to add. |
|
the raw memory of the attribute value. [array length=length] |
|
The length of the attribute value. |
Returns : |
the attribute that was added. [transfer none] |
GckAttribute * gck_attributes_add_invalid (GckAttributes *attrs,gulong attr_type);
Add an attribute with the specified type and an 'invalid' value to the array.
|
The attributes array to add to. |
|
The type of attribute to add. |
Returns : |
the attribute that was added. [transfer none] |
GckAttribute * gck_attributes_add_empty (GckAttributes *attrs,gulong attr_type);
Add an attribute with the specified type, with empty data.
|
The attributes array to add. |
|
The type of attribute to add. |
Returns : |
the attribute that was added. [transfer none] |
GckAttribute * gck_attributes_add_boolean (GckAttributes *attrs,gulong attr_type,gboolean value);
Add an attribute with the specified type and value to the array.
The value will be stored as a CK_BBOOL PKCS#11 style attribute.
|
The attributes array to add to. |
|
The type of attribute to add. |
|
The boolean value to add. |
Returns : |
the attribute that was added. [transfer none] |
GckAttribute * gck_attributes_add_string (GckAttributes *attrs,gulong attr_type,const gchar *value);
Add an attribute with the specified type and value to the array.
The value will be copied into the attribute.
|
The attributes array to add to. |
|
The type of attribute to add. |
|
The null terminated string value to add. |
Returns : |
the attribute that was added. [transfer none] |
GckAttribute * gck_attributes_add_date (GckAttributes *attrs,gulong attr_type,const GDate *value);
Add an attribute with the specified type and value to the array.
The value will be stored as a CK_DATE PKCS#11 style attribute.
|
The attributes array to add to. |
|
The type of attribute to add. |
|
The GDate value to add. |
Returns : |
the attribute that was added. [transfer none] |
GckAttribute * gck_attributes_add_ulong (GckAttributes *attrs,gulong attr_type,gulong value);
Add an attribute with the specified type and value to the array.
The value will be stored as a CK_ULONG PKCS#11 style attribute.
|
The attributes array to add to. |
|
The type of attribute to add. |
|
The gulong value to add. |
Returns : |
the attribute that was added. [transfer none] |
void gck_attributes_add_all (GckAttributes *attrs,GckAttributes *from);
Add all attributes in from to attrs.
|
A set of attributes |
|
Attributes to add |
void gck_attributes_set_boolean (GckAttributes *attrs,gulong attr_type,gboolean value);
Set the attribute of attr_type in the attribute array to the given value. If no such value exists, then add one.
|
the attributes |
|
the type of attribute to set |
|
boolean value to set |
void gck_attributes_set_string (GckAttributes *attrs,gulong attr_type,const gchar *value);
Set the attribute of attr_type in the attribute array to the given value. If no such value exists, then add one.
|
the attributes |
|
the type of attribute to set |
|
null terminated string value to set |
void gck_attributes_set_date (GckAttributes *attrs,gulong attr_type,const GDate *value);
Set the attribute of attr_type in the attribute array to the given value. If no such value exists, then add one.
|
the attributes |
|
the type of attribute to set |
|
date value to set |
void gck_attributes_set_ulong (GckAttributes *attrs,gulong attr_type,gulong value);
Set the attribute of attr_type in the attribute array to the given value. If no such value exists, then add one.
|
the attributes |
|
the type of attribute to set |
|
gulong value to set |
GckAttribute * gck_attributes_find (GckAttributes *attrs,gulong attr_type);
Find an attribute with the specified type in the array.
|
The attributes array to search. |
|
The type of attribute to find. |
Returns : |
the first attribute found with the specified type,
or NULL. [transfer none]
|
gboolean gck_attributes_find_boolean (GckAttributes *attrs,gulong attr_type,gboolean *value);
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.
|
The attributes array to search. |
|
The type of attribute to find. |
|
The resulting gboolean value. |
Returns : |
Whether a value was found or not. |
gboolean gck_attributes_find_ulong (GckAttributes *attrs,gulong attr_type,gulong *value);
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.
|
The attributes array to search. |
|
The type of attribute to find. |
|
The resulting gulong value. |
Returns : |
Whether a value was found or not. |
gboolean gck_attributes_find_string (GckAttributes *attrs,gulong attr_type,gchar **value);
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 g_free().
|
The attributes array to search. |
|
The type of attribute to find. |
|
The resulting string value. |
Returns : |
Whether a value was found or not. |
gboolean gck_attributes_find_date (GckAttributes *attrs,gulong attr_type,GDate *value);
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.
|
The attributes array to search. |
|
The type of attribute to find. |
|
The resulting GDate value. |
Returns : |
Whether a value was found or not. |
gulong gck_attributes_count (GckAttributes *attrs);
Get the number of attributes in this attribute array.
|
The attributes array to count. |
Returns : |
The number of contained attributes. |
GckAttributes * gck_attributes_ref (GckAttributes *attrs);
Reference this attributes array.
|
An attribute array |
Returns : |
the attributes. [transfer full] |
void gck_attributes_unref (GckAttributes *attrs);
Unreference this attribute array.
When all outstanding references are NULL, the array will be freed.
|
An attribute array |
gboolean gck_attributes_contains (GckAttributes *attrs,GckAttribute *match);
Check whether the attributes contain a certain attribute.
|
The attributes to check |
|
The attribute to find |
Returns : |
TRUE if the attributes contain the attribute. |
void gck_attributes_dump (GckAttributes *attrs);
Dump the attributes using g_printerr().
|
The attributes |
GckAttributes * gck_attributes_new_full (GckAllocator allocator);
Create a new GckAttributes array.
|
Memory allocator for attribute data, or NULL for default. |
Returns : |
the new attributes array; when done with the array
release it with gck_attributes_unref(). [transfer full]
|
#define GCK_TYPE_ATTRIBUTES (gck_attributes_get_boxed_type ())
Boxed type for GckAttributes
gpointer (*GckAllocator) (gpointer data,gsize length);
An allocator used to allocate data for the attributes in this GckAttributes set.
This is a function that acts like g_realloc. Specifically it frees when length is set to zero, it allocates when data is set to NULL, and it reallocates when both are valid.
|
Memory to allocate or deallocate. |
|
New length of memory. |
Returns : |
The allocated memory, or NULL when freeing. |