Closed kennyjwilli closed 9 years ago
@exload I have no idea about BouncyCastle's exception.
But clj-jwt uses old version of BouncyCastle, and I update it on new_bc_ver
branch (#16).
Could you try new_bc_ver
branch?
Sorry for the delayed response. But I just tried it and I am still getting the same exception. I got it working by generating a new private/public key pair without a password.
I cannot reproduce the exception. It may be BouncyCastle's problem, so I cannot support it. sorry.
root@my-linux-vm:~# openssl genrsa 1024 > private-key.pem
Generating RSA private key, 1024 bit long modulus
...++++++
............++++++
e is 65537 (0x10001)
root@my-linux-vm:~# openssl rsa -in private-key.pem -pubout -out public-key.pem
writing RSA key
root@my-linux-vm:~# ls
private-key.pem public-key.pem
user=> (def rsa-prv-key (private-key "private-key.pem"))
#'user/rsa-prv-key
user=> (def rsa-pub-key (public-key "public-key.pem"))
#'user/rsa-pub-key
user=> (def token (-> claim jwt (sign :RS256 rsa-prv-key) to-str))
#'user/token
user=> token
"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIifQ.J5rrTmPf5Bu00F_P4z66s9pCub0I7O3IWY11mxlP4madT9RkMRx3McjO1CzGzfOMfZdrfeCBHIK3sWhXk92IrifPtaLtX_71rFWYCs2EMcszaRBlRnWUS9buh8etPrUzj3YrCNJ94ZdX6RtPM8G3SI4SawQ1ezE0X9yXyis4ZUk"
user=> (-> token str->jwt (verify rsa-pub-key))
true
Running the below code causes the following error. The code with the respective keys work perfectly fine on my Linux machine, however, switching to my Mac and running my code causes the error.