Class PrivateKey

Private key objects (object class CKO_PRIVATE_KEY) hold private keys

Hierarchy (view full)

Constructors

Properties

alwaysAuthenticate: boolean

if true, the user has to supply the PIN for each use (sign or decrypt) with the key. Default is false

alwaysSensitive: boolean

true if key has always had the CKA_SENSITIVE attribute set to 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.

Object class (type)

decrypt: boolean

true if key supports decryption

  • 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.
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.

Returns

boolean

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.
extractable: boolean

true if key is extractable and can be wrapped

  • 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.
  • Attribute cannot be changed once set to false. It becomes a read only attribute.
  • Default value is token-specific, and may depend on the values of other attributes.
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

neverExtractable: boolean

true if key has never had the CKA_EXTRACTABLE attribute set to 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.
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.

sensitive: boolean

true if key is sensitive

  • 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.
  • Attribute cannot be changed once set to CK_TRUE. It becomes a read only attribute.
  • Default value is token-specific, and may depend on the values of other attributes.
session: Session

PKCS#11 session

sign: boolean

true if key supports signatures 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.
signRecover: boolean

true if key supports signatures where the data can be 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.
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.

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
unwrap: boolean

true if key supports unwrapping (i.e., can be used to unwrap 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.
wrapTrusted: boolean

true if the key can only be wrapped with a wrapping key that has CKA_TRUSTED set to true. Default is false.

  • Attribute cannot be changed once set to true. It becomes a read only attribute.

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 apply to any keys unwrapped using this wrapping key. Any user supplied template is applied after this template as if the object has already been created.

    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

Generated using TypeDoc