subtle.deriveKey(algorithm, baseKey, derivedKeyAlgorithm, extractable, keyUsages)


使用 algorithm 中指定的方法和参数,以及由 baseKey 提供的密钥材料,subtle.deriveKey() 尝试根据 derivedKeyAlgorithm 中的方法和参数生成一个新的 <CryptoKey>

🌐 Using the method and parameters specified in algorithm, and the keying material provided by baseKey, subtle.deriveKey() attempts to generate a new <CryptoKey> based on the method and parameters in derivedKeyAlgorithm.

调用 subtle.deriveKey() 相当于先调用 subtle.deriveBits() 生成原始密钥材料,然后将结果传入 subtle.importKey() 方法,并使用 deriveKeyAlgorithmextractablekeyUsages 参数作为输入。

🌐 Calling subtle.deriveKey() is equivalent to calling subtle.deriveBits() to generate raw keying material, then passing the result into the subtle.importKey() method using the deriveKeyAlgorithm, extractable, and keyUsages parameters as input.

目前支持的算法包括:

🌐 The algorithms currently supported include:

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