阿西河

所有教程

公众号
🌙
阿西河前端的公众号

我的收藏

    最近访问  (文章)

      教程列表

      抓包专区
      测试专区

      Node.js crypto sign.sign

      Node.js crypto sign.sign(privateKey[, outputEncoding]) 版本历史

      版本变更
      v8.0.0Support for RSASSA-PSS and additional options was added.
      v0.1.92新增于: v0.1.92
      • privateKey < string> | < Object>
        • key < string>
        • passphrase < string>
        • padding < integer>
        • saltLength < integer>
      • outputEncoding < string> The encoding of the return value.
      • Returns: < Buffer> | < string>

      Calculates the signature on all the data passed through using either sign.update() or sign.write().

      The privateKey argument can be an object or a string. If privateKey is a string, it is treated as a raw key with no passphrase. If privateKey is an object, it must contain one or more of the following properties:

      • key: < string> - PEM encoded private key (required)

      • passphrase: < string> - passphrase for the private key

      • padding: < integer> - Optional padding value for RSA, one of the following:

        • crypto.constants.RSA_PKCS1_PADDING (default)
        • crypto.constants.RSA_PKCS1_PSS_PADDING

        Note that RSA_PKCS1_PSS_PADDING will use MGF1 with the same hash function used to sign the message as specified in section 3.1 of RFC 4055.

      • saltLength: < integer> - salt length for when padding is RSA_PKCS1_PSS_PADDING. The special value crypto.constants.RSA_PSS_SALTLEN_DIGEST sets the salt length to the digest size, crypto.constants.RSA_PSS_SALTLEN_MAX_SIGN (default) sets it to the maximum permissible value.

      If outputEncoding is provided a string is returned; otherwise a Buffer is returned.

      The Sign object can not be again used after sign.sign() method has been called. Multiple calls to sign.sign() will result in an error being thrown.


      更多内容请参考:Node.js crypto 加密,或者通过 点击对应菜单 进行查看;


      目录
      本文目录
      目录