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.

安全上下文: 此项功能仅在一些支持的浏览器安全上下文(HTTPS)中可用。

备注: 此特性在 Web Worker 中可用。

Web Crypto APICryptoKey 接口表示从特定 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 GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
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.

参见