N/crypto/certificate Module
Use the N/crypto/certificate module to sign XML documents or strings with digital certificates using asymmetric cryptography. You can also use this module to create signer and verifier objects and verify signed documents.
N/crypto/certificate Module Script Samples
In This Help Topic
N/crypto/certificate Module Members
|
Member Type |
Name |
Return Type/Value Type |
Supported Script Types |
Description |
|---|---|---|---|---|
|
Object |
Object |
Server scripts |
Encapsulates an XML string that has been digitally signed. Use certificate.signXml(options) to create this object. |
|
|
Object |
Server scripts |
Encapsulates a created signature (signer) for plain strings. Use certificate.createSigner(options) to create this object. |
||
|
Object |
Server scripts |
Encapsulates a created verifier for verifying plain string signatures. Use certificate.createVerifier(options) to create this object. |
||
|
Method |
Server scripts |
Creates a certificate.Signer object for signing plain strings. |
||
|
Server scripts |
Creates a certificate.Verifier object for verifying signatures of plain strings. |
|||
|
Server scripts |
Signs the input XML string using the Certificate ID. Returns the certificate.SignedXml as a string.
Note:
Formatting, such as line breaks, is disabled in signatures. |
|||
|
void |
Server scripts |
Verifies the signature in the SignedXml.asFile() file. |
||
|
Enum |
enum |
Server scripts |
Holds the string values for hash algorithm types. Use this enum to set the |
SignedXml Object Members
The following members are called on the certificate.SignedXml object.
|
Member Type |
Name |
Return Type / Value Type |
Supported Script Types |
Description |
|---|---|---|---|---|
|
Method |
Server scripts |
Returns the signed XML as a file object. |
||
|
string |
Server scripts |
Returns the signed XML as a string. |
||
|
Server scripts |
Returns the signed XML as an XML document. You can use the N/xml Module with this document to access elements and attributes in the XML. |
Signer Object Members
The following members are called on the certificate.Signer object.
|
Member Type |
Name |
Return Type / Value Type |
Supported Script Types |
Description |
|---|---|---|---|---|
|
Method |
void |
Server scripts |
Signs the string and returns the signature. |
|
|
void |
Server scripts |
Updates the input string to be signed. The string can be encoded. |
Verifier Object Members
The following members are called on the certificate.Verifier object.
|
Member Type |
Name |
Return Type / Value Type |
Supported Script Types |
Description |
|---|---|---|---|---|
|
Method |
void |
Server scripts |
Updates the string to be verified against specified certificate. |
|
|
void |
Server scripts |
Verifies the string against a provided signature using specified certificate. |