Class PublicKey

Public key objects (object class CKO_PUBLIC_KEY) hold public keys

Hierarchy (view full)

Constructors

Properties

Object class (type)

derive: boolean

CK_TRUE if key supports key derivation (i.e., if other keys can be derived from this one (default CK_FALSE)

  • May be modified after object is created with a C_SetAttributeValue call, or in the process of copying object with a C_CopyObject call. However, it is possible that a particular token may not permit modification of the attribute during the course of a C_CopyObject call.

boolean

encrypt: boolean

true if key supports encryption

  • May be modified after object is created with a C_SetAttributeValue call, or in the process of copying object with a C_CopyObject call. However, it is possible that a particular token may not permit modification of the attribute during the course of a C_CopyObject call.
  • Default value is token-specific, and may depend on the values of other attributes.
endDate: Date

End date for the key (default empty)

  • May be modified after object is created with a C_SetAttributeValue call, or in the process of copying object with a C_CopyObject call. However, it is possible that a particular token may not permit modification of the attribute during the course of a C_CopyObject call.
handle: Buffer

ID of PKCS#11 object

id: Buffer

Key identifier for key (default empty)

  • May be modified after object is created with a C_SetAttributeValue call, or in the process of copying object with a C_CopyObject call. However, it is possible that a particular token may not permit modification of the attribute during the course of a C_CopyObject call.
label: string

Description of the object (default empty)

lib: PKCS11

PKCS#11 module

local: boolean

CK_TRUE only if key was either * generated locally (i.e., on the token) with a C_GenerateKey or C_GenerateKeyPair call * created with a C_CopyObject call as a copy of a key which had its CKA_LOCAL attribute set to CK_TRUE

  • Must not be specified when object is created with C_CreateObject.
  • Must not be specified when object is generated with C_GenerateKey or C_GenerateKeyPair.
  • Must not be specified when object is unwrapped with C_UnwrapKey.
mechanism: KeyGenMechanism

Identifier of the mechanism used to generate the key material.

  • Must not be specified when object is created with C_CreateObject.
  • Must not be specified when object is generated with C_GenerateKey or C_GenerateKeyPair.
  • Must not be specified when object is unwrapped with C_UnwrapKey.
modifiable: boolean

true if object can be modified. Default is false

private: boolean

true if object is a private object and false if object is a public object. Default value is token-specific, and may depend on the values of other attributes of the object.

session: Session

PKCS#11 session

startDate: Date

Start date for the key (default empty)

  • May be modified after object is created with a C_SetAttributeValue call, or in the process of copying object with a C_CopyObject call. However, it is possible that a particular token may not permit modification of the attribute during the course of a C_CopyObject call.
subject: Buffer

DER-encoding of the key subject name (default empty)

  • May be modified after object is created with a C_SetAttributeValue call, or in the process of copying object with a C_CopyObject call. However, it is possible that a particular token may not permit modification of the attribute during the course of a C_CopyObject call.
token: boolean

true if object is a token object and false if object is a session object. Default is false.

trusted: boolean

The key can be trusted for the application that it was created.

  • The wrapping key can be used to wrap keys with CKA_WRAP_WITH_TRUSTED set to true.
  • Can only be set to CK_TRUE by the SO user.
type: KeyType

Type of key

  • Must be specified when object is created with C_CreateObject
  • Must be specified when object is unwrapped with C_UnwrapKey
verify: boolean

true if key supports verification where the signature is an appendix to the data

  • May be modified after object is created with a C_SetAttributeValue call, or in the process of copying object with a C_CopyObject call. However, it is possible that a particular token may not permit modification of the attribute during the course of a C_CopyObject call.
  • Default value is token-specific, and may depend on the values of other attributes.
verifyRecover: boolean

true if key supports verification where the data is recovered from the signature

  • May be modified after object is created with a C_SetAttributeValue call, or in the process of copying object with a C_CopyObject call. However, it is possible that a particular token may not permit modification of the attribute during the course of a C_CopyObject call.
  • Default value is token-specific, and may depend on the values of other attributes.
wrap: boolean

true if key supports wrapping (i.e., can be used to wrap other keys)

  • May be modified after object is created with a C_SetAttributeValue call, or in the process of copying object with a C_CopyObject call. However, it is possible that a particular token may not permit modification of the attribute during the course of a C_CopyObject call.
  • Default value is token-specific, and may depend on the values of other attributes.

Accessors

  • get allowedMechanisms(): void
  • Returns void

  • set allowedMechanisms(v): void
  • Parameters

    • v: void

    Returns void

  • get size(): number
  • Gets the size of an object in bytes

    Returns number

  • get template(): void
  • For wrapping keys. The attribute template to match against any keys wrapped using this wrapping key. Keys that do not match cannot be wrapped.

    Returns void

  • set template(v): void
  • Parameters

    • v: void

    Returns void

Methods

  • Returns attribute value

    Parameters

    • type: number

      Attribute type

    Returns Buffer

    Attribute value in Buffer format

  • Returns attribute value

    Parameters

    Returns any

    Attribute value. Depends on the attribute name

  • Returns a list of attributes

    Parameters

    • attrs: ITemplate

      The list of attributes for receiving

    Returns ITemplate

    The list of attributes

  • Retrieves information about PKCS#11 object and fills fields

    Returns void

  • Alias for setAttribute

    Parameters

    • type: number
    • value:
          | string
          | number
          | boolean
          | Buffer

    Returns void

  • Parameters

    • name: string
    • value: any

    Returns void

  • Sets attribute value

    Parameters

    • type: number

      Attribute type

    • value:
          | string
          | number
          | boolean
          | Buffer

      Attribute value

    Returns void

  • Sets attribute value

    Parameters

    • name: string

      Attribute name. See ITemplate

    • value: any

      Attribute value. Depends on attribute name

    Returns void

  • Sets attributes from the list of attributes

    Parameters

    Returns void