Skip to content

Commit

Permalink
Merge pull request #1046 from tls-attacker/fix/NoSuchProviderException
Browse files Browse the repository at this point in the history
Fixed possible NoSuchProviderException
  • Loading branch information
mmaehren authored Jul 5, 2023
2 parents 5fe90d0 + b7b804d commit 5ea60d1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.bouncycastle.cert.X509v1CertificateBuilder;
import org.bouncycastle.cert.jcajce.JcaX509v1CertificateBuilder;
import org.bouncycastle.crypto.tls.Certificate;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.operator.ContentSigner;
import org.bouncycastle.operator.OperatorCreationException;
import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder;
Expand All @@ -42,6 +43,7 @@ public class CertificateAdapterTest {
@BeforeAll
public static void setUpClass()
throws NoSuchAlgorithmException, OperatorCreationException, IOException {
Security.addProvider(new BouncyCastleProvider());

// Generate 2048 Bit RSA Keypair
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
import de.rub.nds.tlsattacker.core.constants.CipherSuite;
import de.rub.nds.tlsattacker.core.layer.context.TlsContext;
import de.rub.nds.tlsattacker.transport.ConnectionEndType;
import java.security.Security;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
Expand All @@ -23,6 +26,11 @@ public class CertificateKeyPairTest {

private TlsContext tlsContext;

@BeforeAll
public static void setUpClass() {
Security.addProvider(new BouncyCastleProvider());
}

@BeforeEach
public void setUp() {
tlsContext = new TlsContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,21 @@
import de.rub.nds.tlsattacker.core.crypto.keys.CustomEcPublicKey;
import java.io.ByteArrayOutputStream;
import java.math.BigInteger;
import java.security.Security;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

public class PemUtilTest {

private static final String SECRET =
"45920025678221661724778903394380424235512150060610104911582497586860611281771";

@BeforeAll
public static void setUpClass() {
Security.addProvider(new BouncyCastleProvider());
}

/** Test of writePrivateKey method, of class PemUtil. */
@Test
public void testWritePrivateKey() {
Expand Down

0 comments on commit 5ea60d1

Please sign in to comment.