pgp.parseKey(options)

Note:

The content in this help topic pertains to SuiteScript 2.1.

Method Description

Parses an existing PGP key. Use pgp.loadKeyFromSecret(options) to load private keys.

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

options.value

string

required

ASCII armored key

options.password

string

optional

Password to unlock the key. Applicable for private keys.

Errors

Error Code

Thrown If

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 when the key is public.

PGP_INVALID_KEY_PASSWORD

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

PGP_THIS_KEY_IS_PASSWORD_PROTECTED

You don't 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 parseKey = pgp.parseKey({ value: 'custsecret_ascii_armored_key' })

...
// Add additional code 

          

Related Topics

General Notices