@@ -261,20 +261,76 @@ static void AssertECDsa (ECDsa ecdsa)
261261 pubec . Dispose ( ) ;
262262 }
263263
264- [ Test ]
265- public void TestECDsa ( )
264+ static ECCurve GetNamedCurve ( string name )
265+ {
266+ switch ( name ) {
267+ case "brainpoolP160r1" : return ECCurve . NamedCurves . brainpoolP160r1 ;
268+ case "brainpoolP160t1" : return ECCurve . NamedCurves . brainpoolP160t1 ;
269+ case "brainpoolP192r1" : return ECCurve . NamedCurves . brainpoolP192r1 ;
270+ case "brainpoolP192t1" : return ECCurve . NamedCurves . brainpoolP192t1 ;
271+ case "brainpoolP224r1" : return ECCurve . NamedCurves . brainpoolP224r1 ;
272+ case "brainpoolP224t1" : return ECCurve . NamedCurves . brainpoolP224t1 ;
273+ case "brainpoolP256r1" : return ECCurve . NamedCurves . brainpoolP256r1 ;
274+ case "brainpoolP256t1" : return ECCurve . NamedCurves . brainpoolP256t1 ;
275+ case "brainpoolP320r1" : return ECCurve . NamedCurves . brainpoolP320r1 ;
276+ case "brainpoolP320t1" : return ECCurve . NamedCurves . brainpoolP320t1 ;
277+ case "brainpoolP384r1" : return ECCurve . NamedCurves . brainpoolP384r1 ;
278+ case "brainpoolP384t1" : return ECCurve . NamedCurves . brainpoolP384t1 ;
279+ case "brainpoolP512r1" : return ECCurve . NamedCurves . brainpoolP512r1 ;
280+ case "brainpoolP512t1" : return ECCurve . NamedCurves . brainpoolP512t1 ;
281+ case "nistP256" : return ECCurve . NamedCurves . nistP256 ;
282+ case "nistP384" : return ECCurve . NamedCurves . nistP384 ;
283+ case "nistP521" : return ECCurve . NamedCurves . nistP521 ;
284+ default : throw new NotSupportedException ( $ "Unknown NamedCurve: { name } ") ;
285+ }
286+ }
287+
288+ [ TestCase ( "brainpoolP160r1" ) ]
289+ [ TestCase ( "brainpoolP160t1" ) ]
290+ [ TestCase ( "brainpoolP192r1" ) ]
291+ [ TestCase ( "brainpoolP192t1" ) ]
292+ [ TestCase ( "brainpoolP224r1" ) ]
293+ [ TestCase ( "brainpoolP224t1" ) ]
294+ [ TestCase ( "brainpoolP256r1" ) ]
295+ [ TestCase ( "brainpoolP256t1" ) ]
296+ [ TestCase ( "brainpoolP320r1" ) ]
297+ [ TestCase ( "brainpoolP320t1" ) ]
298+ [ TestCase ( "brainpoolP384r1" ) ]
299+ [ TestCase ( "brainpoolP384t1" ) ]
300+ [ TestCase ( "brainpoolP512r1" ) ]
301+ [ TestCase ( "brainpoolP512t1" ) ]
302+ [ TestCase ( "nistP256" ) ]
303+ [ TestCase ( "nistP384" ) ]
304+ [ TestCase ( "nistP521" ) ]
305+ public void TestECDsa ( string namedCurve )
266306 {
267- using ( var ecdsa = ECDsa . Create ( ECCurve . NamedCurves . nistP256 ) )
307+ using ( var ecdsa = ECDsa . Create ( GetNamedCurve ( namedCurve ) ) )
268308 AssertECDsa ( ecdsa ) ;
269309 }
270310
271- [ Test ]
311+ [ TestCase ( "brainpoolP160r1" ) ]
312+ [ TestCase ( "brainpoolP160t1" ) ]
313+ [ TestCase ( "brainpoolP192r1" ) ]
314+ [ TestCase ( "brainpoolP192t1" ) ]
315+ [ TestCase ( "brainpoolP224r1" ) ]
316+ [ TestCase ( "brainpoolP224t1" ) ]
317+ [ TestCase ( "brainpoolP256r1" ) ]
318+ [ TestCase ( "brainpoolP256t1" ) ]
319+ [ TestCase ( "brainpoolP320r1" ) ]
320+ [ TestCase ( "brainpoolP320t1" ) ]
321+ [ TestCase ( "brainpoolP384r1" ) ]
322+ [ TestCase ( "brainpoolP384t1" ) ]
323+ [ TestCase ( "brainpoolP512r1" ) ]
324+ [ TestCase ( "brainpoolP512t1" ) ]
325+ [ TestCase ( "nistP256" ) ]
326+ [ TestCase ( "nistP384" ) ]
327+ [ TestCase ( "nistP521" ) ]
272328 [ SuppressMessage ( "Interoperability" , "CA1416:Validate platform compatibility" , Justification = "<Pending>" ) ]
273- public void TestECDsaCng ( )
329+ public void TestECDsaCng ( string namedCurve )
274330 {
275331#if ! MONO
276332 if ( Environment . OSVersion . Platform == PlatformID . Win32NT ) {
277- using ( var ecdsa = new ECDsaCng ( ) )
333+ using ( var ecdsa = new ECDsaCng ( GetNamedCurve ( namedCurve ) ) )
278334 AssertECDsa ( ecdsa ) ;
279335 } else {
280336 Assert . Ignore ( "ECDsaCng is only supported on Windows systems." ) ;
0 commit comments