Closed devkatcybersecurity closed 5 years ago
Hi! The problem is that you're using the wrong class in the last line. It should be UmbralPublicKey. Try the following:
decoded_public_key = keys.UmbralPublicKey.from_bytes(new_public_key)
Also , one more thing.. how do i convert the bytes object to string and get back the bytes object from string again @cygnusv @jMyles @kikofernandez @KPrasch @michwill @dongsam I want to do something like as follows :
decoded_public_key = keys.UmbralPublicKey.from_bytes(new_public_key)
decoded_public_key_string = str(decoded_public_key)
Now i want to get decoded_public_key again using decoded_public_key_string.
Actually, it's very wrong to cast str()
on bytestrings. See:
>> str(b'123')
"b'123'"
You probably want some human-readable (hex?) representation? In this case, you could do:
decoded_public_key_string = decoded_public_key.hex()
converted_back = bytes.fromhex(decoded_public_key_string)
It is giving me the error as follows :
Any quick fix would be really appreciated