NOTICK Do not use Security.addProvider(BouncyCastleProvider()) in tests (#6250) (#6700)

Do not use Security.addProvider(BouncyCastleProvider()) in tests, to avoid disruptions of other tests.

Co-authored-by: Denis Rekalov <denis.rekalov@r3.com>
This commit is contained in:
Ross Nicoll 2020-09-11 16:50:12 +01:00 committed by GitHub
parent 2198524315
commit df7b1bccd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -12,7 +12,6 @@ import org.bouncycastle.asn1.x509.GeneralSubtree
import org.bouncycastle.asn1.x509.NameConstraints
import org.bouncycastle.jce.provider.BouncyCastleProvider
import org.junit.Test
import java.security.Security
import java.security.UnrecoverableKeyException
import java.security.cert.CertPathValidator
import java.security.cert.CertPathValidatorException
@ -95,7 +94,8 @@ class X509NameConstraintsTest {
@Test
fun `x500 name with correct cn and extra attribute`() {
Security.addProvider(BouncyCastleProvider())
// Do not use Security.addProvider(BouncyCastleProvider()) to avoid EdDSA signature disruption in other tests.
Crypto.findProvider(BouncyCastleProvider.PROVIDER_NAME)
val acceptableNames = listOf("CN=Bank A TLS, UID=", "O=Bank A")
.map { GeneralSubtree(GeneralName(X500Name(it))) }.toTypedArray()

View File

@ -54,7 +54,6 @@ import java.math.BigInteger
import java.net.InetSocketAddress
import java.security.KeyPair
import java.security.PrivateKey
import java.security.Security
import java.security.cert.X509CRL
import java.security.cert.X509Certificate
import java.util.*
@ -113,7 +112,8 @@ class CertificateRevocationListNodeTests {
@Before
fun setUp() {
Security.addProvider(BouncyCastleProvider())
// Do not use Security.addProvider(BouncyCastleProvider()) to avoid EdDSA signature disruption in other tests.
Crypto.findProvider(BouncyCastleProvider.PROVIDER_NAME)
revokedNodeCerts.clear()
server = CrlServer(NetworkHostAndPort("localhost", 0))
server.start()