pgp.loadKeyFromSecret(options)

Note:

The content in this help topic pertains to SuiteScript 2.1.

Method Description

Loads a key contents that are securely stored in a secret.

Returns

pgp.Key

Supported Script Types

Server scripts

Governance

None

Module

N/pgp Module

Sibling Module Members

N/pgp Module Members

Since

2022.2

Parameters

Parameter

Type

Required / Optional

Description

Since

options.secret

Secret

required

Secret that contains a PGP key in ASCII armored format.

2022.2

options.password

Secret

optional

Secret that contains a password to unlock the key. Applicable for private keys.

2022.2

Errors

Error Code

Thrown If

REFERENCED_SECRET_IS_NOT_AVAILABLE

The secret/password parameter references a non-existing secret or you lack permission.

PGP_NONSTANDARD_KEY_DOES_NOT_COMPLY_WITH_PGP_KEY_FORMAT

Parsing of the key fails.

PGP_YOU_CANNOT_PROVIDE_PASSWORD_FOR_A_PUBLIC_KEY

You provide a password, but the key is public.

PGP_INVALID_KEY_PASSWORD

You provide a password, but it is wrong or the private key is not password protected.

PGP_THIS_KEY_IS_PASSWORD_PROTECTED

You do not provide any password, but the private key is password protected.

Syntax

Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/pgp Module Script Samples.

            // Add additional code
...

const keys = pgp.loadKeyFromSecret({
   secret: { scriptId: "custsecret_pgp_key_ours_private" },
   password: { scriptId: "custsecret_pgp_key_ours_private_password" }, 
}),

...
// Add additional code 

          

Related Topics

General Notices