N/crypto/certificate Module Features in SuiteScript
The N/crypto/certificate module in SuiteScript offers XML signing and verification, enhancing data security through digital signatures.
The N/crypto/certificate module is essential for SuiteScript developers focused on securely signing XML data. This module provides methods to create digital signatures and verify them, thereby ensuring data integrity during transactions.
What Are the Key Features of the N/crypto/certificate Module?
The N/crypto/certificate module includes the following core members:
Objects
| Name | Return Type | Supported Script Types | Description |
|---|---|---|---|
certificate.SignedXml | Object | Server scripts | Encapsulates an XML string that has been digitally signed. |
certificate.Signer | Object | Server scripts | Encapsulates a created signature (signer) for plain strings. |
certificate.Verifier | Object | Server scripts | Encapsulates a created verifier for verifying plain string signatures. |
Methods
| Name | Return Type | Supported Script Types | Description |
|---|---|---|---|
certificate.createSigner(options) | certificate.Signer | Server scripts | Creates a certificate.Signer object for signing plain strings. |
certificate.createVerifier(options) | certificate.Verifier | Server scripts | Creates a certificate.Verifier object for verifying signatures of plain strings. |
certificate.signXml(options) | certificate.SignedXml | Server scripts | Signs the input XML string using the Certificate ID, returning a signed XML object. |
certificate.verifyXmlSignature(options) | void | Server scripts | Verifies the signature in the SignedXml file. |
Enums
| Name | Type | Supported Script Types | Description |
|---|---|---|---|
certificate.HashAlg | enum | Server scripts | Holds string values for hash algorithm types, used in signing and verifying methods. |
How to Use the N/crypto/certificate Module
To use the module for signing and verifying XML signatures, follow the syntax shown below:
1// Establishing a signedXml object2var signedXml = certificate.signXml({3 algorithm: certificate.HashAlg.SHA256,4 certId: 'custcertificate1',5 rootTag: 'infNFe',6 xmlString: infNFe.getContents()7});8 9// Verifying the XML signature10certificate.verifyXmlSignature({11 signedXml: signedXml,12 rootTag: 'infNFe'13});Important Notes
- The signing methods disable formatting, which means any line breaks in the XML will not be included in the signature.
- This module is only available for use in server scripts, emphasizing its security and operational integrity.
Who This Affects
- Developers: Utilizing the N/crypto/certificate module for secure XML processing.
- Administrators: Implementing secure transaction processes through SuiteScript.
Key Takeaways
- The N/crypto/certificate module facilitates secure XML signing and verification.
- It includes essential methods for creating signers and verifiers.
- Effective for server-side scripts, enhancing data security through digital signatures.
Frequently Asked Questions (4)
Can the N/crypto/certificate module be used in client scripts?
What algorithms are supported by the N/crypto/certificate module for signing?
How does the signXml method handle XML formatting?
What objects does the N/crypto/certificate module provide for signature creation and verification?
Was this article helpful?
More in Security
- Enable Token-Based Authentication in NetSuite Developer Tools
Token-based authentication is now required for all NetSuite developer tools, enhancing security compliance and aligning with Two-Factor Authentication...
- Login Audit Trail Features for User Activity Tracking
The Login Audit Trail allows tracking user login/logout activity in NetSuite, filtering by date, user, and IP address.
- Security, Privacy, and Compliance Updates in SuiteCloud
Explore the latest updates on security, privacy, and compliance practices in SuiteCloud to enhance developer safety.
- Restricting Role Access to Subsidiaries in NetSuite
Restrict user role access to subsidiaries in NetSuite OneWorld, ensuring data privacy and security for different business units.
Advertising
Reach Security Professionals
Put your product in front of NetSuite experts who work with Security every day.
Sponsor This Category