Open emily-crank opened 4 days ago
Hi @emily-crank, thanks for reporting the issue!
However, I'd like to ask for some clarification on how these keys were generated and what you mean by Developer tools.
Do you mean the Box developer console at https://cloud.app.box.com/developers/console when you say Developer tools? Or are you referring to tools like OpenSSL? If so, could you specify which tool you used, what command you ran, and with what parameters?
Regards, Artur
Hi @arjankowski -
Sorry, I'm working off of credentials provided to me by a customer. I mean the Box developer console. This is related to JWT authentication.
I've put the correction in fork, located at https://github.com/emily-crank/box-dotnet-sdk-gen/tree/fix/rsa-key. I'll open a PR for you if it helps!
Hi @emily-crank, Thanks for the explanation. Because of it, I was able to reproduce it on my end.
This repository is generated by our codegen tool, so we can't directly create a PR with the code to this repository. Instead, we need to add it to our codegen tool. I have already created a PR there based on your fork, so it should appear in this repository soon.
Thanks for pointing out the error and for your help! Best regards
Description of the Issue
Some keys being generated by the Developer tools lead to the error System.Security.Cryptography.CryptographicException: 'The specified RSA parameters are not valid. Exponent and Modulus are required. If D is present, it must have the same length as Modulus. If D is present, P, Q, DP, DQ, and InverseQ are required and must have half the length of Modulus, rounded up, otherwise they must be omitted.'
See https://stackoverflow.com/questions/949727/bouncycastle-rsaprivatekey-to-net-rsaprivatekey for how to create an RSA key from the BouncyCastle objects; the key lengths need to be truncated.