subtle.importKey(format, keyData, algorithm, extractable, keyUsages)
format<string> 必须是'raw'、'pkcs8'、'spki'、'jwk'、'raw-secret'4、'raw-public'4 或'raw-seed'4 之一。keyData<ArrayBuffer> | <TypedArray> | <DataView> | <Buffer> | <Object>
algorithm<string> | <RsaHashedImportParams> | <EcKeyImportParams> | <HmacImportParams>
extractable<boolean>keyUsages<string[]> 见主要用途。- 返回:<Promise> 成功时会触发 <CryptoKey>。
此方法尝试将提供的 keyData 解释为给定的 format,使用提供的 algorithm、extractable 和 keyUsages 参数创建一个 <CryptoKey> 实例。如果导入成功,返回的 Promise 将会解析为键材料的 <CryptoKey> 表示。
🌐 This method attempts to interpret the provided keyData
as the given format to create a <CryptoKey> instance using the provided
algorithm, extractable, and keyUsages arguments. If the import is
successful, the returned promise will be resolved with a <CryptoKey>
representation of the key material.
如果导入 KDF 算法的密钥,extractable 必须为 false。
🌐 If importing KDF algorithm keys, extractable must be false.
查看 关键格式 了解当前支持的算法和格式。
🌐 See Key formats for the algorithms and formats currently supported.