-
-
Notifications
You must be signed in to change notification settings - Fork 502
Add RSA support on encodeString #2412
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
Add RSA support on encodeString #2412
Conversation
|
Changed enum name because of #2016 (comment) |
Co-authored-by: Pirulax <[email protected]>
|
I think the returned key should be in React with emojis. |
|
I think that representing keys with hexadecimal characters in this PR would go against the precedents set by the However, I agree that hash functions should continue to return hexadecimal strings for their results. |
Pirulax
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM if the test resource passes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor things.
Also we need some nicer way of handling async callbacks... too much duplicaiton here. I'll have a look for getting a generalized solution for it going. Doesn't matter for this PR though.
|
@sbx320 review |
|
To the moon 🚀 |
|
To the moon 🚀 (review) |
| catch (const CryptoPP::Exception& ex) | ||
| { | ||
| return std::make_pair(SString(ex.GetWhat()), false); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is better exception handling than just ignoring it and returning false. However, I'm not sure if we want to expose scripts to the implementation-defined messages of CryptoPP. According to the docs, it should be feasible to get an error type and control what string is logged ourselves.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was @Pirulax idea to expose exception cause
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with exposing the exception cause somehow. But I'm not sure if we want to potentially make backwards compatibility more complicated just because some script decided to rely on some precise warning text. This is a pretty minor and far-fetched concern, though, and I'd be happy with this merged as-is.
|
About the removed tests, I think @sbx320 was not pointing that they were unnecessary and should be removed, but that they were not that useful either because they just tested the entire encryption-decryption cycle, and as such a trivial identity function implementation would also satisfy those tests. I think that tests are useful for this PR and belong to it, as long as they test encryption and decryption separately: at least one test should test that encryption of a known plaintext with a known key-pair and cipher parameters yields the expected ciphertext, and at least other test should check that decryption of another ciphertext is able to yield back the plaintext. |
Test has been applied:
|
fdfd13c to
c652a22
Compare
AlexTMjugador
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Design-wise this looks fine to me, but I have not tested it, and other people might have some stylistic feedback.
Thanks for review, a test resource is included in pr 🚀 |
|
Review someone 🔥 |
|
Code looks well now. I think it should be refactored into "strategy" pattern with next added algorithm. |
Github bug? I don't see unresolved thread
|
@TheNormalnij not a bug. Github keeps it as "Changes Requested" regardless of unresolved threads, as there may be changes requested in a top level comment. |
This reverts commit e7e3ba5.
Fixes #2097
This pull request adds RSA Support.
generateKeyPair
Available algorithms:
rsaReturn strings representing private and public key
RSA on encode/decodeString
Resource for testing: rsatest.zip
Thank you.