subtle.deriveBits(algorithm, baseKey[, length])
-
algorithm
:<AlgorithmIdentifier> | <EcdhKeyDeriveParams> | <HkdfParams> | <Pbkdf2Params> -
baseKey
:<CryptoKey> -
返回:<Promise> 满足 <ArrayBuffer>
¥Returns: <Promise> Fulfills with an <ArrayBuffer>
使用 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'