Gjsify LogoGjsify Logo

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

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

record

Hierarchy

  • Attribute

Index

Constructors

  • new Attribute(attr_type: number, value: number, length: number): Gck.Attribute
  • Create a new PKCS#11 attribute. The value will be copied into the new attribute.

    Parameters

    • attr_type: number

      the PKCS#11 attribute type to set on the attribute

    • value: number

      the raw value of the attribute

    • length: number

      the length of the attribute

    Returns Gck.Attribute

Properties

length: number

The length of the attribute. May be [constINVALID] if the attribute is invalid.

field
type: number

The attribute type, such as CKA_LABEL.

field
value: Uint8Array

The value of the attribute. May be %NULL.

field
name: string

Methods

  • clear(): void
  • Clear allocated memory held by a #GckAttribute.

    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(): 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

  • free(): void
  • Free an attribute and its allocated memory. These is usually used with attributes that are allocated by [ctorAttribute.new] or a similar function.

    Returns void

  • get_boolean(): boolean
  • 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

  • get_data(): Uint8Array
  • Get the raw value in the attribute.

    This is useful from scripting languages. C callers will generally access the #GckAttribute 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

  • 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_string(): string
  • 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

  • get_ulong(): number
  • 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

  • hash(): number
  • 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 [methodAttribute.clear] to free the internal memory.

    Parameters

    Returns void

  • is_invalid(): boolean
  • 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

  • new(attr_type: number, value: number, length: number): Gck.Attribute
  • Create a new PKCS#11 attribute. The value will be copied into the new attribute.

    Parameters

    • attr_type: number

      the PKCS#11 attribute type to set on the attribute

    • value: number

      the raw value of the attribute

    • length: number

      the length of the attribute

    Returns Gck.Attribute

  • new_boolean(attr_type: number, value: boolean): Gck.Attribute
  • Initialize a PKCS#11 attribute to boolean. This will result in a CK_BBOOL attribute from the PKCS#11 specs.

    Parameters

    • attr_type: number

      the PKCS#11 attribute type to set on the attribute

    • value: boolean

      the boolean value of the attribute

    Returns Gck.Attribute

  • Initialize a PKCS#11 attribute to a date. This will result in a CK_DATE attribute from the PKCS#11 specs.

    Parameters

    • attr_type: number

      the PKCS#11 attribute type to set on the attribute

    • value: GLib.Date

      the date value of the attribute

    Returns Gck.Attribute

  • Create a new PKCS#11 attribute as 'invalid' or 'not found' state. Specifically this sets the value length to (CK_ULONG)-1 as specified in the PKCS#11 specification.

    Parameters

    • attr_type: number

      the PKCS#11 attribute type to set on the attribute

    Returns Gck.Attribute

  • Initialize a PKCS#11 attribute to a string. This will result in an attribute containing the text, but not the null terminator. The text in the attribute will be of the same encoding as you pass to this function.

    Parameters

    • attr_type: number

      the PKCS#11 attribute type to set on the attribute

    • value: string

      the null-terminated string value of the attribute

    Returns Gck.Attribute

  • Initialize a PKCS#11 attribute to a unsigned long. This will result in a CK_ULONG attribute from the PKCS#11 specs.

    Parameters

    • attr_type: number

      the PKCS#11 attribute type to set on the attribute

    • value: number

      the ulong value of the attribute

    Returns Gck.Attribute

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method