subtle.deriveKey(algorithm, baseKey, derivedKeyAlgorithm, extractable, keyUsages)
algorithm<EcdhKeyDeriveParams> | <HkdfParams> | <Pbkdf2Params>baseKey<CryptoKey>derivedKeyAlgorithm<string> | <HmacImportParams>extractable<boolean>keyUsages<string[]> 见 主要用途。- 返回:<Promise> 在成功时以 <CryptoKey> 完成。
使用 algorithm 中指定的方法和参数,以及 baseKey 提供的密钥材料,此方法尝试根据 derivedKeyAlgorithm 中的方法和参数生成新的 <CryptoKey>。
【Using the method and parameters specified in algorithm, and the keying
material provided by baseKey, this method attempts to generate
a new <CryptoKey> based on the method and parameters in derivedKeyAlgorithm.】
调用此方法等同于调用 subtle.deriveBits() 来生成原始密钥材料,然后将结果传入 subtle.importKey() 方法,使用 deriveKeyAlgorithm、extractable 和 keyUsages 参数作为输入。
【Calling this method 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:】
'Argon2d'[^现代算法]'Argon2i'[^现代算法]'Argon2id'[^现代算法]'ECDH''HKDF''PBKDF2''X25519''X448'5