Skip to content

Commit

Permalink
Remove spongycastle
Browse files Browse the repository at this point in the history
  • Loading branch information
LossyDragon committed May 4, 2024
1 parent 1aa5e4a commit 0618325
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 18 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,14 @@ Maven
</dependency>
```

**3. Add the appropriate cryptography dependency to your project. JavaSteam depends on this.**
**3. Add the cryptography dependency to your project. JavaSteam depends on this.**

[Android | Spongy Castle](https://mvnrepository.com/artifact/com.madgag.spongycastle/prov)

[Non-Android | Bouncy Castle](https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk18on)
[Bouncy Castle](https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk18on)


## Getting Started

You can head to the very short [Getting Started](https://github.com/Longi94/JavaSteam/wiki/Getting-started) page or take a look at the [samples](https://github.com/Longi94/JavaSteam/tree/master/javasteam-samples/src/main/java/in/dragonbra/javasteamsamples) to get you started with using this library.
You can head to the very short [Getting Started](https://github.com/Longi94/JavaSteam/wiki/Getting-started) page or take a look at the [samples](https://github.com/Longi94/JavaSteam/tree/master/javasteam-samples/src/main/java/in/dragonbra/javasteamsamples) to get you started with using this library.

There some [open-source projects](https://github.com/Longi94/JavaSteam/wiki/Samples) too you can check out.

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ plugins {

allprojects {
group = "in.dragonbra"
version = "1.4.0"
version = "1.4.1-SNAPSHOT"
}

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import `in`.dragonbra.javasteam.rpc.service.Authentication
import `in`.dragonbra.javasteam.steam.handlers.steamunifiedmessages.SteamUnifiedMessages
import `in`.dragonbra.javasteam.steam.steamclient.SteamClient
import `in`.dragonbra.javasteam.types.SteamID
import `in`.dragonbra.javasteam.util.crypto.CryptoHelper
import java.math.BigInteger
import java.nio.charset.StandardCharsets
import java.security.KeyFactory
Expand Down Expand Up @@ -159,7 +160,7 @@ class SteamAuthentication(private val steamClient: SteamClient, unifiedMessages:
val rsaPublicKeySpec = RSAPublicKeySpec(publicModulus, publicExponent)
val publicKey = KeyFactory.getInstance("RSA").generatePublic(rsaPublicKeySpec)

val cipher = Cipher.getInstance("RSA/None/PKCS1Padding").apply {
val cipher = Cipher.getInstance("RSA/None/PKCS1Padding", CryptoHelper.SEC_PROV).apply {
init(Cipher.ENCRYPT_MODE, publicKey)
}

Expand Down
15 changes: 4 additions & 11 deletions src/main/java/in/dragonbra/javasteam/util/crypto/CryptoHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,10 @@ public class CryptoHelper {

static {
try {
if (Utils.getOSType() == EOSType.AndroidUnknown) {
Class<? extends Provider> provider =
(Class<? extends Provider>) Class.forName("org.spongycastle.jce.provider.BouncyCastleProvider");
Security.insertProviderAt(provider.getDeclaredConstructor().newInstance(), 1);
SEC_PROV = "SC";
} else {
Class<? extends Provider> provider =
(Class<? extends Provider>) Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider");
Security.addProvider(provider.getDeclaredConstructor().newInstance());
SEC_PROV = "BC";
}
Class<? extends Provider> provider =
(Class<? extends Provider>) Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider");
Security.addProvider(provider.getDeclaredConstructor().newInstance());
SEC_PROV = "BC";
} catch (Exception e) {
throw new SecurityException("Couldn't create security provider", e);
}
Expand Down

0 comments on commit 0618325

Please sign in to comment.