2121import java .security .spec .PKCS8EncodedKeySpec ;
2222import java .security .spec .X509EncodedKeySpec ;
2323import java .util .ArrayList ;
24- import java .util .Base64 ;
2524import java .util .HashMap ;
2625import java .util .Iterator ;
2726import java .util .List ;
4948import org .bouncycastle .test .TestResourceFinder ;
5049import org .bouncycastle .util .Arrays ;
5150import org .bouncycastle .util .Strings ;
51+ import org .bouncycastle .util .encoders .Base64 ;
5252import org .bouncycastle .util .encoders .Hex ;
5353
5454public class CompositeSignaturesTest
@@ -285,6 +285,10 @@ public void testSelfComposition()
285285 public void testMixedComposition ()
286286 throws Exception
287287 {
288+ if (Security .getProvider ("SunEC" ) == null )
289+ {
290+ return ;
291+ }
288292 KeyPairGenerator mldsaKpGen = KeyPairGenerator .getInstance ("ML-DSA" , "BC" );
289293
290294 mldsaKpGen .initialize (MLDSAParameterSpec .ml_dsa_44 );
@@ -332,6 +336,10 @@ public void testMixedComposition()
332336 public void testMixedCompositionWithNull ()
333337 throws Exception
334338 {
339+ if (Security .getProvider ("SunEC" ) == null )
340+ {
341+ return ;
342+ }
335343 KeyPairGenerator mldsaKpGen = KeyPairGenerator .getInstance ("ML-DSA" , "BC" );
336344
337345 mldsaKpGen .initialize (MLDSAParameterSpec .ml_dsa_44 );
@@ -733,7 +741,7 @@ public List<Map<String, Object>> readTestVectorsFromJson(String homeDire, String
733741
734742 if (currentObject != null && currentObject .toString ().contains ("\" m\" :" ))
735743 {
736- m = Base64 .getDecoder (). decode (extractString (currentObject .toString (), "m" ));
744+ m = Base64 .decode (extractString (currentObject .toString (), "m" ));
737745 currentObject = new StringBuilder ();
738746 }
739747 }
@@ -745,11 +753,11 @@ private static Map<String, Object> parseJsonObject(String json)
745753 {
746754 HashMap <String , Object > testCase = new HashMap <String , Object >();
747755 testCase .put ("tcId" , extractString (json , "tcId" ));
748- testCase .put ("pk" , Base64 .getDecoder (). decode (extractString (json , "pk" )));
749- testCase .put ("x5c" , Base64 .getDecoder (). decode (extractString (json , "x5c" )));
750- testCase .put ("sk" , Base64 .getDecoder (). decode (extractString (json , "sk" )));
751- testCase .put ("sk_pkcs8" , Base64 .getDecoder (). decode (extractString (json , "sk_pkcs8" )));
752- testCase .put ("s" , Base64 .getDecoder (). decode (extractString (json , "s" )));
756+ testCase .put ("pk" , Base64 .decode (extractString (json , "pk" )));
757+ testCase .put ("x5c" , Base64 .decode (extractString (json , "x5c" )));
758+ testCase .put ("sk" , Base64 .decode (extractString (json , "sk" )));
759+ testCase .put ("sk_pkcs8" , Base64 .decode (extractString (json , "sk_pkcs8" )));
760+ testCase .put ("s" , Base64 .decode (extractString (json , "s" )));
753761 return testCase ;
754762 }
755763
0 commit comments