$Crypto.Sign

Overview

Signs the given requests by using specified certificate

SignatureResult $Crypto.Sign(cert: Certificate, request: SignatureRequest)

Signs the request with matching certificate filter

Arguments

Certificate cert

Certificate to use for signing

SignatureRequest request

Request to sign

CompositeSignatureRequest input

Request to sign

Returns

Signature result

Example

Sign a request with certificate

var cert = $Crypto.GetCertificate('base64 encoded pfx content', 'password'); var result = $Crypto.Sign(cert, { Requests: [{ Source: 'Hello World', Format: 'Cades', Level: 'BES' }] });

Sign a request with PKCS11 library certificate

var cert = $Crypto.GetCertificate({ Filter: { CommonName: 'The Name' // SerialNumber : '1234' }, Pin: '1111', Library: '<path to PKCS11 library>', }); var result = $Crypto.Sign(cert, { Requests: [{ Source: 'Hello World', Format: 'Cades', Level: 'BES' }] });

Example

Sign a request with PKCS11 library certificate

var result = $Crypto.Sign({ Filter: { CommonName: 'The Name' // SerialNumber : '1234' }, Pin: '1111', Library: '<path to PKCS11 library>', Requests: [{ Source: 'Hello World', Format: 'Cades', Level: 'BES' }] });

Types

Certificate

{ // Common name of certificate issued to CommonName : string // Serial number of certificate issued to SerialNumber : string }

CompositeSignatureRequest

{ // Filter of certificate to use Filter : CertificateFilter // PKCS11 library path Library : string // Pin number of certificate if stored in PKCS11 library Pin : string // Resources to be signed Requests : Array<SignatureResource> }

Copyright © 2010 - 2023 Emakin. All rights reserved.