Key object usage

Details about the various formats when defining a key object in a GatewayScript API.

In an API, you can specify a key object in one of the following formats.
  • A String object
  • A Buffer or Buffers object
  • An Object, which is one of the following formats.
    • {key: buffer_object}
    • {key: buffer_object, passphrase: string}
    • {key: buffers_object}
    • {key: buffers_object, passphrase: string}
Depending on the API, at least one of the following key types is supported.

Private key

The following table provide usage details for defining a private key in an API.

Table 1. Private key usage
Object format Details
A String object Refer to the name of the key alias configuration. For XSLT key prefix details, see dp:sign().
A Buffer or Buffers object PEM formatted base64 encoded data of the private key.
An Object The value of the key property is the base64 encoded data of the private key. The passphrase property is used when defined.

Public key

The following table provide usage details for defining a public key in an API.

Table 2. Public key usage
Object format Details
A String object Refer to the name of the certificate alias configuration. For XSLT key prefix details, see dp:verify().
A Buffer or Buffers object PEM formatted base64 encoded data of the public key.
An Object The value of the key property is the base64 encoded data of the public key. The passphrase property is ignored even when defined.

Shared secret key

The following table provide usage details for defining a shared secret key in an API.

Table 3. Shared secret key usage
Object format Details
A String object Refer to the name of the shared secret key alias configuration. For XSLT key prefix details, see dp:encrypt-data().
A Buffer or Buffers object Base64 encoded data of the shared secret key.
An Object The value of the key property is the base64 encoded data of the shared secret key. The passphrase property is ignored even when defined.