From c86193b423289bdd4cc1bd21f480c6a637150e97 Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Fri, 2 Nov 2018 05:54:34 -0600 Subject: [PATCH] Don't use sun.security.krb5.Confounder.bytes. (#230) * Don't rely on sun.security.krb5.Confounder.bytes. It's not reflected as part of the JDK platform and makes IDEs cranky. * Use a better SecureRandom factory. * spotless --- .../pantheon/ethereum/db/GenesisBlockMismatchTest.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ethereum/core/src/test/java/tech/pegasys/pantheon/ethereum/db/GenesisBlockMismatchTest.java b/ethereum/core/src/test/java/tech/pegasys/pantheon/ethereum/db/GenesisBlockMismatchTest.java index 3f49dd456f..6cdcffc262 100644 --- a/ethereum/core/src/test/java/tech/pegasys/pantheon/ethereum/db/GenesisBlockMismatchTest.java +++ b/ethereum/core/src/test/java/tech/pegasys/pantheon/ethereum/db/GenesisBlockMismatchTest.java @@ -13,8 +13,8 @@ package tech.pegasys.pantheon.ethereum.db; import static org.assertj.core.api.AssertionsForClassTypes.assertThatExceptionOfType; -import static sun.security.krb5.Confounder.bytes; +import tech.pegasys.pantheon.crypto.SecureRandomProvider; import tech.pegasys.pantheon.ethereum.core.Address; import tech.pegasys.pantheon.ethereum.core.Block; import tech.pegasys.pantheon.ethereum.core.BlockBody; @@ -30,11 +30,19 @@ import tech.pegasys.pantheon.util.bytes.Bytes32; import tech.pegasys.pantheon.util.bytes.BytesValue; import tech.pegasys.pantheon.util.uint.UInt256; +import java.security.SecureRandom; import java.util.Collections; import org.junit.Test; public class GenesisBlockMismatchTest { + private static final SecureRandom srand = SecureRandomProvider.publicSecureRandom(); + + private static byte[] bytes(final int len) { + final byte[] bytes = new byte[len]; + srand.nextBytes(bytes); + return bytes; + } @Test public void suppliedGenesisBlockMismatchStoredChainDataException() {