Skip to content

Add JS endpoint for RSA key generation #2293

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

Merged
merged 7 commits into from
Mar 11, 2021

Conversation

wintersteiger
Copy link

No description provided.

@wintersteiger wintersteiger requested a review from letmaik March 10, 2021 12:08
@wintersteiger wintersteiger requested a review from a team as a code owner March 10, 2021 12:08
@ghost
Copy link

ghost commented Mar 10, 2021

cwinter_js_gen_rsa@20307 aka 20210311.29 vs main ewma over 20 builds from 19970 to 20289
images

Copy link
Member

@achamayou achamayou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but please consider documenting the growing JS API in Sphinx.

@wintersteiger
Copy link
Author

Yes, I agree, we should start documenting this properly. I have trouble seeing where exactly "the JS API" begins and ends and what shape or form the documentation should take. Should there be a general CCF.ts file with docstrings on the functions which we distribute instead of copying it into samples? @letmaik can you take the lead on this, if you're not too busy? I'm happy to write the text for the crypto bits or to set up the infrastructure if you tell me how you'd like to do this.

@wintersteiger
Copy link
Author

See also #1765

Comment on lines +181 to +185
prv_pub_der = prv.public_key().public_bytes(
Encoding.DER, PublicFormat.SubjectPublicKeyInfo
)
pub_der = pub.public_bytes(Encoding.DER, PublicFormat.SubjectPublicKeyInfo)
return prv_pub_der == pub_der
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
prv_pub_der = prv.public_key().public_bytes(
Encoding.DER, PublicFormat.SubjectPublicKeyInfo
)
pub_der = pub.public_bytes(Encoding.DER, PublicFormat.SubjectPublicKeyInfo)
return prv_pub_der == pub_der
return prv.public_key() == pub

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not right; that comparison is always false because it compares two different key objects (which hold the same key). I initially tried the same and then had to add the complicated conversion to make it work.

Copy link
Member

@letmaik letmaik Mar 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really? I could have sworn I used that in the past, hmm..
EDIT: works for x509 certs but not for keys...

@letmaik
Copy link
Member

letmaik commented Mar 11, 2021

Looks good to me, let's tackle the docs in a separate PR.

Co-authored-by: Maik Riechert <[email protected]>
@wintersteiger
Copy link
Author

Yeah, I agree, the docs can go into a separate PR.

@wintersteiger wintersteiger merged commit b3fd065 into microsoft:main Mar 11, 2021
@wintersteiger wintersteiger deleted the cwinter_js_gen_rsa branch March 11, 2021 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants