From cf132cb2dd1fbac4755c3c160be1736de64e27e8 Mon Sep 17 00:00:00 2001 From: Graham Date: Sun, 15 Mar 2020 13:33:18 +0000 Subject: [PATCH] Rename KEY_LENGTH to CLIENT_KEY_LENGTH Signed-off-by: Graham --- common/src/main/java/dev/openrs2/common/crypto/Rsa.kt | 2 +- .../src/main/java/dev/openrs2/common/crypto/RsaKeyProvider.kt | 2 +- common/src/test/java/dev/openrs2/common/crypto/RsaTest.kt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/dev/openrs2/common/crypto/Rsa.kt b/common/src/main/java/dev/openrs2/common/crypto/Rsa.kt index a8241436ac..7ef022cb9b 100644 --- a/common/src/main/java/dev/openrs2/common/crypto/Rsa.kt +++ b/common/src/main/java/dev/openrs2/common/crypto/Rsa.kt @@ -59,7 +59,7 @@ object Rsa { * The maximum output length of RSA encryption is the key size plus one, so * the maximum key size supported by the client is 126 bytes - or 1008 bits. */ - const val KEY_LENGTH = 1008 + const val CLIENT_KEY_LENGTH = 1008 // 1 in 2^80 private const val CERTAINTY = 80 diff --git a/common/src/main/java/dev/openrs2/common/crypto/RsaKeyProvider.kt b/common/src/main/java/dev/openrs2/common/crypto/RsaKeyProvider.kt index 807acdf5ea..1bf2d7aa71 100644 --- a/common/src/main/java/dev/openrs2/common/crypto/RsaKeyProvider.kt +++ b/common/src/main/java/dev/openrs2/common/crypto/RsaKeyProvider.kt @@ -10,7 +10,7 @@ class RsaKeyProvider : Provider { return if (Files.exists(PRIVATE_PATH)) { Rsa.readPrivateKey(PRIVATE_PATH) } else { - val (public, private) = Rsa.generateKeyPair(Rsa.KEY_LENGTH) + val (public, private) = Rsa.generateKeyPair(Rsa.CLIENT_KEY_LENGTH) Rsa.writePublicKey(PUBLIC_PATH, public) Rsa.writePrivateKey(PRIVATE_PATH, private) private diff --git a/common/src/test/java/dev/openrs2/common/crypto/RsaTest.kt b/common/src/test/java/dev/openrs2/common/crypto/RsaTest.kt index c11be80cc6..cafa18fa1e 100644 --- a/common/src/test/java/dev/openrs2/common/crypto/RsaTest.kt +++ b/common/src/test/java/dev/openrs2/common/crypto/RsaTest.kt @@ -46,7 +46,7 @@ object RsaTest { @Test fun testGenerateKeyPair() { - val (public, private) = Rsa.generateKeyPair(Rsa.KEY_LENGTH) + val (public, private) = Rsa.generateKeyPair(Rsa.CLIENT_KEY_LENGTH) val expectedPlaintext = BigInteger("1337") val ciphertext = Rsa.encrypt(expectedPlaintext, public)