Hello i need to encode text with RSA using modulus and exponent + input
I have tried this, but am getting errors
rsa_modulus = data['publickey_mod']
rsa_exponent = data['publickey_exp']
rsa_timestamp = data['timestamp']
rsa_publickey = rsa.PublicKey(rsa_modulus, rsa_exponent)
encrypted = rsa.encrypt(password,rsa_publickey)
print(encrypted)
AttributeError: 'str' object has no attribute 'bit_length'
Try to encode your password
:
encrypted = rsa.encrypt(password.encode('utf8'), rsa_publickey)
rsa.Encrypt
takes a byte object