Move cryptographic code to a separate module

Signed-off-by: Graham <gpe@openrs2.dev>
Graham 5 years ago
parent eae715231b
commit 177326221f
  1. 1
      asm/build.gradle.kts
  2. 2
      asm/src/main/java/dev/openrs2/asm/classpath/Library.kt
  3. 1
      bundler/build.gradle.kts
  4. 2
      bundler/src/main/java/dev/openrs2/bundler/Bundler.kt
  5. 4
      bundler/src/main/java/dev/openrs2/bundler/BundlerModule.kt
  6. 9
      common/build.gradle.kts
  7. 30
      crypto/build.gradle.kts
  8. 5
      crypto/src/main/java/dev/openrs2/crypto/CryptoModule.kt
  9. 2
      crypto/src/main/java/dev/openrs2/crypto/Pkcs12KeyStore.kt
  10. 2
      crypto/src/main/java/dev/openrs2/crypto/Rsa.kt
  11. 2
      crypto/src/main/java/dev/openrs2/crypto/RsaKeyProvider.kt
  12. 2
      crypto/src/main/java/dev/openrs2/crypto/ThreadLocalSecureRandom.kt
  13. 2
      crypto/src/test/java/dev/openrs2/crypto/RsaTest.kt
  14. 2
      game/build.gradle.kts
  15. 3
      game/src/main/java/dev/openrs2/game/GameModule.kt
  16. 1
      settings.gradle.kts

@ -11,6 +11,7 @@ dependencies {
api("org.ow2.asm:asm-util:${Versions.asm}")
implementation(project(":compress"))
implementation(project(":crypto"))
}
publishing {

@ -3,7 +3,7 @@ package dev.openrs2.asm.classpath
import com.github.michaelbull.logging.InlineLogger
import dev.openrs2.asm.NopClassVisitor
import dev.openrs2.asm.remap
import dev.openrs2.common.crypto.Pkcs12KeyStore
import dev.openrs2.crypto.Pkcs12KeyStore
import dev.openrs2.common.io.DeterministicJarOutputStream
import dev.openrs2.compress.gzip.Gzip
import org.objectweb.asm.ClassReader

@ -12,6 +12,7 @@ dependencies {
api(project(":asm"))
api("com.github.ajalt:clikt:${Versions.clikt}")
implementation(project(":crypto"))
implementation("dev.openrs2:openrs2-natives-all:${Versions.openrs2Natives}")
}

@ -13,7 +13,7 @@ import dev.openrs2.bundler.transform.PublicKeyTransformer
import dev.openrs2.bundler.transform.ResourceTransformer
import dev.openrs2.bundler.transform.RightClickTransformer
import dev.openrs2.bundler.transform.TypoTransformer
import dev.openrs2.common.crypto.Pkcs12KeyStore
import dev.openrs2.crypto.Pkcs12KeyStore
import java.nio.file.Path
import java.util.jar.Attributes
import java.util.jar.Attributes.Name.MANIFEST_VERSION

@ -1,10 +1,10 @@
package dev.openrs2.bundler
import com.google.inject.AbstractModule
import dev.openrs2.common.CommonModule
import dev.openrs2.crypto.CryptoModule
class BundlerModule : AbstractModule() {
override fun configure() {
install(CommonModule())
install(CryptoModule())
}
}

@ -3,15 +3,6 @@ plugins {
kotlin("jvm")
}
dependencies {
api("com.google.inject:guice:${Versions.guice}")
api("io.netty:netty-buffer:${Versions.netty}")
api("org.bouncycastle:bcpkix-jdk15on:${Versions.bouncyCastle}")
api("org.bouncycastle:bcprov-jdk15on:${Versions.bouncyCastle}")
testImplementation("com.google.jimfs:jimfs:${Versions.jimfs}")
}
publishing {
publications.create<MavenPublication>("maven") {
from(components["java"])

@ -0,0 +1,30 @@
plugins {
`maven-publish`
kotlin("jvm")
}
dependencies {
api("com.google.inject:guice:${Versions.guice}")
api("io.netty:netty-buffer:${Versions.netty}")
api("org.bouncycastle:bcpkix-jdk15on:${Versions.bouncyCastle}")
api("org.bouncycastle:bcprov-jdk15on:${Versions.bouncyCastle}")
testImplementation("com.google.jimfs:jimfs:${Versions.jimfs}")
}
publishing {
publications.create<MavenPublication>("maven") {
from(components["java"])
pom {
packaging = "jar"
name.set("OpenRS2 Cryptography")
description.set(
"""
Provides implementations of cryptographic algorithms used by
the client, including RSA, ISAAC, XTEA and JAR signing.
""".trimIndent()
)
}
}
}

@ -1,11 +1,10 @@
package dev.openrs2.common
package dev.openrs2.crypto
import com.google.inject.AbstractModule
import com.google.inject.Scopes
import dev.openrs2.common.crypto.RsaKeyProvider
import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters
class CommonModule : AbstractModule() {
class CryptoModule : AbstractModule() {
override fun configure() {
bind(RSAPrivateCrtKeyParameters::class.java)
.toProvider(RsaKeyProvider::class.java)

@ -1,4 +1,4 @@
package dev.openrs2.common.crypto
package dev.openrs2.crypto
import jdk.security.jarsigner.JarSigner
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers

@ -1,4 +1,4 @@
package dev.openrs2.common.crypto
package dev.openrs2.crypto
import io.netty.buffer.ByteBuf
import io.netty.buffer.ByteBufUtil

@ -1,4 +1,4 @@
package dev.openrs2.common.crypto
package dev.openrs2.crypto
import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters
import java.nio.file.Files

@ -1,4 +1,4 @@
package dev.openrs2.common.crypto
package dev.openrs2.crypto
import java.security.SecureRandom

@ -1,4 +1,4 @@
package dev.openrs2.common.crypto
package dev.openrs2.crypto
import com.google.common.jimfs.Configuration
import com.google.common.jimfs.Jimfs

@ -11,7 +11,7 @@ application {
dependencies {
api("com.github.ajalt:clikt:${Versions.clikt}")
implementation(project(":common"))
implementation("com.google.inject:guice:${Versions.guice}")
}
publishing {

@ -1,10 +1,9 @@
package dev.openrs2.game
import com.google.inject.AbstractModule
import dev.openrs2.common.CommonModule
class GameModule : AbstractModule() {
override fun configure() {
install(CommonModule())
// empty
}
}

@ -11,6 +11,7 @@ include(
"compress",
"compress-cli",
"crc32",
"crypto",
"decompiler",
"deob",
"deob-annotations",

Loading…
Cancel
Save