Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,10 @@

import com.salesforce.einsteinbot.sdk.cache.Cache;
import java.io.IOException;
import java.math.BigInteger;
import java.security.KeyFactory;
import java.security.PrivateKey;
import java.security.spec.RSAPrivateKeySpec;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.Optional;
import java.util.Random;
import okhttp3.mockwebserver.MockResponse;
import okhttp3.mockwebserver.MockWebServer;
import okhttp3.mockwebserver.RecordedRequest;
Expand Down Expand Up @@ -83,12 +79,9 @@ void initialize() {
}

private static PrivateKey createTestPrivateKey() throws Exception {
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
BigInteger randomBigInteger = new BigInteger(512, new Random());

RSAPrivateKeySpec privateKeySpec = new RSAPrivateKeySpec(randomBigInteger, randomBigInteger);

return keyFactory.generatePrivate(privateKeySpec);
java.security.KeyPairGenerator keyGen = java.security.KeyPairGenerator.getInstance("RSA");
keyGen.initialize(2048);
return keyGen.generateKeyPair().getPrivate();
}

@Test
Expand Down