N/pgp Module Members for Secure Messaging in NetSuite

The N/pgp module in NetSuite enables secure messaging and PGP encryption, providing methods for message handling and cryptographic key management.

·3 min read·View Oracle Docs

The N/pgp module in NetSuite facilitates secure messaging through various objects and methods that allow developers to handle PGP encryption effectively. This module is essential for server scripts aimed at enhancing security through cryptography.

What Are the Main Components of the N/pgp Module?

The N/pgp module includes various members classified as objects and methods, specifically designed for cryptographic operations. Below are the key members:

Object Members

Member NameReturn TypeSupported Script TypesDescription
pgp.ConfigObjectServer scriptsGeneral configuration options for message decryption.
pgp.KeyObjectServer scriptsCryptographic keys and their metadata.
pgp.KeyIdObjectServer scriptsAn octet scalar that identifies a subkey.
pgp.MessageObjectServer scriptsProcessed PGP data.
pgp.MessageDataObjectServer scriptsMessage data.
pgp.VerificationObjectServer scriptsVerification results.
pgp.VerificationSignatureObjectServer scriptsA verification result for a single signature.

Method Members

Method NameReturn TypeSupported Script TypesDescription
pgp.createConfig(options)pgp.ConfigServer scriptsCreates a new configuration object.
pgp.createMessageData(options)pgp.MessageDataServer scriptsCreates new message data.
pgp.createSigner(options)certificate.SignerServer scriptsCreates a certificate signer object for signing strings.
pgp.createVerification()pgp.VerificationServer scriptsCreates an empty verification object.
pgp.loadKeyFromSecret(options)pgp.KeyServer scriptsLoads a key stored securely in secret.
pgp.parseMessage(options)pgp.MessageServer scriptsParses a PGP message.
pgp.parseKey(options)pgp.KeyServer scriptsParses an existing PGP key.

Enum Members

Enum NameTypeSupported Script TypesDescription
pgp.CompressionAlgorithmEnumServer scriptsHolds values for available compression algorithms.
pgp.FormatEnumServer scriptsHolds literal data packet type.

Who Can Benefit from the N/pgp Module?

The N/pgp module is beneficial for developers and administrators looking to implement secure communication mechanisms within their NetSuite environment. It supports operations for managing encrypted messages and cryptographic keys, ensuring data integrity and confidentiality.

Key Code Sample

The following code demonstrates creating a configuration for PGP operations:

suitescript
const config = pgp.createConfig({
allowInsecureDecryptionWithSigningKeys: true,
useRelaxedSignatureParsing: true
});

This simple snippet sets up the configuration to allow for more flexible decryption settings, showcasing the ability to customize PGP operations effectively.

Key Takeaways

  • The N/pgp module provides essential methods and objects for secure messaging and PGP encryption.
  • It includes various configuration options, cryptographic keys, and functions for managing encrypted data.
  • Suitable for server scripts, allowing seamless integration within the NetSuite platform for enhanced security.

Source: This article is based on Oracle's official NetSuite documentation.

Frequently Asked Questions (4)

Does the N/pgp module support client scripts in NetSuite?
No, the N/pgp module is specifically designed for server scripts in NetSuite.
Can I use the N/pgp module to create a signer for signing data?
Yes, you can use the `pgp.createSigner(options)` method to create a certificate signer object for signing strings.
What method would I use to load a secret-stored cryptographic key using the N/pgp module?
You would use the `pgp.loadKeyFromSecret(options)` method to load a cryptographic key stored securely in a secret.
What configurations can be customized when creating a new PGP configuration object?
The `pgp.createConfig(options)` method allows custom configurations such as `allowInsecureDecryptionWithSigningKeys` and `useRelaxedSignatureParsing` to provide more flexible decryption settings.
Source: N/pgp Module Members Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in Integration

View all Integration articles →