File tree Expand file tree Collapse file tree
src/test/java/com/wolfssl/provider/jce/test Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -183,6 +183,23 @@ public static void testProviderInstallationAtRuntime() {
183183 int size = Ecc .getCurveSizeFromName (curves [i ].toUpperCase ());
184184
185185 if (size > 0 ) {
186+
187+ /* Verify curve supports key generation. */
188+ try {
189+ KeyPairGenerator testKpg =
190+ KeyPairGenerator .getInstance ("EC" , "wolfJCE" );
191+ ECGenParameterSpec testSpec =
192+ new ECGenParameterSpec (curves [i ]);
193+ testKpg .initialize (testSpec );
194+ KeyPair testKp = testKpg .generateKeyPair ();
195+ if (testKp == null ) {
196+ continue ;
197+ }
198+ } catch (Exception e ) {
199+ /* Curve not usable for keygen, skip */
200+ continue ;
201+ }
202+
186203 enabledCurves .add (curves [i ]);
187204
188205 if (!enabledEccKeySizes .contains (Integer .valueOf (size ))) {
@@ -1174,7 +1191,9 @@ public void testECValidKeySizesMapToNISTCurves()
11741191
11751192 if (wce != null ) {
11761193 String msg = wce .getMessage ();
1177- if (msg != null && msg .contains ("Bad function argument" )) {
1194+ if (msg != null &&
1195+ (msg .contains ("Bad function argument" ) ||
1196+ msg .contains ("Key size error" ))) {
11781197 /* Expected for non-FIPS-approved curves */
11791198 continue ;
11801199 }
You can’t perform that action at this time.
0 commit comments