subtle.exportKey(format, key)
版本历史
| 版本 | 变更 |
|---|---|
| v18.4.0 | 添加了 |
| v15.9.0 | 删除了 |
| v15.0.0 | 新增于: v15.0.0 |
-
format:<string> 必须是'raw'、'pkcs8'、'spki'或'jwk'之一。\
format: <string> Must be one of'raw','pkcs8','spki', or'jwk'. -
key:<CryptoKey> -
返回:<Promise> 包含 <ArrayBuffer> | <Object>。
\Returns: <Promise> containing <ArrayBuffer> | <Object>.
如果支持,将给定的密钥导出为指定的格式。
\Exports the given key into the specified format, if supported.
如果 <CryptoKey> 不可提取,则返回的 promise 将被拒绝。
\If the <CryptoKey> is not extractable, the returned promise will reject.
当 format 为 'pkcs8' 或 'spki' 且导出成功时,返回的 promise 将使用包含导出密钥数据的 <ArrayBuffer> 进行解析。
\When format is either 'pkcs8' or 'spki' and the export is successful,
the returned promise will be resolved with an <ArrayBuffer> containing the
exported key data.
当 format 为 'jwk' 且导出成功时,返回的 promise 将使用符合 JSON 网络密钥 规范的 JavaScript 对象解析。
\When format is 'jwk' and the export is successful, the returned promise
will be resolved with a JavaScript object conforming to the JSON Web Key
specification.
| 密钥类型 | 'spki' | 'pkcs8' | 'jwk' | 'raw' |
|---|---|---|---|---|
'AES-CBC' | ✔ | ✔ | ||
'AES-CTR' | ✔ | ✔ | ||
'AES-GCM' | ✔ | ✔ | ||
'AES-KW' | ✔ | ✔ | ||
'ECDH' | ✔ | ✔ | ✔ | ✔ |
'ECDSA' | ✔ | ✔ | ✔ | ✔ |
'Ed25519' 1 | ✔ | ✔ | ✔ | ✔ |
'Ed448' 1 | ✔ | ✔ | ✔ | ✔ |
'HDKF' | ||||
'HMAC' | ✔ | ✔ | ||
'PBKDF2' | ||||
'RSA-OAEP' | ✔ | ✔ | ✔ | |
'RSA-PSS' | ✔ | ✔ | ✔ | |
'RSASSA-PKCS1-v1_5' | ✔ | ✔ | ✔ |