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 <gpe@openrs2.dev>
Graham 5 years ago
parent 21551b119c
commit 3c051fe8c1
  1. 12
      crypto/src/main/java/dev/openrs2/crypto/RsaKeyProvider.kt
  2. 3
      etc/.gitignore

@ -7,18 +7,16 @@ import javax.inject.Provider
class RsaKeyProvider : Provider<RSAPrivateCrtKeyParameters> {
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")
}
}

3
etc/.gitignore vendored

@ -1,4 +1,3 @@
/config.yaml
/game.key
/loader.p12
/private.key
/public.key

Loading…
Cancel
Save