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

Errors in using :eddsa algo for claims signing #85

Open
tsaixingwei opened this issue May 1, 2020 · 0 comments
Open

Errors in using :eddsa algo for claims signing #85

tsaixingwei opened this issue May 1, 2020 · 0 comments

Comments

@tsaixingwei
Copy link

Hi,
Firstly, thanks for creating the Buddy security libraries for Clojure.
I am going through the code examples in your documentation, but did not see any specific examples for using ED25519 even though I see that it is supported using the :eddsa algorithm options.

I created a ED25519 keypair using OpenSSL v1.1.1g for testing buddy-sign claims signing using the :eddsa.

$ openssl genpkey -algorithm ED25519 > test-ed-privkey.pem
$ openssl pkey -in test-ed-privkey.pem -pubout > test-ed-pubkey.pem

And then wrote a very simple test on the Clojure repl:

(require '[buddy.sign.jwt :as jwt])
(require '[buddy.core.keys :as keys])
(def ed-privkey (keys/private-key "./test-ed-privkey.pem"))
(def ed-pubkey (keys/public-key "./test-ed-pubkey.pem"))
(jwt/sign {:userid 22} ed-privkey {:alg :eddsa})

That last line threw an InvalidKeyException with the message
cannot identify EdDSA private key: class org.bouncycastle.jcajce.provider.asymmetric.edec.BCEdDSAPrivateKey.

I am using these versions of Clojure and the buddy-sign libraries

[buddy/buddy-core "1.6.0"]
[buddy/buddy-sign "3.1.0"]
[org.clojure/clojure "1.10.0"]

on Mac OS v10.14.6.

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

1 participant