-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Two different token produces same message #5
Comments
It looks like you are referring to the message signing example from here: https://github.com/purificant/python-paseto/blob/1f3b2a77b9e1d0a4cd807275338b934698f59949/docs/examples/example4.py from paseto.protocol.version4 import create_asymmetric_key, sign, verify
message = b"this is a public message" # your data
public_key, secret_key = create_asymmetric_key() # signing / verifying keys
token = sign(message, secret_key)
verified_message = verify(token, public_key)
assert verified_message == message
print(f"token={token}")
print(f"verified_message={verified_message}")
print(f"message={message}") If you run the above block of code multiple times, each run will produce a different If you modify the example as follows and keep using the same public / secret keys, the token will remain the same. For example: from paseto.protocol.version4 import create_asymmetric_key, sign, verify
message = b"this is a public message" # your data
public_key, secret_key = create_asymmetric_key() # signing / verifying keys
token = sign(message, secret_key)
verified_message = verify(token, public_key)
assert verified_message == message
print(f"token={token}")
print(f"verified_message={verified_message}")
print(f"message={message}")
token2 = sign(message, secret_key)
assert token == token2
assert verify(token2, public_key) == message
token3 = sign(message, secret_key)
assert token == token3
assert verify(token3, public_key) == message
The |
I think I was not able to convey my message to you properly.
and
will produce the same message for the same private key and public key. Note:- |
I am not an security expert, I was just playing with the example provided in the package and found two different token is presenting the same message.
Code to produce the result :-
public_key was
b'k4.public.3xOkgS26nr1iGMcpz8njtioRcgceaUTgfngWgwDq9ec='
private key was
b'k4.secret.RAoDZGPQRFWJ5uLghlBKYR8BJgBNhAwlzkJj2EPzffDfE6SBLbqevWIYxynPyeO2KhFyBx5pROBeBaDAOr15w=='
token was
b'v4.public.dGhpcyBpcyBhIHB1YmxpYyBtZXNzYWdlu0p4hKsaiWr0VJOPTK_2Pcf_HNQ9QpFmW93jqUCQ8Hc19z0oeOSs3ftduKNrNZ-KQu_vFokm2PIvnaZGl8mCg'
I am not sure whether this is a serious concern or not, but I'll request to have a look on it.
The text was updated successfully, but these errors were encountered: