Encode error -> too long plaintext for random message
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Json error -> binary cannot be serialized
This commit is contained in:
@@ -23,7 +23,7 @@ class NetWrapper:
|
||||
self.cipherkey = "".encode('UTF-8')
|
||||
|
||||
|
||||
def randomStringGenerator(self, str_size: int = 512,
|
||||
def randomStringGenerator(self, str_size: int = 128,
|
||||
allowed_chars: str = string.ascii_letters + string.punctuation) -> str:
|
||||
return ''.join(random.choice(allowed_chars) for x in range(str_size))
|
||||
|
||||
@@ -33,7 +33,8 @@ class NetWrapper:
|
||||
cipher_rsa = PKCS1_OAEP.new(self.serverPubKey)
|
||||
identMsg = json.dumps(
|
||||
{'type': 'IDY', 'source': self.network.own_addr, 'username': self.username,
|
||||
'message': b64encode(cipher_rsa.encrypt(randommsg.encode('UTF-8')))}).encode(
|
||||
##b64encode has to str
|
||||
'message': str(b64encode(cipher_rsa.encrypt(randommsg.encode('UTF-8'))))}).encode(
|
||||
'UTF-8')
|
||||
self.network.send_msg(self.serverAddr, identMsg)
|
||||
returnJson = {'source': '', 'type': ''}
|
||||
|
||||
Reference in New Issue
Block a user