subtle.wrapKey(format, key, wrappingKey, wrapAlgo)
-
format
:<string> 必须是'raw'
、'pkcs8'
、'spki'
或'jwk'
之一。¥
format
: <string> Must be one of'raw'
,'pkcs8'
,'spki'
, or'jwk'
. -
key
:<CryptoKey> -
wrappingKey
:<CryptoKey> -
wrapAlgo
:<AlgorithmIdentifier> | <RsaOaepParams> | <AesCtrParams> | <AesCbcParams> | <AesGcmParams> -
返回:<Promise> 包含 <ArrayBuffer>
¥Returns: <Promise> containing <ArrayBuffer>
在密码学中,"封装密钥" 指的是导出然后加密密钥材料。subtle.wrapKey()
方法将密钥材料导出为 format
标识的格式,然后使用 wrapAlgo
指定的方法和参数以及 wrappingKey
提供的密钥材料对其进行加密。它相当于使用 format
和 key
作为参数调用 subtle.exportKey()
,然后将结果传递给使用 wrappingKey
和 wrapAlgo
作为输入的 subtle.encrypt()
方法。如果成功,将使用包含加密密钥数据的 <ArrayBuffer> 解析返回的 promise。
¥In cryptography, "wrapping a key" refers to exporting and then encrypting the
keying material. The subtle.wrapKey()
method exports the keying material into
the format identified by format
, then encrypts it using the method and
parameters specified by wrapAlgo
and the keying material provided by
wrappingKey
. It is the equivalent to calling subtle.exportKey()
using
format
and key
as the arguments, then passing the result to the
subtle.encrypt()
method using wrappingKey
and wrapAlgo
as inputs. If
successful, the returned promise will be resolved with an <ArrayBuffer>
containing the encrypted key data.
目前支持的环绕算法包括:
¥The wrapping algorithms currently supported include:
-
'RSA-OAEP'
-
'AES-CTR'
-
'AES-CBC'
-
'AES-GCM'
-
'AES-KW'