Cloud Keys 2020 Node.js Edition

Questions / Feedback?

Sign Method

Signs a message using a key.


googlekms.sign(keyName, versionId, 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 asymmetric key version specified by KeyName and VersionId.

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 the hash algorithm used to generate a message digest; this must be the same algorithm that appears in the key version's VersionAlgorithm string. The value passed must contain one of the following strings (passing the key version's complete algorithm string is acceptable):

  • SHA256
  • SHA384
  • SHA512

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]