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 <gpe@openrs2.org>
Graham 4 years ago
parent e9e7b7848d
commit ed7eb10411
  1. 3
      crypto/src/main/kotlin/org/openrs2/crypto/Rsa.kt

@ -88,7 +88,6 @@ public object Rsa {
} }
public fun encrypt(plaintext: BigInteger, key: RSAKeyParameters): BigInteger { public fun encrypt(plaintext: BigInteger, key: RSAKeyParameters): BigInteger {
require(!key.isPrivate)
return plaintext.modPow(key.exponent, key.modulus) return plaintext.modPow(key.exponent, key.modulus)
} }
@ -107,8 +106,6 @@ public object Rsa {
} }
public fun decrypt(ciphertext: BigInteger, key: RSAKeyParameters): BigInteger { public fun decrypt(ciphertext: BigInteger, key: RSAKeyParameters): BigInteger {
require(key.isPrivate)
if (key is RSAPrivateCrtKeyParameters) { if (key is RSAPrivateCrtKeyParameters) {
// blind the input // blind the input
val e = key.publicExponent val e = key.publicExponent

Loading…
Cancel
Save