subtle.unwrapKey(format, wrappedKey, unwrappingKey, unwrapAlgorithm, unwrappedKeyAlgorithm, extractable, keyUsages)


在密码学中,“封装密钥”是指导出然后加密密钥材料。这个方法尝试解密一个已封装的密钥并创建一个 <CryptoKey> 实例。它等同于先在加密的密钥数据上调用 subtle.decrypt()(使用 wrappedKeyunwrapAlgorithmunwrappingKey 作为输入参数),然后将结果传递给 subtle.importKey() 方法,使用 unwrappedKeyAlgorithmextractablekeyUsages 作为输入参数。如果成功,返回的 promise 会被解析为一个 <CryptoKey> 对象。

🌐 In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material. This 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, unwrapAlgorithm, and unwrappingKey arguments as input) then passing the results to the subtle.importKey() method using the unwrappedKeyAlgorithm, extractable, and keyUsages arguments as inputs. If successful, the returned promise is resolved with a <CryptoKey> object.

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

🌐 The wrapping algorithms currently supported include:

  • 'AES-CBC'
  • 'AES-CTR'
  • 'AES-GCM'
  • 'AES-KW'
  • 'AES-OCB'[^现代算法]
  • 'ChaCha20-Poly1305'4
  • 'RSA-OAEP'

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

🌐 The unwrapped key algorithms supported include:

  • 'AES-CBC'
  • 'AES-CTR'
  • 'AES-GCM'
  • 'AES-KW'
  • 'AES-OCB'[^现代算法]
  • 'ChaCha20-Poly1305'4
  • 'ECDH'
  • 'ECDSA'
  • 'Ed25519'
  • 'Ed448'5
  • 'HMAC'
  • 'KMAC128'4
  • 'KMAC256'4
  • 'ML-DSA-44'[^现代算法]
  • 'ML-DSA-65'[^现代算法]
  • 'ML-DSA-87'[^现代算法]
  • 'ML-KEM-512'[^现代算法]
  • 'ML-KEM-768'[^现代算法]
  • 'ML-KEM-1024'[^现代算法]
  • 'RSA-OAEP'
  • 'RSA-PSS'
  • 'RSASSA-PKCS1-v1_5'
  • 'X25519'
  • 'X448'5