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

Make the output of export-public-key more useful. #28

Closed
paulhowardarm opened this issue Feb 2, 2021 · 0 comments · Fixed by #38
Closed

Make the output of export-public-key more useful. #28

paulhowardarm opened this issue Feb 2, 2021 · 0 comments · Fixed by #38
Assignees
Labels
enhancement New feature or request medium Effort label

Comments

@paulhowardarm
Copy link
Contributor

paulhowardarm commented Feb 2, 2021

Summary

The export-public-key command writes to standard output as space-separated hex digits, which are quite difficult to process. We should make it possible to generate PEM, which is the same data in base64 with standard (BEGIN and END) headers and footers - the output can then be trivially copy/pasted into other tools that process keys.

Details

Default behaviour is probably fine as it is, but it would be good to accept a --pem switch on the command line and output as per this example:

-----BEGIN RSA PUBLIC KEY-----
MIIBCgKCAQEAui/eDjvMavCdat/JDTt2/e51eRttNpdAV9mxaEqF8uf4oZYiM0oVPq4DG6pN2FSOgOR9urD57dGG3ddFmUif1cQc8OeHBCB58HwQzNvSAKaB1TU2YFTGjvX5cDw4pT2gCrbzdQGnVAuHog1Mez5iOt/Ken2dN3zQ3LJhOnml08OTr3+909mU9Bf9uTi6ctVznhaqSvHY7ilHzNZfCi/9skwEze+ExA3xwBMeqJ+kOghgozNcLvv+qEWpyfAEh0JtdtzvWvQPqw3bD9jvlnPQ6HoP5xggLEsNcyuFUHKNU03xNK9qsGItC4GMvtc1U6aHLPyZc51y/L3+/8e/HLcJAQIDAQAB
-----END RSA PUBLIC KEY-----

The data bytes are identical to the current output, just base64 encoded, and the headers and footers (for RSA public keys) should be as shown.

It should be possible to paste this output into an encryption tool such as this one, and successfully encrypt a plaintext message: https://8gwifi.org/rsafunctions.jsp

It would be fine to only support this for RSA public keys for now, although we can research how this would scale to other key types by peeking the key properties before getting the raw bytes.

@ionut-arm ionut-arm added enhancement New feature or request medium Effort label labels Feb 3, 2021
@ionut-arm ionut-arm self-assigned this Feb 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request medium Effort label
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants