From ed7eb10411b2c00b35f14ceaec6e5c5fc5b68192 Mon Sep 17 00:00:00 2001 From: Graham Date: Sun, 7 Feb 2021 00:39:32 +0000 Subject: [PATCH] Relax isPrivate checks in the encrypt/decrypt methods The master index uses RSA signatures in some builds. As such, we need to be able to encrypt with a private key and decrypt with a public key. Signed-off-by: Graham --- crypto/src/main/kotlin/org/openrs2/crypto/Rsa.kt | 3 --- 1 file changed, 3 deletions(-) diff --git a/crypto/src/main/kotlin/org/openrs2/crypto/Rsa.kt b/crypto/src/main/kotlin/org/openrs2/crypto/Rsa.kt index f2d66e61..5d9760f9 100644 --- a/crypto/src/main/kotlin/org/openrs2/crypto/Rsa.kt +++ b/crypto/src/main/kotlin/org/openrs2/crypto/Rsa.kt @@ -88,7 +88,6 @@ public object Rsa { } public fun encrypt(plaintext: BigInteger, key: RSAKeyParameters): BigInteger { - require(!key.isPrivate) return plaintext.modPow(key.exponent, key.modulus) } @@ -107,8 +106,6 @@ public object Rsa { } public fun decrypt(ciphertext: BigInteger, key: RSAKeyParameters): BigInteger { - require(key.isPrivate) - if (key is RSAPrivateCrtKeyParameters) { // blind the input val e = key.publicExponent