subtle.unwrapKey(format, wrappedKey, unwrappingKey, unwrapAlgo, unwrappedKeyAlgo, extractable, keyUsages)
format<string> 必须是'raw'、'pkcs8'、'spki'、'jwk'、'raw-secret'4、'raw-public'4 或'raw-seed'4 之一。wrappedKey<ArrayBuffer> | <TypedArray> | <DataView> | <Buffer>unwrappingKey<CryptoKey>
unwrapAlgo<string> | <RsaOaepParams> | <AesCtrParams> | <AesCbcParams>unwrappedKeyAlgo<string> | <RsaHashedImportParams> | <EcKeyImportParams> | <HmacImportParams>
extractable<boolean>keyUsages<string[]> 见 主要用途。- 返回:<Promise> 在成功时以 <CryptoKey> 完成。
在密码学中,“封装密钥”指的是导出然后加密密钥材料。这种方法尝试解密封装的密钥并创建一个 <CryptoKey> 实例。它相当于先对加密密钥数据调用 subtle.decrypt()(使用 wrappedKey、unwrapAlgo 和 unwrappingKey 参数作为输入),然后将结果传递给 subtle.importKey() 方法,使用 unwrappedKeyAlgo、extractable 和 keyUsages 参数作为输入。如果成功,返回的 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,
unwrapAlgo, and unwrappingKey arguments as input) then passing the results
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:】
'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'5'KMAC256'5'ML-DSA-44'[^现代算法]'ML-DSA-65'[^现代算法]'ML-DSA-87'[^现代算法]'ML-KEM-512'[^现代算法]'ML-KEM-768'[^现代算法]'ML-KEM-1024'4v'RSA-OAEP''RSA-PSS''RSASSA-PKCS1-v1_5''X25519''X448'5