Skip to content

Commit c2b342f

Browse files
authored
Merge pull request #18084 from github/aibaars/java-sha3
Java: add SHA3 family to list of secure crypto algorithms
2 parents d5c8dfd + 5eb91fd commit c2b342f

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

java/ql/lib/semmle/code/java/security/Encryption.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ string getASecureAlgorithmName() {
247247
result =
248248
[
249249
"RSA", "SHA-?256", "SHA-?512", "CCM", "GCM", "AES(?![^a-zA-Z](ECB|CBC/PKCS[57]Padding))",
250-
"Blowfish", "ECIES"
250+
"Blowfish", "ECIES", "SHA3-(256|384|512)"
251251
]
252252
}
253253

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
* Added SHA3 to the list of secure hashing algorithms. As a result the `java/potentially-weak-cryptographic-algorithm` query should no longer flag up uses of SHA3.

java/ql/test/query-tests/security/CWE-327/semmle/tests/WeakHashing.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,8 @@ void hashing() throws NoSuchAlgorithmException, IOException {
2525

2626
// OK: Property does not exist and default is secure
2727
MessageDigest ok2 = MessageDigest.getInstance(props.getProperty("hashAlg3", "SHA-256"));
28+
29+
// GOOD: Using a strong hashing algorithm
30+
MessageDigest ok3 = MessageDigest.getInstance("SHA3-512");
2831
}
29-
}
32+
}

0 commit comments

Comments
 (0)