コード例 #1
0
 private String namedCurvesToString(Set<NamedCurve> namedCurves) {
   String output = "";
   for (NamedCurve nc : namedCurves) {
     output = output + nc.name() + " ";
   }
   return output;
 }
コード例 #2
0
 private void testSupportedCurves(ProtocolVersion pv, CipherSuite cs) {
   for (NamedCurve nc : NamedCurve.values()) {
     serverConfig.setProtocolVersion(pv);
     serverConfig.setCipherSuites(Collections.singletonList(cs));
     serverConfig.setNamedCurves(Collections.singletonList(nc));
     boolean success = false;
     try {
       success = executeHandshake();
     } catch (Exception ex) {
       LOGGER.info(ex.getLocalizedMessage());
       LOGGER.debug(ex.getLocalizedMessage(), ex);
     }
     if (success) {
       supportedCurves.add(nc);
       if (lastTlsContext.getEcContext().getServerPublicKeyParameters() != null) {
         LOGGER.info(
             "EC parameter public key size: {}",
             lastTlsContext
                 .getEcContext()
                 .getServerPublicKeyParameters()
                 .getParameters()
                 .getCurve()
                 .getFieldSize());
         int groupSize =
             lastTlsContext
                 .getEcContext()
                 .getServerPublicKeyParameters()
                 .getParameters()
                 .getCurve()
                 .getFieldSize();
         if (minimumECDHGroupSize == 0 || groupSize < minimumECDHGroupSize) {
           minimumECDHGroupSize = groupSize;
         }
       }
     }
   }
 }