CryptoKey
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
备注: 此特性在 Web Worker 中可用。
Web Crypto API 的 CryptoKey
接口表示从特定 SubtleCrypto
方法(generateKey()
、deriveKey()
、importKey()
或 unwrapKey()
)导出的密码学密钥。
出于安全考虑,CryptoKey
接口仅在安全上下文中可用。
实例属性
CryptoKey.type
只读-
该对象所表示的密钥类型可以是以下值之一:
"secret"
、"private"
或"public"
。 CryptoKey.extractable
只读-
一个布尔值,表示原始信息是否能使用
SubtleCrypto.exportKey()
或SubtleCrypto.wrapKey()
导出。 CryptoKey.algorithm
只读-
一个描述可使用此密钥的算法及任何关联的额外参数的对象。
CryptoKey.usages
只读-
一个字符串的数组,指明密钥的用途。数组元素可能的值有:
"encrypt"
、"decrypt"
、"sign"
、"verify"
、"deriveKey"
、"deriveBits"
、"wrapKey"
和"unwrapKey"
。
示例
规范
Specification |
---|
Web Cryptography API # cryptokey-interface |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
CryptoKey | ||||||||||||||
algorithm | ||||||||||||||
extractable | ||||||||||||||
type | ||||||||||||||
usages |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- Partial support
- Partial support
- Has more compatibility info.
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.