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>
bzip2
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 {
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

Loading…
Cancel
Save