From 3c051fe8c107aa65675e3680b4a31dae2db3d49b Mon Sep 17 00:00:00 2001 From: Graham Date: Sat, 2 May 2020 10:33:25 +0100 Subject: [PATCH] Rename private.key to game.key This name is slightly more descriptive and consistent with loader.p12, which also contains a private key. I've also removed the public.key file. It isn't read by OpenRS2 and the two files could get out of sync with each other, which would be confusing. It's easy to extract the public key with OpenSSL if necessary: openssl pkey -in game.key -pubout -out public.key Signed-off-by: Graham --- .../main/java/dev/openrs2/crypto/RsaKeyProvider.kt | 12 +++++------- etc/.gitignore | 3 +-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/crypto/src/main/java/dev/openrs2/crypto/RsaKeyProvider.kt b/crypto/src/main/java/dev/openrs2/crypto/RsaKeyProvider.kt index 6c592abb..eeba03ef 100644 --- a/crypto/src/main/java/dev/openrs2/crypto/RsaKeyProvider.kt +++ b/crypto/src/main/java/dev/openrs2/crypto/RsaKeyProvider.kt @@ -7,18 +7,16 @@ import javax.inject.Provider class RsaKeyProvider : Provider { override fun get(): RSAPrivateCrtKeyParameters { - return if (Files.exists(PRIVATE_PATH)) { - Rsa.readPrivateKey(PRIVATE_PATH) + return if (Files.exists(PATH)) { + Rsa.readPrivateKey(PATH) } else { - val (public, private) = Rsa.generateKeyPair(Rsa.CLIENT_KEY_LENGTH) - Rsa.writePublicKey(PUBLIC_PATH, public) - Rsa.writePrivateKey(PRIVATE_PATH, private) + val (_, private) = Rsa.generateKeyPair(Rsa.CLIENT_KEY_LENGTH) + Rsa.writePrivateKey(PATH, private) private } } companion object { - private val PUBLIC_PATH = Paths.get("etc/public.key") - private val PRIVATE_PATH = Paths.get("etc/private.key") + private val PATH = Paths.get("etc/game.key") } } diff --git a/etc/.gitignore b/etc/.gitignore index ff48994c..7acc4fb9 100644 --- a/etc/.gitignore +++ b/etc/.gitignore @@ -1,4 +1,3 @@ /config.yaml +/game.key /loader.p12 -/private.key -/public.key