Skip to content

Sign

Signs the given requests by using specified certificate

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

Signs the request with matching certificate filter

1
$Crypto.Sign(input: CompositeSignatureRequest):SignatureResult

Parameters

Certificate cert
    Certificate to use for signing

SignatureRequest request
    Request to sign

CompositeSignatureRequest input
    Request to sign

Returns

Signature result Signature result

Remarks

Sign a request with certificate

1
2
3
4
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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' }]
});

Sign a request with PKCS11 library certificate

1
2
3
4
5
6
7
8
9
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

CommonName : string
Common name of certificate issued to

SerialNumber : string
Serial number of certificate issued to

CompositeSignatureRequest

Filter : CertificateFilter
Filter of certificate to use

Library : string
PKCS11 library path

Pin : string
Pin number of certificate if stored in PKCS11 library

Requests : Array<SignatureResource>
Resources to be signed

See Also