Cloud Keys 2020 Node.js Edition

Questions / Feedback?

Sign Method

Signs a message using a key.


azurekeys.sign(keyName, algorithm, isDigest, [callback])


The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).

The callback for this method is defined as:

function(err){ }

'err' is the error that occurred. If there was no error, then 'err' is 'null'.

'err' has 2 properties which hold detailed information:



This method signs a message using the key specified by KeyName and the given Algorithm. The VersionId configuration setting can be used to target a specific key version.

The message data to sign is taken from the the specified InputFile or the InputData property. The signature data is output to the the specified OutputFile or the OutputData property.

The Algorithm parameter specifies which algorithm to use to sign the data. Possible values are:

  • ES256: ECDSA using P-256 and SHA-256.
  • ES256K: ECDSA using P-256K and SHA-256.
  • ES384: ECDSA using P-384 and SHA-384.
  • ES512: ECDSA using P-521 and SHA-512.
  • PS256: RSASSA-PSS using SHA-256 and MGF1 with SHA-256.
  • PS384: RSASSA-PSS using SHA-384 and MGF1 with SHA-384.
  • PS512: RSASSA-PSS using SHA-512 and MGF1 with SHA-512.
  • RS256: RSASSA-PKCS1-v1_5 using SHA-256.
  • RS384: RSASSA-PKCS1-v1_5 using SHA-384.
  • RS512: RSASSA-PKCS1-v1_5 using SHA-512.

The IsDigest parameter specifies whether the message data is the original message (false) or a message digest (true). When supplying a message digest, keep in mind that the same digest will need to be provided in order to Verify the signature later.

If IsDigest is false, the class will automatically compute an appropriate message digest before the request is made. In such cases, the computed digest is made available via the MessageDigest configuration setting.

Copyright (c) 2022 /n software inc. - All rights reserved.
Cloud Keys 2020 Node.js Edition - Version 20.0 [Build 8157]