crypto.createSign(algorithm[, options])


创建并返回一个使用给定 algorithm 的 Sign 对象。使用 crypto.getHashes() 获取哈希 API 可用的名称。密钥类型和签名方案可能会对可使用的摘要施加额外限制。可选的 options 参数控制 stream.Writable 的行为。

🌐 Creates and returns a Sign object that uses the given algorithm. Use crypto.getHashes() to obtain the names available to the hashing APIs. The key type and signature scheme can impose additional restrictions on which digests can be used. 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.