subtle.unwrapKey(format, wrappedKey, unwrappingKey, unwrapAlgo, unwrappedKeyAlgo, extractable, keyUsages)


在密码学中,"封装密钥" 指的是导出然后加密密钥材料。subtle.unwrapKey() 方法尝试解密封装密钥并创建 <CryptoKey> 实例。它等效于首先对加密密钥数据调用 subtle.decrypt()(使用 wrappedKeyunwrapAlgounwrappingKey 参数作为输入),然后使用 unwrappedKeyAlgoextractablekeyUsages 参数作为输入将结果传递给 subtle.importKey() 方法。如果成功,返回的 promise 将使用 <CryptoKey> 对象解析。

¥In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material. The subtle.unwrapKey() method attempts to decrypt a wrapped key and create a <CryptoKey> instance. It is equivalent to calling subtle.decrypt() first on the encrypted key data (using the wrappedKey, unwrapAlgo, and unwrappingKey arguments as input) then passing the results in to the subtle.importKey() method using the unwrappedKeyAlgo, extractable, and keyUsages arguments as inputs. If successful, the returned promise is resolved with a <CryptoKey> object.

目前支持的环绕算法包括:

¥The wrapping algorithms currently supported include:

  • 'RSA-OAEP'

  • 'AES-CTR'

  • 'AES-CBC'

  • 'AES-GCM'

  • 'AES-KW'

支持的解包密钥算法包括:

¥The unwrapped key algorithms supported include:

  • 'RSASSA-PKCS1-v1_5'

  • 'RSA-PSS'

  • 'RSA-OAEP'

  • 'ECDSA'

  • 'Ed25519' 1

  • 'Ed448' 1

  • 'ECDH'

  • 'X25519' 1

  • 'X448' 1

  • 'HMAC'

  • 'AES-CTR'

  • 'AES-CBC'

  • 'AES-GCM'

  • 'AES-KW'