This is a static, read-only archive of Wireshark Q&A. Older questions and answers from October 2017 and earlier can be found at osqa-ask.wireshark.org.
0

I've imported an .pem key, but why wireshark recognize it as .p12?

asked Nov 14 '17

Hi,

I am inported .pem key into it (which is converted from .p12), but still wireshark recognize as p12 and thus I can't proceed with my analysis.

I am pretty sure the conversion has nothing wrong, because I have use the pem key in another monitoring tool in my client site (which the tools would only work for pem, not p12) and the tools works fine.

So I am not quite sure why wireshark wouldn't recognize it as pem format.

The error message is "Could not load PKCS#12 key file: could not load PKCS#12 in PEM format: Base64 unexpected header error."

1 Answer

0

answered Nov 14 '17

updated Nov 14 '17

What does your file look like in an editor? If it has a line such as -----BEGIN PRIVATE KEY----- then it is a PEM file. If it's a load of gibberish it's a .p12. Note that a .p12 is normally encrypted and requires a password to decrypt it.

Comments

It's not gibberish, it's readable string.

The content is Bag Attributes, followed by localKeyID and friendly name, then finally the section of BEGIN PRIVATE KEY until the END PRIVATE KEY

So, it's not p12, it's .pem.

Also, in case you wonder, I've try to erase the portion Bag Attribute then try to load into wireshark again, no luck.

User 89198 ( Nov 14 '17 )

So it does look like a PEM, it would seem that it's corrupted in some way such that wireshark tries to load it as a .p12.

Can you try using OpenSSL to check the PEM, e.g.

openssl rsa -in yourpem -check
User 98587 ( Nov 14 '17 )

The output of this command is: RSA key ok, writing RSA key, followed by the sectiion of ----BEGIN RSA PRIVATE KEY----, all the way until ----END RSA PRIVATE KEY----

User 89198 ( Nov 14 '17 )

There would seem to be a bug then. Unfortunately the only way it is likely to be fixed is if you provide the capture and the pem file. Raise an item at the Wireshark Bugzilla and you can mark the bug item and attachments as private to restrict access to only the Core Developers.

User 98587 ( Nov 15 '17 )

Thanks, just do that. Let's see what do they have to say, bug 14218

User 89198 ( Nov 15 '17 )
cc-by-sa Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.