Skip to content

Commit 4c9cc5a

Browse files
bdrodesropwareJB
authored andcommitted
Adding inventory queries.
1 parent 7256faa commit 4c9cc5a

17 files changed

+304
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* @name All Asymmetric Algorithms
3+
* @description Finds all potential usage of asymmeric keys (RSA & ECC) using the supported libraries.
4+
* @kind problem
5+
* @id cpp/quantum-readiness/cbom/all-asymmetric-algorithms
6+
* @problem.severity error
7+
* @precision high
8+
* @tags security
9+
* cbom
10+
* cryptography
11+
*/
12+
13+
import cpp
14+
import experimental.crypto.Concepts
15+
16+
from AsymmetricAlgorithm alg
17+
select alg, "Use of algorithm " + alg.getName()
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* @name All Cryptographic Algorithms
3+
* @description Finds all potential usage of cryptographic algorithms usage using the supported libraries.
4+
* @kind problem
5+
* @id cpp/quantum-readiness/cbom/all-cryptographic-algorithms
6+
* @problem.severity error
7+
* @precision high
8+
* @tags security
9+
* cbom
10+
* cryptography
11+
*/
12+
13+
import cpp
14+
import experimental.crypto.Concepts
15+
16+
from CryptographicAlgorithm alg
17+
select alg, "Use of algorithm " + alg.getName()
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* @name Asymmetric Encryption Algorithms
3+
* @description Finds all potential usage of asymmeric keys for encryption or key exchange using the supported libraries.
4+
* @kind problem
5+
* @id cpp/quantum-readiness/cbom/all-asymmetric-encryption-algorithms
6+
* @problem.severity error
7+
* @precision high
8+
* @tags security
9+
* cbom
10+
* cryptography
11+
*/
12+
13+
import cpp
14+
import experimental.crypto.Concepts
15+
16+
from AsymmetricEncryptionAlgorithm alg
17+
select alg, "Use of algorithm " + alg.getEncryptionName()
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* @name Asymmetric Padding Schemes
3+
* @description Finds all potential usage of padding schemes used with asymmeric algorithms.
4+
* @kind problem
5+
* @id cpp/quantum-readiness/cbom/asymmetric-padding-schemes
6+
* @problem.severity error
7+
* @tags security
8+
* cbom
9+
* cryptography
10+
*/
11+
12+
import cpp
13+
import experimental.crypto.Concepts
14+
15+
// TODO: currently not modeled for any API
16+
from AsymmetricPadding alg
17+
select alg, "Use of algorithm " + alg.getPaddingName()
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* @name Authenticated Encryption Algorithms
3+
* @description Finds all potential usage of authenticated encryption schemes using the supported libraries.
4+
* @kind problem
5+
* @id cpp/quantum-readiness/cbom/authenticated-encryption-algorithms
6+
* @problem.severity error
7+
* @precision high
8+
* @tags security
9+
* cbom
10+
* cryptography
11+
*/
12+
13+
import cpp
14+
import experimental.crypto.Concepts
15+
16+
from AuthenticatedEncryptionAlgorithm alg
17+
select alg, "Use of algorithm " + alg.getAuthticatedEncryptionName()
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* @name Block cipher mode of operation
3+
* @description Finds all potential block cipher modes of operations using the supported libraries.
4+
* @kind problem
5+
* @id cpp/quantum-readiness/cbom/block-cipher-mode
6+
* @problem.severity error
7+
* @precision high
8+
* @tags security
9+
* cbom
10+
* cryptography
11+
*/
12+
13+
import cpp
14+
import experimental.crypto.Concepts
15+
16+
from BlockModeAlgorithm alg
17+
select alg, "Use of algorithm " + alg.getBlockModeName()
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* @name Initialization Vector (IV) or nonces
3+
* @description Finds all potential sources for initialization vectors (IV) or nonce used in block ciphers while using the supported libraries.
4+
* @kind problem
5+
* @id cpp/quantum-readiness/cbom/iv-sources
6+
* @problem.severity error
7+
* @precision high
8+
* @tags security
9+
* cbom
10+
* cryptography
11+
*/
12+
13+
import cpp
14+
import experimental.crypto.Concepts
15+
16+
// TODO: currently not modeled for any API
17+
from BlockModeAlgorithm alg
18+
select alg.getIVorNonce(), "Block mode IV/Nonce source"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* @name Unknown Initialization Vector (IV) or nonces
3+
* @description Finds all potentially unknown sources for initialization vectors (IV) or nonce used in block ciphers while using the supported libraries.
4+
* @kind problem
5+
* @id cpp/quantum-readiness/cbom/unkown-iv-sources
6+
* @problem.severity error
7+
* @precision high
8+
* @tags security
9+
* cbom
10+
* cryptography
11+
*/
12+
13+
import cpp
14+
import experimental.crypto.Concepts
15+
16+
// TODO: currently not modeled for any API
17+
from BlockModeAlgorithm alg
18+
where not alg.hasIVorNonce()
19+
select alg, "Block mode with unknown IV or Nonce configuration"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* @name Elliptic Curve Key length
3+
* @description Finds all potential key lengths for elliptic curve algorithms usage.
4+
* @kind problem
5+
* @id cpp/quantum-readiness/cbom/elliptic-curve-key-length
6+
* @problem.severity error
7+
* @precision high
8+
* @tags security
9+
* cbom
10+
* cryptography
11+
*/
12+
13+
import cpp
14+
import experimental.crypto.Concepts
15+
16+
from EllipticCurveAlgorithm alg, string size
17+
where
18+
if not exists(alg.getCurveBitSize())
19+
then size = "UNKNOWN SIZE"
20+
else size = alg.getCurveBitSize().toString()
21+
select alg, "Use of algorithm " + alg.getCurveName() + " with key size (in bits) " + size
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* @name Elliptic Curve Algorithms
3+
* @description Finds all potential usage of elliptic curve algorithms using the supported libraries.
4+
* @kind problem
5+
* @id cpp/quantum-readiness/cbom/elliptic-curve-algorithms
6+
* @problem.severity error
7+
* @precision high
8+
* @tags security
9+
* cbom
10+
* cryptography
11+
*/
12+
13+
import cpp
14+
import experimental.crypto.Concepts
15+
16+
from EllipticCurveAlgorithm alg
17+
select alg, "Use of algorithm " + alg.getCurveName()

0 commit comments

Comments
 (0)