snxvpn
snxvpn copied to clipboard
Padding bytes may not be zero.
Fixes #18
See pkcs1pad2 in JS_RSA.js: ... while(n > 2) { // random non-zero pad x[0] = 0; while(x[0] == 0) rng.nextBytes(x); ba[--n] = x[0]; } ...
It works for me. GJ
This fix allows to get rid of Unexpected response, looking for MultiChallenge or Portal
messages. As I understand it, theses messages are triggered when os.urandom emits b'\0'
values. As this char is a separator, it must not be present in random value.
Surely because I currently run the script with python2.7 (not sure), I need to use:
r.append (bytes(bytearray([int(x.encode('hex'), 16) % 255 + 1 for x in os.urandom (n)])))
instead of proposal:
r.append (bytes([x % 255 + 1 for x in os.urandom (n)]))