stevenarella icon indicating copy to clipboard operation
stevenarella copied to clipboard

feather: RSA Issue "RSA error: message representative out of range"', src\server\mod.rs:203:80

Open ColdIce1605 opened this issue 3 years ago • 5 comments

Seems it doesn't like 3rd party servers. ie Feather

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: "RSA error: message representative out of range"', src\server\mod.rs:203:80

I'll also Open a feather issue

Reported by Feather

2021-02-21 18:23:36,603 DEBUG [feather_server::initial_handler] _COLDICE_ is logging in
2021-02-21 18:23:36,603 DEBUG [feather_server::initial_handler] Authenticating _COLDICE_
2021-02-21 18:23:36,604 DEBUG [feather_server::connection_worker] Initial handling failed: read 0 bytes
2021-02-21 18:23:36,605 TRACE [mio::poll] deregistering event source from poller
2021-02-21 18:26:45,860 TRACE [mio::poll] registering event source with poller: token=Token(100663297), interests=READABLE | WRITABLE
2021-02-21 18:26:45,860 TRACE [mio::poll] deregistering event source from poller
2021-02-21 18:26:48,663 TRACE [mio::poll] registering event source with poller: token=Token(117440513), interests=READABLE | WRITABLE
2021-02-21 18:26:48,663 TRACE [mio::poll] deregistering event source from poller
2021-02-21 18:26:50,696 TRACE [mio::poll] registering event source with poller: token=Token(134217729), interests=READABLE | WRITABLE

ColdIce1605 avatar Feb 22 '21 00:02 ColdIce1605

https://github.com/feather-rs/feather/issues/345

ColdIce1605 avatar Feb 22 '21 00:02 ColdIce1605

Some investigation of this issue in https://github.com/iceiix/stevenarella/issues/465#issuecomment-781740317:

       let shared_e = rsa_public_encrypt_pkcs1::encrypt(&public_key, &shared).unwrap();

this is from my other module (a quick-and-dirty RSA encryption library to replace the more heavyweight OpenSSL dependency I wanted to get rid of, but couldn't find a similarly lightweight Rust library replacement - maybe there is one now): https://github.com/iceiix/rsa_public_encrypt_pkcs1/blob/master/src/lib.rs#L110

where I added this check based on RFC8017:

   // https://tools.ietf.org/html/rfc8017#section-5.1.1
   /* 1.  If the message representative m is not between 0 and n - 1,
    *     output "message representative out of range" and stop.
    */
   if m.sign() != num::bigint::Sign::Plus || m > n - 1 {
       return Err("RSA error: message representative out of range".to_string());
   }

I wonder which condition is failing (m is negative, or greater than n - 1?)

but I wasn't able to reproduce this issue myself with https://github.com/feather-rs/feather branch 1.16 commit 56dce3188d75c40085cc94f58887eec37f80e6e4

iceiix avatar Mar 04 '21 03:03 iceiix

still happens on latest, still no way to rep, both on latest feather and stevenarella.

ColdIce1605 avatar Mar 04 '21 18:03 ColdIce1605

I've got these working together on Manjaro Linux. However, there's a glitch: Photo of Glitch

Supermath101 avatar Jul 03 '21 16:07 Supermath101

@Supermath101 for that glitch, it often means there was an issue loading the world, or placing the player into the world (for example, maybe they spawned inside a block? can other players see the player? teleport to a new location? etc.)

iceiix avatar Sep 06 '21 23:09 iceiix