Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Pycryptodome AuthSigner is incorrect #109

Open
GoobyCorp opened this issue May 21, 2018 · 6 comments · May be fixed by #174
Open

Pycryptodome AuthSigner is incorrect #109

GoobyCorp opened this issue May 21, 2018 · 6 comments · May be fixed by #174

Comments

@GoobyCorp
Copy link

I've tried to sign tokens with the pycryptodome AuthSigner and it definitely doesn't work. If I remember correctly the token isn't hashed with SHA-256.

@fahhem
Copy link
Contributor

fahhem commented May 31, 2018

Can you verify it works when you replace the following lines:

h = SHA256.new(data)
return pkcs1_15.new(self.rsa_key).sign(h)

With this line:

return pkcs1_15.new(self.rsa_key).sign(data)

@GoobyCorp
Copy link
Author

GoobyCorp commented May 31, 2018

That won't work either, it requires a hasher instance.

@fahhem
Copy link
Contributor

fahhem commented May 31, 2018

In other signers it looks like the data comes pre-hashed. Have you tried the code?

@GoobyCorp
Copy link
Author

If it's prehashed then it's not going to work with pycryptodome without modifications.

@fahhem
Copy link
Contributor

fahhem commented May 31, 2018

Do you have any suggestions then? @greateggsgreg added pycryptodome and I assume he tried it out. Did you try anything or is this just theory?

@GoobyCorp
Copy link
Author

GoobyCorp commented May 31, 2018

I've tested everything I've written, also in the documentation it says the format for the public key being sent is PEM with the header, footer, and newlines removed but from other implementations of ADB this doesn't appear to be the case.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants