kkazuo / openid-key

Get OpenID keys from issuer.
MIT License
5 stars 2 forks source link

Gets errors because the N and E in jwk-key is of length 342 (not divisible by 4) #1

Open Yehouda opened 4 years ago

Yehouda commented 4 years ago

When I run the test, I get an error inside CL-BASE64:BASE64-STRING-TO-USB8-ARRAY called from OPENID-KEY::B64-INTEGER called from OPENID-KEY::JWK-KEY, because the length of the argument is 342, which is not divisible by 4, and CL-BASE64:BASE64-STRING-TO-USB8-ARRAY errors on that. It is not obvious to me if a length not divisible by 4 is valid here. If it is then it is a bug in cl-base64.

Added: I tried to raise the issue in cl-base64, but I didn't find how. I think the sources are here: http://git.kpe.io/?p=cl-base64.git;a=summary, but I am not sure, and it is not obvious how to comment about it.

The bug in cl-base64 is that in the file decode.lisp, when it compares the length of the target array/string, it uses *( (truncate length 4) 3). It should be using ceiling instead of truncate. After I changed all occurrences of truncate in the file decode.lisp to ceiling** the test run successfully.

kkazuo commented 4 years ago

I gonna investigate this later.