Skip to content
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

Unable to verify signatures created with a seed #22

Open
talios opened this issue May 14, 2017 · 4 comments
Open

Unable to verify signatures created with a seed #22

talios opened this issue May 14, 2017 · 4 comments

Comments

@talios
Copy link

talios commented May 14, 2017

Calling caesium.crypto.sign/keypair! with a byte[] seed seems to trigger verification failures with verify(sign ...)...).

I modified one of the test cases in sign-test.clj as seen in https://gist.github.com/talios/d0ea678b0ce5b044ec48c6074855cf6a which triggers the problem.

Is this not the correct way to generate a keypair with a common seed, which will survive VM restarts?

@lvh
Copy link
Owner

lvh commented May 16, 2017

Thanks for your report! I'm looking into this.

@lvh
Copy link
Owner

lvh commented May 16, 2017

The obvious problem is that the seed has to be seedbytes (is, to wit, 32), but that shouldn't matter for that example.

@lvh
Copy link
Owner

lvh commented May 16, 2017

Looks like it's a length problem:

caesium.crypto.sign> (let [{pk :public sk :secret} (generate-signing-keys (.getBytes "secret"))]
      (verify (sign (.getBytes "hi") sk) (.getBytes "hi") pk)
    )
java.lang.RuntimeException: Signature validation failed
caesium.crypto.sign> (let [{pk :public sk :secret} (generate-signing-keys (.getBytes "YELLOW SUBMARINEYELLOW SUBMARINE"))]
      (verify (sign (.getBytes "hi") sk) (.getBytes "hi") pk))

not sure why it doesn't just read 32 bytes past the pointer, though... (Although it still wouldn't be repeatable)

@talios
Copy link
Author

talios commented May 17, 2017

@lvh should that error out/throw an exception is < seedBytes? That'll let me move on my own issues tho.

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

No branches or pull requests

2 participants