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

Conversion to RSAKey Error #294

Closed
4 tasks done
emily-crank opened this issue Oct 26, 2024 · 4 comments
Closed
4 tasks done

Conversion to RSAKey Error #294

emily-crank opened this issue Oct 26, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@emily-crank
Copy link

  • I have checked that the [SDK documentation][sdk-docs] doesn't solve my issue.
  • I have checked that the [API documentation][api-docs] doesn't solve my issue.
  • I have searched the [Box Developer Forums][dev-forums] and my issue isn't already reported (or if it has been reported, I have attached a link to it, for reference).
  • I have searched [Issues in this repo][github-repo] and my issue isn't already reported.

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.

@arjankowski
Copy link
Contributor

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

@emily-crank
Copy link
Author

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!

@arjankowski
Copy link
Contributor

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

@arjankowski
Copy link
Contributor

Hi @emily-crank,
once again thank you for your support. The fix has just been released in version 1.4.0.

Regards,
Artur

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants