crypto.createSign(algorithm[, options])


创建并返回一个使用给定 algorithmSign 对象。使用 crypto.getHashes() 获取可用摘要算法的名称。可选的 options 参数用于控制 stream.Writable 的行为。

【Creates and returns a Sign object that uses the given algorithm. Use crypto.getHashes() to obtain the names of the available digest algorithms. Optional options argument controls the stream.Writable behavior.】

在某些情况下,可以使用签名算法的名称(例如 'RSA-SHA256')而不是摘要算法来创建 Sign 实例。这将使用相应的摘要算法。但这并不适用于所有签名算法,例如 'ecdsa-with-SHA256',因此最好始终使用摘要算法的名称。

【In some cases, a Sign instance can be created using the name of a signature algorithm, such as 'RSA-SHA256', instead of a digest algorithm. This will use the corresponding digest algorithm. This does not work for all signature algorithms, such as 'ecdsa-with-SHA256', so it is best to always use digest algorithm names.】