Skip to content

Add some example commands to generate public key - #472

Closed
lawliet89 wants to merge 2 commits into
briansmith:masterfrom
lawliet89:gen-pub-key
Closed

lawliet89 wants to merge 2 commits into
briansmith:masterfrom
lawliet89:gen-pub-key

Conversation

@lawliet89

Copy link
Copy Markdown
Contributor

For signature verification

Should address #470

Comment thread src/signature.rs Outdated
/// Verify the signature `signature` of message `msg` with the public key
/// `public_key` using the algorithm `alg`.
///
/// To generate the public key from your DER-encoded private key, use

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Since this is RSA-specific, let's put this text in the RSA example below, after the sentence ”RSA signing (but not verification) requires the rsa_signing feature to be enabled” and before the example code block.

I suggest using the wording like this:

Note that by default OpenSSL writes RSA public keys in SubjectPublicKeyInfo format, not RSAPublicKey format, and by default it Base64-encodes them (”PEM” format).

To convert the PEM SubjectPublicKeyInfo format to the binary RSAPublicKey format needed by verify(), use:
sh <example code #2>
To extract the RSAPublicKey-formatted public key from an ASN.1 (binary) DER-encoded RSAPrivateKey format private key file, use:
sh <example code #1>

In particular, I think it makes more sense to document how to convert from the default OpenSSL format to the RSAPublicKey format first.

WDYT?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure. Will make the changes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

@briansmith

Copy link
Copy Markdown
Owner

Thanks! I landed this as d48469d with a couple of typo fixes.

If/when you contribute in the future, please read https://github.com/briansmith/ring#contributing, and in particular please add the contributor's statement to the end of each commit's commit message.

Thanks again!

@briansmith briansmith closed this Mar 6, 2017
@lawliet89

Copy link
Copy Markdown
Contributor Author

Oops.

Thanks. Maybe you could add this information to the PR template. I didn't check it because I thought it's just a "simple" comment addition.

@lawliet89
lawliet89 deleted the gen-pub-key branch March 6, 2017 07:55
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.

2 participants