ConceptsShared: Add BlockMode#matchesString(string) predicate

This commit is contained in:
Alex Ford
2023-02-02 20:27:52 +00:00
parent 61095b3c58
commit e5dfbe2c8d
3 changed files with 12 additions and 0 deletions

View File

@@ -91,6 +91,10 @@ module Cryptography {
/** Holds if this block mode is considered to be insecure. */ /** Holds if this block mode is considered to be insecure. */
predicate isWeak() { this = "ECB" } predicate isWeak() { this = "ECB" }
/** Holds if the given string appears to match this block mode. */
bindingset[s]
predicate matchesString(string s) { s.toUpperCase().matches("%" + this + "%") }
} }
} }

View File

@@ -91,6 +91,10 @@ module Cryptography {
/** Holds if this block mode is considered to be insecure. */ /** Holds if this block mode is considered to be insecure. */
predicate isWeak() { this = "ECB" } predicate isWeak() { this = "ECB" }
/** Holds if the given string appears to match this block mode. */
bindingset[s]
predicate matchesString(string s) { s.toUpperCase().matches("%" + this + "%") }
} }
} }

View File

@@ -91,6 +91,10 @@ module Cryptography {
/** Holds if this block mode is considered to be insecure. */ /** Holds if this block mode is considered to be insecure. */
predicate isWeak() { this = "ECB" } predicate isWeak() { this = "ECB" }
/** Holds if the given string appears to match this block mode. */
bindingset[s]
predicate matchesString(string s) { s.toUpperCase().matches("%" + this + "%") }
} }
} }