Crypto
接口提供了基本的加密功能,可用于当前的上下文中。它允许访问一个密码强度的随机数生成器和 cryptographic primitives。
该接口在 Web 中可以通过 Window.crypto
属性来访问。
属性
该接口实现的属性定义在 RandomSource
中。
Crypto.subtle
只读- 返回一个
SubtleCrypto
对象, 用来访问公共的 cryptographic primitives,例如哈希、签名、加密以及解密。
方法
该接口实现的方法定义在 RandomSource
中。
RandomSource.getRandomValues()
- 使用 cryptographically sound 随机数填充
TypedArray
。
规范
Specification | Status | Comment |
---|---|---|
Web Cryptography API Crypto |
Recommendation | Initial definition |
浏览器兼容
BCD tables only load in the browser
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.