静态方法:SubtleCrypto.supports(operation, algorithm[, lengthOrAdditionalAlgorithm])


【Static method: SubtleCrypto.supports(operation, algorithm[, lengthOrAdditionalAlgorithm])

稳定性: 1.1 - 处于活跃开发中

  • operation <string> “加密”、“解密”、“签名”、“验证”、“摘要”、“生成密钥”、“派生密钥”、“派生比特”、“导入密钥”、“导出密钥”、“获取公钥”、“封装密钥”、“解封密钥”、“封装比特”、“封装密钥”、“解封比特”或“解封密钥”
  • algorithm <string>
  • lengthOrAdditionalAlgorithm <null> | <number> | <string> | <undefined> 根据操作的不同,这个参数可能被忽略,在操作为“deriveBits”时表示 length 参数的值,在操作为“deriveKey”时表示要导出的 key 的算法,在操作为“wrapKey”时表示在封装 key 之前要导出的 key 的算法,在操作为“unwrapKey”时表示在解封 key 后要导入的 key 的算法,或者在操作为“encapsulateKey”或“decapsulateKey”时表示在加密/解密封装后的 key 后要导入的 key 的算法。默认值: 当操作为“deriveBits”时为 null,否则为 undefined
  • 返回值:<boolean> 表示该实现是否支持给定的操作

允许在 Web Crypto API 中进行功能检测,可以用来检测给定的算法标识符(包括其参数)是否支持给定的操作。

【Allows feature detection in Web Crypto API, which can be used to detect whether a given algorithm identifier (including its parameters) is supported for the given operation.】

有关此方法的示例用法,请参见 检查运行时算法支持

【See Checking for runtime algorithm support for an example use of this method.】