subtle.deriveBits(algorithm, baseKey[, length])


使用 algorithm 中指定的方法和参数以及 baseKey 提供的密钥材料,subtle.deriveBits() 尝试生成 length 位。

🌐 Using the method and parameters specified in algorithm and the keying material provided by baseKey, subtle.deriveBits() attempts to generate length bits.

当未提供 length 或为 null 时,将生成给定算法的最大比特数。这适用于 'ECDH''X25519''X448' 算法,对于其他算法,length 必须是一个数字。

🌐 When length is not provided or null the maximum number of bits for a given algorithm is generated. This is allowed for the 'ECDH', 'X25519', and 'X448' algorithms, for other algorithms length is required to be a number.

如果成功,返回的 promise 将会被解析为一个包含生成数据的 <ArrayBuffer>

🌐 If successful, the returned promise will be resolved with an <ArrayBuffer> containing the generated data.

目前支持的算法包括:

🌐 The algorithms currently supported include:

  • 'ECDH'
  • 'X25519'
  • 'X448' 1
  • 'HKDF'
  • 'PBKDF2'