Open jpstotz opened 5 years ago
The header specifies the format of the content (s. here):
BEGIN RSA PRIVATE KEY
means PKCS#1/"OpenSSL" formatBEGIN PRIVATE KEY
means PKCS#8 formatBut in this case it's a PKCS#1 content with an PKCS#8 header.
Did you generate this file with OpenSSL?
Thanks for your clarification. But now I am even more confused as KeyStore Explorer only speaks of "OpenSSL keys" - which format is supported by KeyStore Explorer and which not? Fro my experience I would guess that PKCS#1 is supported but PKCS#8 keys are not supported? If this is correct why is this not communicated to the user?
Regarding my attached key: Originally the file I got seems to be a real PKCS#8 file, however the included private key is important (and therefore can't be posted) therefore I decided to generate a new one that could be posted. As I did not knew about the different formats and how they can be identified I generated the new key in the wrong format (and just changed the header/footer).
Both are supported, but if you select "OpenSSL" format on key import, then the PEM header has to be the one for PKCS#1. If you select PKCS#8, then KSE checks for PKCS#8 format:
From a usability perspective this is not good :(
As a user I only know that I have PEM file. PEM usually means OpenSSL. For PKCS#8 PEM files this will always fail. And additionally the error message shown does not indicate the real problem (wrong file format selected).
Therefore from my perspective I would propose the following changes:
And additionally the error message shown does not indicate the real problem
When the user has selected "OpenSSL" as the type of the private key and KSE fails to parse the file then the error message "Not a valid OpenSSL private key" is the best you can expect. If KSE was smart enough to detect that the format is actually PKCS#8, then it would make no sense to let the user choose the format in the first place.
Both suggested changes won't help much:
The best solution here seems to completely remove the dialog for format selection and let KSE detect the file type automatically. I'lll consider this for the next feature release (5.5.0).
Describe the bug I got an RSA private key in pem format that can't be loaded by KeyStore Explorer, however
openssl rsa -text -in filename
works without problems.To Reproduce Steps to reproduce the behavior:
Expected behavior The details dialog should open displaying the RSA private key details
Actual behavior An error dialog is shown:
Guess of the problem It seems like KeyStore Explorer is searching for the line
-----BEGIN RSA PRIVATE KEY-----
but the attached file starts with the line
-----BEGIN PRIVATE KEY-----
This is also accepted by OpenSSL but not by KeyStore Explorer. You can verify that by changing the header and footer line in the attached file so that it contains "RSA". After modifying the file this way it can be loaded by KeyStore Explorer.
Environment