Remove signature verification from the cache downloader

The keys seem to change in each release now, which is going to be too
much of a pain to keep up with.

Signed-off-by: Graham <gpe@openrs2.org>
Graham 3 years ago
parent 12203912c1
commit 821cb732fd
  1. 2
      archive/src/main/kotlin/org/openrs2/archive/cache/CacheDownloader.kt
  2. 4
      archive/src/main/kotlin/org/openrs2/archive/cache/Js5ChannelHandler.kt
  3. 3
      archive/src/main/kotlin/org/openrs2/archive/cache/NxtJs5ChannelHandler.kt
  4. 3
      archive/src/main/kotlin/org/openrs2/archive/cache/OsrsJs5ChannelHandler.kt
  5. 5
      archive/src/main/kotlin/org/openrs2/archive/game/Game.kt
  6. 15
      archive/src/main/kotlin/org/openrs2/archive/game/GameDatabase.kt
  7. 2
      archive/src/main/resources/org/openrs2/archive/migrations/V5__keys.sql

@ -50,7 +50,6 @@ public class CacheDownloader @Inject constructor(
game.lastMasterIndexId, game.lastMasterIndexId,
continuation, continuation,
importer, importer,
game.key
) )
) )
} }
@ -75,7 +74,6 @@ public class CacheDownloader @Inject constructor(
game.lastMasterIndexId, game.lastMasterIndexId,
continuation, continuation,
importer, importer,
game.key,
token, token,
musicStreamClient musicStreamClient
) )

