Signer.sign(options)
Method Description |
Signs the string and returns the signature. Formatting, such as line breaks, is disabled in signatures. For ECDSA based algorithms, such as ES256, this method returns a signature in ASN.1 DER format by default. To retrieve a raw signature for ECDSA based algorithms, set the |
Returns |
string |
Supported Script Types |
Server scripts For additional information, see SuiteScript 2.x Script Types. |
Governance |
None |
Module |
|
Parent Object |
|
Sibling Object Members |
|
Since |
2019.1 |
Parameters
The options
parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
---|---|---|---|
|
string |
optional |
Encoding of the signed string in Base64 format. |
|
boolean |
optional |
Returns ECDSA signatures in raw format. Default value is set to false. |
Syntax
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
...
// mySigner will be a certificate.Signer object
var mySigner = certificate.createSigner({
certId: 'custcertificate1',
algorithm: certificate.HashAlg.SHA256
});
mySigner.update("test");
// result is the signature as a string
var result = mySigner.sign({
outputEncoding: encode.Encoding.BASE_64_URL_SAFE,
useRawFormatForECDSA: true
});
...
//Add additional code