Skip to content

Commit e76ced1

Browse files
committed
Crypto: Updating weak asymmetric key gen to include key exchange.
1 parent d68f3cf commit e76ced1

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

java/ql/src/experimental/quantum/Examples/WeakAsymmetricKeyGenSize.ql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ where
1717
key.getCreatingOperation().getAKeySizeSource().asElement().(Literal).getValue().toInt() = keySize and
1818
alg = key.getAKnownAlgorithm() and // NOTE: if algorithm is not known (doesn't bind) we need a separate query
1919
not alg instanceof Crypto::EllipticCurveNode and // Elliptic curve sizes are handled separately and are more tied directly to the algorithm
20+
alg instanceof Crypto::AsymmetricAlgorithmNode and
2021
keySize < 2048
2122
select key, "Use of weak asymmetric key size (" + keySize.toString() + " bits) for algorithm $@",
2223
alg, alg.getAlgorithmName()

shared/quantum/codeql/quantum/experimental/Model.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1467,7 +1467,8 @@ module CryptographyBase<LocationSig Location, InputSig<Location> Input> {
14671467
class AsymmetricAlgorithmNode extends TKeyCreationCandidateAlgorithm instanceof AlgorithmNode {
14681468
AsymmetricAlgorithmNode() {
14691469
this instanceof EllipticCurveNode or
1470-
this.(KeyOperationAlgorithmNode).isAsymmetric()
1470+
this.(KeyOperationAlgorithmNode).isAsymmetric() or
1471+
this instanceof KeyAgreementAlgorithmNode
14711472
}
14721473

14731474
string toString() { result = super.toString() }

0 commit comments

Comments
 (0)