Remove 'RSA' from RSA public key headers for openssl CLI tool compatibility #76
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I noticed jRuby OpenSSL uses a slightly modified header and footer for public keys (values below), this causes issues when working with other tools/libraries (example below).
-----BEGIN RSA PUBLIC KEY-----
-----END RSA PUBLIC KEY-----
instead of
-----BEGIN PUBLIC KEY-----
-----END PUBLIC KEY-----
The added 'RSA' causes issues when working with other tools/libraries, the main ones being the OpenSSL Command Line Tool (https://www.openssl.org/docs/manmaster/apps/openssl.html) and BouncyCastle on the Java side using PEMReader with RSAPublicKey. Here is a brief example to illustrate the issue:
Example
Step 1
Step 2
Save above key to test.pub then run the following:
Step 3
Edit and save test.pub as test2.pub and remove the 'RSA' from header and footer so it looks like the following:
Step 4
Rerun openssl command line command using test2.pub
I'm not sure if having RSA in the private key creates any problems or not, but if it does a similar change could be implemented for that as well.