@@ -71,7 +71,7 @@ public NamedCurvesProbe(ScannerConfig config, ParallelExecutor parallelExecutor)
71
71
@ Override
72
72
public ProbeResult executeTest () {
73
73
try {
74
- List <NamedGroup > groupsRsa = new LinkedList <>();
74
+ Map <NamedGroup , NamedCurveWitness > groupsRsa = new HashMap <>();
75
75
Map <NamedGroup , NamedCurveWitness > groupsEcdsaStatic = new HashMap <>();
76
76
Map <NamedGroup , NamedCurveWitness > groupsEcdsaEphemeral = new HashMap <>();
77
77
Map <NamedGroup , NamedCurveWitness > groupsTls13 = new HashMap <>();
@@ -108,14 +108,14 @@ public ProbeResult executeTest() {
108
108
}
109
109
}
110
110
111
- private List <NamedGroup > getSupportedNamedGroupsRsa () {
111
+ private Map <NamedGroup , NamedCurveWitness > getSupportedNamedGroupsRsa () {
112
112
113
113
Config tlsConfig = getBasicConfig ();
114
114
tlsConfig .setDefaultClientSupportedCiphersuites (getEcRsaCiphersuites ());
115
115
List <NamedGroup > toTestList = new ArrayList <>(Arrays .asList (NamedGroup .values ()));
116
116
TlsContext context ;
117
117
NamedGroup selectedGroup = null ;
118
- List <NamedGroup > supportedNamedCurves = new LinkedList <>();
118
+ Map <NamedGroup , NamedCurveWitness > supportedNamedCurves = new HashMap <>();
119
119
do {
120
120
context = testCurves (toTestList , tlsConfig );
121
121
@@ -127,7 +127,7 @@ private List<NamedGroup> getSupportedNamedGroupsRsa() {
127
127
break ;
128
128
}
129
129
130
- supportedNamedCurves .add (selectedGroup );
130
+ supportedNamedCurves .put (selectedGroup , new NamedCurveWitness ( context . getSelectedCipherSuite ()) );
131
131
toTestList .remove (selectedGroup );
132
132
}
133
133
} while (context != null && toTestList .size () > 0 );
@@ -177,10 +177,10 @@ private Map<NamedGroup, NamedCurveWitness> getSupportedNamedGroupsEcdsa(List<Cip
177
177
}
178
178
if (cipherSuites .get (0 ).isEphemeral ()) {
179
179
namedCurveMap .put (selectedGroup , new NamedCurveWitness (null , certificateGroup , null ,
180
- certificateSigGroup ));
180
+ certificateSigGroup , context . getSelectedCipherSuite () ));
181
181
} else {
182
182
namedCurveMap .put (selectedGroup , new NamedCurveWitness (certificateGroup , null ,
183
- certificateSigGroup , null ));
183
+ certificateSigGroup , null , context . getSelectedCipherSuite () ));
184
184
185
185
}
186
186
@@ -392,7 +392,7 @@ private Map<NamedGroup, NamedCurveWitness> getTls13SupportedGroups() {
392
392
}
393
393
394
394
namedCurveMap .put (selectedGroup , new NamedCurveWitness (null , certificateGroup , null ,
395
- certificateSigGroup ));
395
+ certificateSigGroup , context . getSelectedCipherSuite () ));
396
396
toTestList .remove (selectedGroup );
397
397
}
398
398
} while (context != null && !toTestList .isEmpty ());
@@ -433,11 +433,11 @@ public TlsContext getTls13SupportedGroup(List<NamedGroup> groups) {
433
433
}
434
434
}
435
435
436
- private Map <NamedGroup , NamedCurveWitness > composeFullMap (List <NamedGroup > rsaGroups ,
436
+ private Map <NamedGroup , NamedCurveWitness > composeFullMap (Map <NamedGroup , NamedCurveWitness > rsaGroups ,
437
437
Map <NamedGroup , NamedCurveWitness > groupsEcdsaStatic ,
438
438
Map <NamedGroup , NamedCurveWitness > groupsEcdsaEphemeral ) {
439
439
List <NamedGroup > foundOverall = new LinkedList ();
440
- for (NamedGroup group : rsaGroups ) {
440
+ for (NamedGroup group : rsaGroups . keySet () ) {
441
441
if (!foundOverall .contains (group )) {
442
442
foundOverall .add (group );
443
443
}
@@ -456,16 +456,16 @@ private Map<NamedGroup, NamedCurveWitness> composeFullMap(List<NamedGroup> rsaGr
456
456
HashMap <NamedGroup , NamedCurveWitness > groupMap = new HashMap <>();
457
457
for (NamedGroup group : foundOverall ) {
458
458
NamedCurveWitness witness = new NamedCurveWitness ();
459
- if (rsaGroups .contains (group )) {
460
- witness .setFoundUsingRsaCipher ( true );
459
+ if (rsaGroups .containsKey (group )) {
460
+ witness .getCipherSuites (). addAll ( rsaGroups . get ( group ). getCipherSuites () );
461
461
}
462
462
if (groupsEcdsaStatic .containsKey (group )) {
463
- witness .setFoundUsingEcdsaStaticCipher ( true );
463
+ witness .getCipherSuites (). addAll ( groupsEcdsaStatic . get ( group ). getCipherSuites () );
464
464
witness .setEcdsaPkGroupStatic (groupsEcdsaStatic .get (group ).getEcdsaPkGroupStatic ());
465
465
witness .setEcdsaSigGroupStatic (groupsEcdsaStatic .get (group ).getEcdsaSigGroupStatic ());
466
466
}
467
467
if (groupsEcdsaEphemeral .containsKey (group )) {
468
- witness .setFoundUsingEcdsaEphemeralCipher ( true );
468
+ witness .getCipherSuites (). addAll ( groupsEcdsaEphemeral . get ( group ). getCipherSuites () );
469
469
witness .setEcdsaPkGroupEphemeral (groupsEcdsaEphemeral .get (group ).getEcdsaPkGroupEphemeral ());
470
470
witness .setEcdsaSigGroupEphemeral (groupsEcdsaEphemeral .get (group ).getEcdsaSigGroupEphemeral ());
471
471
}
@@ -476,10 +476,10 @@ private Map<NamedGroup, NamedCurveWitness> composeFullMap(List<NamedGroup> rsaGr
476
476
}
477
477
478
478
private TestResult getGroupsDependOnCiphersuite (Map <NamedGroup , NamedCurveWitness > overallSupported ,
479
- List <NamedGroup > groupsRsa , Map <NamedGroup , NamedCurveWitness > groupsEcdsaStatic ,
479
+ Map <NamedGroup , NamedCurveWitness > groupsRsa , Map <NamedGroup , NamedCurveWitness > groupsEcdsaStatic ,
480
480
Map <NamedGroup , NamedCurveWitness > groupsEcdsaEphemeral ) {
481
481
for (NamedGroup group : overallSupported .keySet ()) {
482
- if (((testUsingRsa && !groupsRsa .contains (group ))
482
+ if (((testUsingRsa && !groupsRsa .containsKey (group ))
483
483
|| (testUsingEcdsaStatic && !groupsEcdsaStatic .containsKey (group )) || (testUsingEcdsaEphemeral && !groupsEcdsaEphemeral
484
484
.containsKey (group ))) && group .isCurve ()) {
485
485
return TestResult .TRUE ;
0 commit comments