certificate.signXml(options)

Method Description

Signs an input XML string using a certificate ID. Formatting, such as line breaks, is disabled.

Returns

certificate.SignedXml

Supported Script Types

Server scripts

For additional information, see SuiteScript 2.x Script Types.

Governance

10 units

Module

N/crypto/certificate Module

Since

2019.1

Parameters

Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

options.xmlString

string

required

Input XML string

options.certId

string

required

Certificate ID

options.algorithm

string

required

The hash algorithm.

Set this property using the certificate.HashAlg enum.

options.rootTag

string

required

Root tag of XML section to sign.

options.insertionTag

string

optional

Tag where the signature should be inserted.

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/crypto/certificate Module Script Samples.

              //Add additional code
...
var signedXml = certificate.signXml({
    algorithm: certificate.HashAlg.SHA256,
    certId: 'custcertificate1',
    rootTag: 'infNFe',
    xmlString: infNFe.getContents()
});
...
//Add additional code 

            

Related Topics

General Notices