Class (GI Struct)

Gck-2GckAttribute

This structure represents a PKCS#11 CK_ATTRIBUTE. These attributes contain information about a PKCS#11 object. Use Object.get or Object.set to set and attributes on an object.

Although you are free to allocate a Gck.Attribute in your own code, no functions in this library will operate on such an attribute.

Index

Constructors

  • Parameters

    • Optionalproperties: Partial<{ length: number; type: number; value: Uint8Array }>

    Returns Gck.Attribute

Properties

length: number
type: number
value: Uint8Array

Methods

  • Clear allocated memory held by a Gck.Attribute.

    This attribute must have been allocated by a Gck library function, or the results of this method are undefined.

    The type of the attribute will remain set.

    Returns void

  • Dump the specified attribute using g_printerr().

    Returns void

  • Duplicate the PKCS#11 attribute. All value memory is also copied.

    The attr must have been allocated or initialized by a Gck function or the results of this function are undefined.

    Returns Gck.Attribute

    the duplicated attribute; use gck_attribute_free() to free it

  • Free an attribute and its allocated memory. These is usually used with attributes that are allocated by Attribute.new or a similar function.

    Returns void

  • Get the CK_BBOOL of a PKCS#11 attribute. No conversion is performed. It is an error to pass an attribute to this function unless you're know it's supposed to contain a boolean value.

    Returns boolean

    The boolean value of the attribute.

  • Get the raw value in the attribute.

    This is useful from scripting languages. C callers will generally access the Gck.Attribute struct directly.

    This function will null if the attribute contains empty or invalid data. The returned data must not be modified and is only valid as long as this attribute.

    Returns Uint8Array

    the value data or null

  • Get the CK_DATE of a PKCS#11 attribute. No conversion is performed. It is an error to pass an attribute to this function unless you're know it's supposed to contain a value of the right type.

    Parameters

    • value: GLib.Date

      The date value to fill in with the parsed date.

    Returns void

  • Get the string value of a PKCS#11 attribute. No conversion is performed. It is an error to pass an attribute to this function unless you're know it's supposed to contain a value of the right type.

    Returns string

    a null terminated string, to be freed with g_free(), or null if the value was invalid

  • Get the CK_ULONG value of a PKCS#11 attribute. No conversion is performed. It is an error to pass an attribute to this function unless you're know it's supposed to contain a value of the right type.

    Returns number

    The ulong value of the attribute.

  • Hash an attribute for use in GHashTable keys.

    Returns number

    the hash code

  • Initialize a PKCS#11 attribute as a copy of another attribute. This copies the value memory as well.

    When done with the copied attribute you should use Attribute.clear to free the internal memory.

    Parameters

    Returns void

  • Check if the PKCS#11 attribute represents 'invalid' or 'not found' according to the PKCS#11 spec. That is, having length of (CK_ULONG)-1.

    Returns boolean

    Whether the attribute represents invalid or not.