Skip to content

Commit 33f4ae5

Browse files
committed
minor compatibility fixes.
1 parent 491bd5b commit 33f4ae5

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

prov/src/test/java/org/bouncycastle/jcajce/provider/test/CompositeSignaturesTest.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import java.security.spec.PKCS8EncodedKeySpec;
2222
import java.security.spec.X509EncodedKeySpec;
2323
import java.util.ArrayList;
24-
import java.util.Base64;
2524
import java.util.HashMap;
2625
import java.util.Iterator;
2726
import java.util.List;
@@ -49,6 +48,7 @@
4948
import org.bouncycastle.test.TestResourceFinder;
5049
import org.bouncycastle.util.Arrays;
5150
import org.bouncycastle.util.Strings;
51+
import org.bouncycastle.util.encoders.Base64;
5252
import org.bouncycastle.util.encoders.Hex;
5353

5454
public 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

Comments
 (0)