安全上下文
此特征只可用于 安全上下文 (HTTPS),在某些或所有 支持浏览器 .

CryptoKey 接口在 Web 加密 API represents a cryptographic key obtained from one of the SubtleCrypto 方法 generateKey() , deriveKey() , importKey() ,或 unwrapKey() .

For security reasons, the CryptoKey interface can only be used in a secure context .

特性

CryptoKey.type

String which may take one of the following values:

CryptoKey.extractable

布尔 indicating whether or not the key may be extracted using SubtleCrypto.exportKey() or SubtleCrypto.wrapKey() .

  • true : The key may be extracted.
  • false The key may not be extracted. exportKey() or wrapKey() will throw an exception if used to extract this key.
CryptoKey.algorithm

An object describing the algorithm for which this key can be used and any associated extra parameters.

CryptoKey.usages

数组 of strings, indicating what can be done with the key. Possible values for array elements are:

范例

The examples for SubtleCrypto methods often use CryptoKey objects. For example:

规范

规范 状态 注释
Web Cryptography API
The definition of 'CryptoKey' in that specification.
推荐 初始定义。

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
CryptoKey Chrome 37 Edge ≤18 Firefox 34 IE No Opera Yes Safari No WebView Android 37 Chrome Android 37 Firefox Android 34 Opera Android Yes Safari iOS No Samsung Internet Android 3.0
algorithm Chrome 37 Edge 12 Firefox 34 IE No Opera Yes Safari No WebView Android 37 Chrome Android 37 Firefox Android 34 Opera Android Yes Safari iOS No Samsung Internet Android 3.0
extractable Chrome 37 Edge 12 Firefox 34 IE No Opera Yes Safari No WebView Android 37 Chrome Android 37 Firefox Android 34 Opera Android Yes Safari iOS No Samsung Internet Android 3.0
Secure context required Chrome 60 Edge 79 Firefox 75 IE No Opera 47 Safari No WebView Android 60 Chrome Android 60 Firefox Android No Opera Android 47 Safari iOS No Samsung Internet Android No
type Chrome 37 Edge 12 Firefox 34 IE No Opera Yes Safari No WebView Android 37 Chrome Android 37 Firefox Android 34 Opera Android Yes Safari iOS No Samsung Internet Android 3.0
usages Chrome 37 Edge 12 Firefox 34 IE No Opera Yes Safari No WebView Android 37 Chrome Android 37 Firefox Android 34 Opera Android Yes Safari iOS No Samsung Internet Android 3.0

图例

完整支持

完整支持

不支持

不支持

另请参阅

元数据

  • 最后修改:

版权所有  © 2014-2026 乐数软件    

工业和信息化部: 粤ICP备14079481号-1