@ -8,7 +8,6 @@ import io.netty.channel.ChannelHandlerContext
import io.netty.channel.ChannelPipeline import io.netty.channel.ChannelPipeline
import io.netty.channel.SimpleChannelInboundHandler import io.netty.channel.SimpleChannelInboundHandler
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import org.bouncycastle.crypto.params.RSAKeyParameters
import org.openrs2.buffer.crc32 import org.openrs2.buffer.crc32
import org.openrs2.buffer.use import org.openrs2.buffer.use
import org.openrs2.cache.Js5Archive import org.openrs2.cache.Js5Archive
@ -32,7 +31,6 @@ public abstract class Js5ChannelHandler(
private val lastMasterIndexId: Int?, private val lastMasterIndexId: Int?,
private val continuation: Continuation<Unit>, private val continuation: Continuation<Unit>,
private val importer: CacheImporter, private val importer: CacheImporter,
private val key: RSAKeyParameters?,
private val masterIndexFormat: MasterIndexFormat, private val masterIndexFormat: MasterIndexFormat,
private val maxInFlightRequests: Int, private val maxInFlightRequests: Int,
private val maxBuildAttempts: Int = 10 private val maxBuildAttempts: Int = 10
@ -192,7 +190,7 @@ public abstract class Js5ChannelHandler(
private fun processMasterIndex(ctx: ChannelHandlerContext, buf: ByteBuf) { private fun processMasterIndex(ctx: ChannelHandlerContext, buf: ByteBuf) {
Js5Compression.uncompress(buf.slice()).use { uncompressed -> Js5Compression.uncompress(buf.slice()).use { uncompressed ->
masterIndex = Js5MasterIndex.read(uncompressed.slice(), masterIndexFormat, key) masterIndex = Js5MasterIndex.readUnverified(uncompressed.slice(), masterIndexFormat)
val (masterIndexId, sourceId, rawIndexes) = runBlocking { val (masterIndexId, sourceId, rawIndexes) = runBlocking {
importer.importMasterIndexAndGetIndexes( importer.importMasterIndexAndGetIndexes(

@ -8,7 +8,6 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.asCoroutineDispatcher import kotlinx.coroutines.asCoroutineDispatcher
import kotlinx.coroutines.cancel import kotlinx.coroutines.cancel
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import org.bouncycastle.crypto.params.RSAKeyParameters
import org.openrs2.archive.cache.nxt.InitJs5RemoteConnection import org.openrs2.archive.cache.nxt.InitJs5RemoteConnection
import org.openrs2.archive.cache.nxt.Js5Request import org.openrs2.archive.cache.nxt.Js5Request
import org.openrs2.archive.cache.nxt.Js5RequestEncoder import org.openrs2.archive.cache.nxt.Js5RequestEncoder
@ -33,7 +32,6 @@ public class NxtJs5ChannelHandler(
lastMasterIndexId: Int?, lastMasterIndexId: Int?,
continuation: Continuation<Unit>, continuation: Continuation<Unit>,
importer: CacheImporter, importer: CacheImporter,
key: RSAKeyParameters?,
private val token: String, private val token: String,
private val musicStreamClient: MusicStreamClient, private val musicStreamClient: MusicStreamClient,
private val maxMinorBuildAttempts: Int = 5 private val maxMinorBuildAttempts: Int = 5
@ -47,7 +45,6 @@ public class NxtJs5ChannelHandler(
lastMasterIndexId, lastMasterIndexId,
continuation, continuation,
importer, importer,
key,
MasterIndexFormat.LENGTHS, MasterIndexFormat.LENGTHS,
maxInFlightRequests = 500 maxInFlightRequests = 500
) { ) {

@ -3,7 +3,6 @@ package org.openrs2.archive.cache
import io.netty.bootstrap.Bootstrap import io.netty.bootstrap.Bootstrap
import io.netty.channel.ChannelHandlerContext import io.netty.channel.ChannelHandlerContext
import io.netty.channel.ChannelPipeline import io.netty.channel.ChannelPipeline
import org.bouncycastle.crypto.params.RSAKeyParameters
import org.openrs2.cache.MasterIndexFormat import org.openrs2.cache.MasterIndexFormat
import org.openrs2.protocol.Rs2Decoder import org.openrs2.protocol.Rs2Decoder
import org.openrs2.protocol.Rs2Encoder import org.openrs2.protocol.Rs2Encoder
@ -25,7 +24,6 @@ public class OsrsJs5ChannelHandler(
lastMasterIndexId: Int?, lastMasterIndexId: Int?,
continuation: Continuation<Unit>, continuation: Continuation<Unit>,
importer: CacheImporter, importer: CacheImporter,
key: RSAKeyParameters?
) : Js5ChannelHandler( ) : Js5ChannelHandler(
bootstrap, bootstrap,
gameId, gameId,
@ -36,7 +34,6 @@ public class OsrsJs5ChannelHandler(
lastMasterIndexId, lastMasterIndexId,
continuation, continuation,
importer, importer,
key,
MasterIndexFormat.VERSIONED, MasterIndexFormat.VERSIONED,
maxInFlightRequests = 200 maxInFlightRequests = 200
) { ) {

@ -1,12 +1,9 @@
package org.openrs2.archive.game package org.openrs2.archive.game
import org.bouncycastle.crypto.params.RSAKeyParameters
public data class Game( public data class Game(
public val id: Int, public val id: Int,
public val url: String?, public val url: String?,
public val buildMajor: Int?, public val buildMajor: Int?,
public val buildMinor: Int?, public val buildMinor: Int?,
public val lastMasterIndexId: Int?, public val lastMasterIndexId: Int?
public val key: RSAKeyParameters?
) )

@ -1,8 +1,6 @@
package org.openrs2.archive.game package org.openrs2.archive.game
import org.openrs2.crypto.Rsa
import org.openrs2.db.Database import org.openrs2.db.Database
import java.io.StringReader
import javax.inject.Inject import javax.inject.Inject
import javax.inject.Singleton import javax.inject.Singleton
@ -14,7 +12,7 @@ public class GameDatabase @Inject constructor(
return database.execute { connection -> return database.execute { connection ->
connection.prepareStatement( 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 FROM games
WHERE name = ? WHERE name = ?
""".trimIndent() """.trimIndent()
@ -44,16 +42,7 @@ public class GameDatabase @Inject constructor(
lastMasterIndexId = null lastMasterIndexId = null
} }
val pem = rows.getString(6) return@execute Game(id, url, buildMajor, buildMinor, lastMasterIndexId)
val key = if (rows.wasNull()) {
null
} else {
StringReader(pem).use { reader ->
Rsa.readPublicKey(reader)
}
}
return@execute Game(id, url, buildMajor, buildMinor, lastMasterIndexId, key)
} }
} }
} }

Loading…
Cancel
Save