N/crypto Module Members for SuiteScript Security Functions

The N/crypto module provides SuiteScript developers with functions for hashing, HMAC, and encryption for enhanced security protocols.

·3 min read·View Oracle Docs

TL;DR Opening

The N/crypto module in SuiteScript allows developers to perform critical operations like hashing, HMAC, and symmetrical encryption. This enhances the security and integrity of data within applications, making it essential for developers needing robust security mechanisms.

Overview of the N/crypto Module

The N/crypto module facilitates various cryptographic functions which are crucial in maintaining data integrity and security in SuiteScript applications. By utilizing this module, developers can implement hashing, hash-based message authentication (HMAC), and symmetrical encryption. The functionality of the N/crypto module is augmented by the concurrent loading of the N/encode module.

Key Members of the N/crypto Module

Here are the main members of the N/crypto module and their purposes:

Member TypeNameReturn Type / Value TypeSupported Script TypesDescription
Objectcrypto.CipherObjectServer scriptsEncapsulates a cipher.
Objectcrypto.CipherPayloadObjectServer scriptsEncapsulates a cipher payload.
Objectcrypto.DecipherObjectServer scriptsEncapsulates a decipher.
Objectcrypto.HashObjectServer scriptsEncapsulates a hash.
Objectcrypto.HmacObjectServer scriptsEncapsulates an HMAC.
Objectcrypto.SecretKeyObjectServer scriptsEncapsulates a secret key handle.
Methodcrypto.checkPasswordField(options)booleanServer scriptsChecks whether a password in a record corresponds to the password entered by the user.
Methodcrypto.createCipher(options)ObjectServer scriptsCreates and returns a new crypto.Cipher Object.
Methodcrypto.createDecipher(options)ObjectServer scriptsCreates and returns a new crypto.Decipher object.
Methodcrypto.createHash(options)ObjectServer scriptsCreates and returns a new crypto.Hash Object.
Methodcrypto.createHmac(options)ObjectServer scriptsCreates and returns a new crypto.Hmac Object.
Methodcrypto.createSecretKey(options)ObjectServer scriptsCreates and returns a new crypto.SecretKey Object.
Enumcrypto.EncryptionAlgstring (read-only)Server scriptsHolds the values for supported encryption algorithms.
Enumcrypto.HashAlgstring (read-only)Server scriptsHolds the values for supported hashing algorithms.
Enumcrypto.Paddingstring (read-only)Server scriptsHolds the values for supported cipher padding.

The above table summarizes member types, usage, and descriptions of functionality provided by the N/crypto module.

Key Functions Explained

  • Cipher Functions: Utilize the crypto.Cipher to encapsulate and manage encryption operations.
  • Hashing: The crypto.Hash object offers methods like digest() and update() for creating secure hash values.
  • HMAC Operations: The crypto.Hmac object manages HMAC computations to ensure message integrity.
  • SecretKey Management: Manage API secrets effectively using crypto.SecretKey for secure access.

Who This Affects

  • Roles: This module is primarily relevant for Developers and Administrators working with SuiteScript.
  • Modules: Particularly important for applications requiring security features such as authentication and data integrity.

Key Takeaways

  • The N/crypto module empowers developers with essential cryptographic functionalities.
  • Key member objects facilitate secure data handling in SuiteScript.
  • Understanding this module is crucial for implementing robust security measures in applications.

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

Frequently Asked Questions (4)

What prerequisites are necessary to use the N/crypto module in SuiteScript?
The N/crypto module is designed for use in server scripts, so access to the server environment is a prerequisite. Developers should be familiar with SuiteScript and understand cryptographic concepts to effectively utilize this module.
Does the N/crypto module require enabling any specific feature in NetSuite?
The article does not specify any particular feature that must be enabled in NetSuite to use the N/crypto module. It is recommended to ensure that the SuiteScript environment is properly set up for server-side scripts.
How does the N/crypto module interact with other modules?
The functionality of the N/crypto module is enhanced when used concurrently with the N/encode module, which assists in encoding operations.
Is the N/crypto module applicable to all script types in NetSuite?
No, the N/crypto module is specifically designed for use in server scripts, as indicated by the supported script types for its members and methods.
Source: N/crypto 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 Security

View all Security articles →