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


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

稳定性: 1.1 - 积极开发

¥Stability: 1.1 - Active development

  • operation <string> "encrypt"、"decrypt"、"sign"、"verify"、"digest"、"generateKey"、"deriveKey"、"deriveBits"、"importKey"、"exportKey"、"getPublicKey"、"wrapKey"、"unwrapKey"、"encapsulateBits"、"encapsulateKey"、"decapsulateBits" 或 "decapsulateKey"

    ¥operation <string> "encrypt", "decrypt", "sign", "verify", "digest", "generateKey", "deriveKey", "deriveBits", "importKey", "exportKey", "getPublicKey", "wrapKey", "unwrapKey", "encapsulateBits", "encapsulateKey", "decapsulateBits", or "decapsulateKey"

  • algorithm <string>

  • lengthOrAdditionalAlgorithm <null> | <number> | <string> | <undefined> 根据操作的不同,此选项可以被忽略:操作为 "deriveBits" 时,长度参数的值;操作为 "deriveKey" 时,要派生的密钥算法;操作为 "wrapKey" 时,封装前要导出的密钥算法;操作为 "unwrapKey" 时,解包后要导入的密钥算法;操作为 "encapsulateKey" 或 "decapsulateKey" 时,封装/解封装密钥后要导入的密钥算法。默认值:当操作为 "deriveBits" 时为 null,否则为 undefined

    ¥lengthOrAdditionalAlgorithm <null> | <number> | <string> | <undefined> Depending on the operation this is either ignored, the value of the length argument when operation is "deriveBits", the algorithm of key to be derived when operation is "deriveKey", the algorithm of key to be exported before wrapping when operation is "wrapKey", the algorithm of key to be imported after unwrapping when operation is "unwrapKey", or the algorithm of key to be imported after en/decapsulating a key when operation is "encapsulateKey" or "decapsulateKey". Default: null when operation is "deriveBits", undefined otherwise.

  • 返回:<boolean> 指示实现是否支持给定操作

    ¥Returns: <boolean> Indicating whether the implementation supports the given operation

允许在 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.