Skip to content

Commit 961e5c7

Browse files
Jami CogswellJami Cogswell
authored andcommitted
minor updates
1 parent 4df0fbc commit 961e5c7

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,15 @@ private class SymmetricSink extends InsufficientKeySizeSink {
124124

125125
// ********************** SINKS HELPER CLASSES & PREDICATES **********************
126126
/** A call to a method that initializes a key generator. */
127-
abstract class KeyGenInitMethodAccess extends MethodAccess {
127+
abstract private class KeyGenInitMethodAccess extends MethodAccess {
128128
/** Gets the `keysize` argument of this call. */
129129
Argument getKeySizeArg() { result = this.getArgument(0) }
130130
}
131131

132-
/** A call to the `initialize` method declared in `java.security.KeyPairGenerator`. */
132+
/**
133+
* A call to the `initialize` method declared in `java.security.KeyPairGenerator`
134+
* or to the `init` method declared in `java.security.AlgorithmParameterGenerator`.
135+
*/
133136
private class AsymmetricInitMethodAccess extends KeyGenInitMethodAccess {
134137
AsymmetricInitMethodAccess() {
135138
this.getMethod() instanceof KeyPairGeneratorInitMethod or
@@ -143,11 +146,14 @@ private class SymmetricInitMethodAccess extends KeyGenInitMethodAccess {
143146
}
144147

145148
/** An instance of a key generator. */
146-
abstract class KeyGeneratorObject extends CryptoAlgoSpec {
149+
abstract private class KeyGeneratorObject extends CryptoAlgoSpec {
147150
string getAlgoName() { result = this.getAlgoSpec().(StringLiteral).getValue().toUpperCase() }
148151
}
149152

150-
/** An instance of a `java.security.KeyPairGenerator`. */
153+
/**
154+
* An instance of a `java.security.KeyPairGenerator`
155+
* or of a `java.security.AlgorithmParameterGenerator`.
156+
*/
151157
private class AsymmetricKeyGenerator extends KeyGeneratorObject {
152158
AsymmetricKeyGenerator() {
153159
this instanceof JavaSecurityKeyPairGenerator or
@@ -165,7 +171,7 @@ private class SymmetricKeyGenerator extends KeyGeneratorObject {
165171
}
166172

167173
/** An instance of an algorithm specification. */
168-
abstract class AlgoSpec extends ClassInstanceExpr {
174+
abstract private class AlgoSpec extends ClassInstanceExpr {
169175
Argument getKeySizeArg() { result = this.getArgument(0) }
170176
}
171177

java/ql/test/query-tests/security/CWE-326/InsufficientKeySizeTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import javax.crypto.KeyGenerator;
22
import java.security.KeyPairGenerator;
33
import java.security.AlgorithmParameterGenerator;
4-
54
import java.security.spec.ECGenParameterSpec;
65
import java.security.spec.RSAKeyGenParameterSpec;
76
import java.security.spec.DSAGenParameterSpec;

0 commit comments

Comments
 (0)