From e9e7b7848d939975e14b0b027a956dabcba41af2 Mon Sep 17 00:00:00 2001 From: Graham Date: Sat, 6 Feb 2021 21:44:27 +0000 Subject: [PATCH] Add constant for the RSA magic byte Signed-off-by: Graham --- crypto/src/main/kotlin/org/openrs2/crypto/Rsa.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crypto/src/main/kotlin/org/openrs2/crypto/Rsa.kt b/crypto/src/main/kotlin/org/openrs2/crypto/Rsa.kt index 3bb6cf91..f2d66e61 100644 --- a/crypto/src/main/kotlin/org/openrs2/crypto/Rsa.kt +++ b/crypto/src/main/kotlin/org/openrs2/crypto/Rsa.kt @@ -73,6 +73,12 @@ public object Rsa { // 1 in 2^80 private const val CERTAINTY = 80 + /* + * The magic number prepended as a byte to the plaintext before it is + * encrypted by the server. + */ + public const val MAGIC: Int = 10 + public fun generateKeyPair(length: Int): Pair { val generator = RSAKeyPairGenerator() generator.init(RSAKeyGenerationParameters(F4, secureRandom, length, CERTAINTY))