Export (0) Print
Expand All

sign method

Returns an object that can sign data using the specified algorithm and a Key object.

Important  As of Microsoft Edge, this method returns a Promise object. See Web Cryptography API updates for more info.
IE11

 

Syntax

var retVal = SubtleCrypto.sign(algorithm, key, buffer);

Parameters

algorithm [in]

Type: any

An object specifying the cryptographic signature or message authentication algorithm to use (along with any required algorithmic parameters).

key [in]

Type: Key

The signing or message authentication key.

buffer [in, optional]

Type: ArrayBufferView

The data to be signed via the key specified by the key parameter. If this parameter is specified, the returned operation will immediately complete and return the signature. Otherwise, the caller is expected to perform the following tasks:

  1. Provide data through any number of calls to the process method of the CryptoOperation object returned by this (sign) method.
  2. Call the finish method (on this same CryptoOperation object) when done entering data via the process method.

Once the above two steps are completed, the operation will be completed and the signature returned.

Return value

Type: Promise

An Promise object that will sign data using the specified algorithm with the supplied key.

Remarks

The sign method supports the following cryptographic algorithms:

  • RSASSA-PKCS1-v1_5
  • HMAC

See also

SubtleCrypto

 

 

Show:
© 2015 Microsoft