diff --git a/archive/src/main/kotlin/org/openrs2/archive/cache/CacheDownloader.kt b/archive/src/main/kotlin/org/openrs2/archive/cache/CacheDownloader.kt index c0c5a2700c..88b1ee508f 100644 --- a/archive/src/main/kotlin/org/openrs2/archive/cache/CacheDownloader.kt +++ b/archive/src/main/kotlin/org/openrs2/archive/cache/CacheDownloader.kt @@ -50,7 +50,6 @@ public class CacheDownloader @Inject constructor( game.lastMasterIndexId, continuation, importer, - game.key ) ) } @@ -75,7 +74,6 @@ public class CacheDownloader @Inject constructor( game.lastMasterIndexId, continuation, importer, - game.key, token, musicStreamClient ) diff --git a/archive/src/main/kotlin/org/openrs2/archive/cache/Js5ChannelHandler.kt b/archive/src/main/kotlin/org/openrs2/archive/cache/Js5ChannelHandler.kt index 70d315c2a0..9c1e9b04cf 100644 --- a/archive/src/main/kotlin/org/openrs2/archive/cache/Js5ChannelHandler.kt +++ b/archive/src/main/kotlin/org/openrs2/archive/cache/Js5ChannelHandler.kt @@ -8,7 +8,6 @@ import io.netty.channel.ChannelHandlerContext import io.netty.channel.ChannelPipeline import io.netty.channel.SimpleChannelInboundHandler import kotlinx.coroutines.runBlocking -import org.bouncycastle.crypto.params.RSAKeyParameters import org.openrs2.buffer.crc32 import org.openrs2.buffer.use import org.openrs2.cache.Js5Archive @@ -32,7 +31,6 @@ public abstract class Js5ChannelHandler( private val lastMasterIndexId: Int?, private val continuation: Continuation, private val importer: CacheImporter, - private val key: RSAKeyParameters?, private val masterIndexFormat: MasterIndexFormat, private val maxInFlightRequests: Int, private val maxBuildAttempts: Int = 10 @@ -192,7 +190,7 @@ public abstract class Js5ChannelHandler( private fun processMasterIndex(ctx: ChannelHandlerContext, buf: ByteBuf) { Js5Compression.uncompress(buf.slice()).use { uncompressed -> - masterIndex = Js5MasterIndex.read(uncompressed.slice(), masterIndexFormat, key) + masterIndex = Js5MasterIndex.readUnverified(uncompressed.slice(), masterIndexFormat) val (masterIndexId, sourceId, rawIndexes) = runBlocking { importer.importMasterIndexAndGetIndexes( diff --git a/archive/src/main/kotlin/org/openrs2/archive/cache/NxtJs5ChannelHandler.kt b/archive/src/main/kotlin/org/openrs2/archive/cache/NxtJs5ChannelHandler.kt index 04b082e03c..faa0fc282c 100644 --- a/archive/src/main/kotlin/org/openrs2/archive/cache/NxtJs5ChannelHandler.kt +++ b/archive/src/main/kotlin/org/openrs2/archive/cache/NxtJs5ChannelHandler.kt @@ -8,7 +8,6 @@ import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.asCoroutineDispatcher import kotlinx.coroutines.cancel import kotlinx.coroutines.launch -import org.bouncycastle.crypto.params.RSAKeyParameters import org.openrs2.archive.cache.nxt.InitJs5RemoteConnection import org.openrs2.archive.cache.nxt.Js5Request import org.openrs2.archive.cache.nxt.Js5RequestEncoder @@ -33,7 +32,6 @@ public class NxtJs5ChannelHandler( lastMasterIndexId: Int?, continuation: Continuation, importer: CacheImporter, - key: RSAKeyParameters?, private val token: String, private val musicStreamClient: MusicStreamClient, private val maxMinorBuildAttempts: Int = 5 @@ -47,7 +45,6 @@ public class NxtJs5ChannelHandler( lastMasterIndexId, continuation, importer, - key, MasterIndexFormat.LENGTHS, maxInFlightRequests = 500 ) { diff --git a/archive/src/main/kotlin/org/openrs2/archive/cache/OsrsJs5ChannelHandler.kt b/archive/src/main/kotlin/org/openrs2/archive/cache/OsrsJs5ChannelHandler.kt index da93341048..bc1beb8fd3 100644 --- a/archive/src/main/kotlin/org/openrs2/archive/cache/OsrsJs5ChannelHandler.kt +++ b/archive/src/main/kotlin/org/openrs2/archive/cache/OsrsJs5ChannelHandler.kt @@ -3,7 +3,6 @@ package org.openrs2.archive.cache import io.netty.bootstrap.Bootstrap import io.netty.channel.ChannelHandlerContext import io.netty.channel.ChannelPipeline -import org.bouncycastle.crypto.params.RSAKeyParameters import org.openrs2.cache.MasterIndexFormat import org.openrs2.protocol.Rs2Decoder import org.openrs2.protocol.Rs2Encoder @@ -25,7 +24,6 @@ public class OsrsJs5ChannelHandler( lastMasterIndexId: Int?, continuation: Continuation, importer: CacheImporter, - key: RSAKeyParameters? ) : Js5ChannelHandler( bootstrap, gameId, @@ -36,7 +34,6 @@ public class OsrsJs5ChannelHandler( lastMasterIndexId, continuation, importer, - key, MasterIndexFormat.VERSIONED, maxInFlightRequests = 200 ) { diff --git a/archive/src/main/kotlin/org/openrs2/archive/game/Game.kt b/archive/src/main/kotlin/org/openrs2/archive/game/Game.kt index 4e1f0cdb83..0ddfcbbf67 100644 --- a/archive/src/main/kotlin/org/openrs2/archive/game/Game.kt +++ b/archive/src/main/kotlin/org/openrs2/archive/game/Game.kt @@ -1,12 +1,9 @@ package org.openrs2.archive.game -import org.bouncycastle.crypto.params.RSAKeyParameters - public data class Game( public val id: Int, public val url: String?, public val buildMajor: Int?, public val buildMinor: Int?, - public val lastMasterIndexId: Int?, - public val key: RSAKeyParameters? + public val lastMasterIndexId: Int? ) diff --git a/archive/src/main/kotlin/org/openrs2/archive/game/GameDatabase.kt b/archive/src/main/kotlin/org/openrs2/archive/game/GameDatabase.kt index 85feaf4859..318a81a615 100644 --- a/archive/src/main/kotlin/org/openrs2/archive/game/GameDatabase.kt +++ b/archive/src/main/kotlin/org/openrs2/archive/game/GameDatabase.kt @@ -1,8 +1,6 @@ package org.openrs2.archive.game -import org.openrs2.crypto.Rsa import org.openrs2.db.Database -import java.io.StringReader import javax.inject.Inject import javax.inject.Singleton @@ -14,7 +12,7 @@ public class GameDatabase @Inject constructor( return database.execute { connection -> connection.prepareStatement( """ - SELECT id, url, build_major, build_minor, last_master_index_id, key + SELECT id, url, build_major, build_minor, last_master_index_id FROM games WHERE name = ? """.trimIndent() @@ -44,16 +42,7 @@ public class GameDatabase @Inject constructor( lastMasterIndexId = null } - val pem = rows.getString(6) - val key = if (rows.wasNull()) { - null - } else { - StringReader(pem).use { reader -> - Rsa.readPublicKey(reader) - } - } - - return@execute Game(id, url, buildMajor, buildMinor, lastMasterIndexId, key) + return@execute Game(id, url, buildMajor, buildMinor, lastMasterIndexId) } } } diff --git a/archive/src/main/resources/org/openrs2/archive/migrations/V5__keys.sql b/archive/src/main/resources/org/openrs2/archive/migrations/V5__keys.sql new file mode 100644 index 0000000000..f6baede7fc --- /dev/null +++ b/archive/src/main/resources/org/openrs2/archive/migrations/V5__keys.sql @@ -0,0 +1,2 @@ +ALTER TABLE games + DROP COLUMN key;