静态方法: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”时要派生的密钥算法,要么是在操作为“wrapKey”时要导出以进行封装的密钥算法,要么是在操作为“unwrapKey”时解封后要导入的密钥算法,或者是在操作为“encapsulateKey”或“decapsulateKey”时加/解封密钥后要导入的密钥算法。默认值: 当操作为“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.