Skip to content

Commit ac798f2

Browse files
committed
Cipher Algorithm Slices
1 parent ac3675b commit ac798f2

File tree

4 files changed

+35
-0
lines changed

4 files changed

+35
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* @name Detects known asymmetric cipher algorithms
3+
* @id java/crypto_inventory_slices/known_symmetric_cipher_algorithm
4+
* @kind problem
5+
*/
6+
7+
import java
8+
import experimental.Quantum.Language
9+
10+
from Crypto::KeyOperationAlgorithmNode a
11+
where a.getAlgorithmType() instanceof Crypto::KeyOpAlg::AsymmetricCipherAlgorithm
12+
select a, "Instance of asymmetric cipher algorithm " + a.getAlgorithmName()
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* @name Detects known cipher algorithms
3+
* @id java/crypto_inventory_slices/known_cipher_algorithm
4+
* @kind problem
5+
*/
6+
7+
import java
8+
import experimental.Quantum.Language
9+
10+
// TODO: should there be a cipher algorithm node?
11+
from Crypto::KeyOperationAlgorithmNode a
12+
where
13+
a.getAlgorithmType() instanceof Crypto::KeyOpAlg::AsymmetricCipherAlgorithm or
14+
a.getAlgorithmType() instanceof Crypto::KeyOpAlg::SymmetricCipherAlgorithm
15+
select a, "Instance of cipher algorithm " + a.getAlgorithmName()

java/ql/src/experimental/Quantum/InventorySlices/KnownSymmetricCipherAlgorithm.ql

Whitespace-only changes.

shared/cryptography/codeql/cryptography/Model.qll

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,14 @@ module CryptographyBase<LocationSig Location, InputSig<Location> Input> {
659659

660660
TSymmetricCipherType getType() { result = type }
661661
}
662+
663+
class AsymmetricCipherAlgorithm extends Algorithm, TAsymmetricCipher {
664+
TAsymmetricCipherType type;
665+
666+
AsymmetricCipherAlgorithm() { this = TAsymmetricCipher(type) }
667+
668+
TAsymmetricCipherType getType() { result = type }
669+
}
662670
}
663671

664672
/**

0 commit comments

Comments
 (0)