File tree Expand file tree Collapse file tree
main/java/crypto/analysis
HeadlessJavaScanner/src/main/java/de/fraunhofer/iem/scanner Expand file tree Collapse file tree Original file line number Diff line number Diff line change 120120 <version >3.17.0</version >
121121 <scope >test</scope >
122122 </dependency >
123+ <dependency >
124+ <groupId >org.bouncycastle</groupId >
125+ <artifactId >bcprov-jdk18on</artifactId >
126+ <version >1.80</version >
127+ <scope >test</scope >
128+ </dependency >
123129 <dependency >
124130 <groupId >com.google.crypto.tink</groupId >
125131 <artifactId >tink</artifactId >
Original file line number Diff line number Diff line change 2525import crypto .predicates .PredicateAnalysis ;
2626import crysl .CrySLParser ;
2727import crysl .rule .CrySLRule ;
28+ import java .io .File ;
2829import java .io .IOException ;
30+ import java .nio .file .Path ;
2931import java .util .ArrayList ;
3032import java .util .Collection ;
3133import java .util .HashMap ;
@@ -55,9 +57,21 @@ public CryptoScanner() {
5557 }
5658
5759 public final Collection <CrySLRule > readRules (String rulesetPath ) {
60+ return readRules (rulesetPath , "" );
61+ }
62+
63+ public final Collection <CrySLRule > readRules (String rulesetPath , String classPath ) {
5864 try {
59- CrySLParser parser = new CrySLParser ();
60- return parser .parseRulesFromDirectory (rulesetPath );
65+ if (classPath .isEmpty ()) {
66+ CrySLParser parser = new CrySLParser ();
67+ return parser .parseRulesFromPath (rulesetPath );
68+ } else {
69+ Collection <String > pathSplits = Set .of (classPath .split (File .pathSeparator ));
70+ Collection <Path > paths = pathSplits .stream ().map (Path ::of ).toList ();
71+
72+ CrySLParser parser = new CrySLParser (paths );
73+ return parser .parseRulesFromPath (rulesetPath );
74+ }
6175 } catch (IOException e ) {
6276 throw new CryptoAnalysisException ("Could not read rules: " + e .getMessage ());
6377 }
Original file line number Diff line number Diff line change @@ -103,6 +103,7 @@ public void beforeTestCaseExecution() {
103103 scanner .addResultsListener (resultsListener );
104104
105105 scanner .scan (frameworkScope , rules );
106+ scanner .reset ();
106107
107108 // Evaluate results
108109 Collection <Assertion > unsound = new ArrayList <>();
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ public int getTimeout() {
7979 public void scan () {
8080 // Read rules
8181 LOGGER .info ("Reading rules from {}" , settings .getRulesetPath ());
82- Collection <CrySLRule > rules = super . readRules (settings .getRulesetPath ());
82+ Collection <CrySLRule > rules = readRules (settings .getRulesetPath (), settings . getSootPath ());
8383 LOGGER .info ("Found {} rules in {}" , rules .size (), settings .getRulesetPath ());
8484
8585 // Initialize the reporters before the analysis to catch errors early
Original file line number Diff line number Diff line change 110110 <artifactId >slf4j-simple</artifactId >
111111 <version >2.0.17</version >
112112 </dependency >
113- <dependency >
114- <groupId >org.bouncycastle</groupId >
115- <artifactId >bcprov-jdk18on</artifactId >
116- <version >1.80</version >
117- <scope >test</scope >
118- </dependency >
119113 </dependencies >
120114
121115 <build >
130124 <ignoredUnusedDeclaredDependencies >
131125 <!-- The logger api requires a concrete provider that is not used by this project: https://www.slf4j.org/manual.html -->
132126 <ignoredUnusedDeclaredDependency >org.slf4j:slf4j-simple</ignoredUnusedDeclaredDependency >
133- <ignoredUnusedDeclaredDependencies >org.bouncycastle:bcprov-jdk18on</ignoredUnusedDeclaredDependencies >
134127 </ignoredUnusedDeclaredDependencies >
135128 </configuration >
136129 <executions >
You can’t perform that action at this time.
0 commit comments