Signer Object Members for SuiteScript in NetSuite

The Signer object in SuiteScript allows for string signing and signature management. This guide covers its methods and usage.

·2 min read·View Oracle Docs

The Signer object is vital for secure communications in SuiteScript, allowing developers to sign strings securely. This feature supports server scripts and is particularly useful in situations requiring digital signatures.

What is the Signer Object?

The Signer object encapsulates a created signature for plain strings and is returned by the certificate.createSigner(options) method. It is a key component of the N/crypto/certificate module.

Signer Object Members

The Signer object includes two main methods that are used for signing operations:

Member NameReturn TypeSupported Script TypesDescription
Signer.sign(options)voidServer scriptsSigns the string and returns the generated signature.
Signer.update(options)voidServer scriptsUpdates the input string that is to be signed, allowing encoded strings.

Using the Signer Object

Here's how you can utilize the Signer object in your SuiteScript:

suitescript
1// Example usage of the Signer object
2var mySigner = certificate.createSigner({
3 certId: 'custcertificate1',
4 algorithm: certificate.HashAlg.SHA512
5});
6
7mySigner.update("test"); // Update the string to be signed
8var result = mySigner.sign({
9 outputEncoding: encode.Encoding.BASE_64_URL_SAFE,
10 useRawFormatForECDSA: true
11});

Method Details

  • Signer.sign(options): This method is crucial for signing a string and can format the result in various ways, including Base64 encoding.
  • Signer.update(options): Use this method to modify the input string that will be signed. This method supports plain and encoded strings.

Who This Affects

This article is beneficial for developers who work with:

  • Server Scripts
  • Security Implementations
  • Digital Signature Management

Key Takeaways

  • The Signer object is integral for string signing in SuiteScript.
  • Two primary methods exist for signing and updating strings.
  • It supports server scripts and various encoding options.

Frequently Asked Questions (4)

What modules do I need to include to use the Signer object in SuiteScript?
You need to include the `N/crypto/certificate` module to use the Signer object in SuiteScript.
Can the Signer object be used in client-side scripts?
No, the Signer object is only supported in server scripts.
What encoding options are available when signing a string using the Signer object?
When signing a string, options such as Base64 URL Safe encoding can be used.
Is it possible to modify the input string after initially setting it in the Signer object?
Yes, you can use the `Signer.update(options)` method to update the input string to be signed, allowing both plain and encoded strings.
Source: Signer Object 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 Platform

View all Platform articles →