forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWeakAsymmetric.ql
More file actions
24 lines (22 loc) · 771 Bytes
/
WeakAsymmetric.ql
File metadata and controls
24 lines (22 loc) · 771 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/**
* @name Weak Asymmetric Key Size
* @id java/quantum/weak-asymmetric-key-size
* @description An asymmetric cipher with a short key size is in use
* @kind problem
* @problem.severity error
* @precision high
* @tags quantum
* experimental
*/
import java
import experimental.quantum.Language
from Crypto::KeyOperationAlgorithmNode op, DataFlow::Node configSrc, int keySize, string algName
where
keySize = op.getKeySizeFixed() and
keySize < 2048 and
algName = op.getAlgorithmName() and
// Can't be an elliptic curve
not Crypto::isEllipticCurveAlgorithmName(algName)
select op,
"Use of weak asymmetric key size (" + keySize.toString() + " bits) for algorithm " +
algName.toString() + " at config source $@", configSrc, configSrc.toString()