subtle.wrapKey(format, key, wrappingKey, wrapAlgo)


在密码学中,“封装密钥”是指导出然后加密密钥材料。subtle.wrapKey() 方法将密钥材料导出为 format 指定的格式,然后使用 wrapAlgo 指定的方法和参数以及 wrappingKey 提供的密钥材料进行加密。这相当于使用 formatkey 作为参数调用 subtle.exportKey(),然后将结果传递给 subtle.encrypt() 方法,并使用 wrappingKeywrapAlgo 作为输入。如果成功,返回的 Promise 将会被解析为包含加密密钥数据的 <ArrayBuffer>

【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'