Generally speaking, certificates are represented internally as DER in Firefox. PEM is just base64-encoded DER with line breaks and a "-----BEGIN CERTIFICATE-----"/"-----END CERTIFICATE-----" header/footer. When importing a certificate, if it's PEM, Firefox will decode it by stripping out the header and footer and converting the base64 to the original DER. When exporting a certificate as PEM, Firefox will convert the DER to base64 and add line breaks and the header and footer.
On Thu, Apr 24, 2025 at 4:14 AM 饼小干 <bingxiaoga...@gmail.com> wrote: > Thank you for your response. I would like to understand how Firefox > handles format conversion. > As you mentioned, PEM certificates can be exported from the viewer. So, > when viewing a DER format certificate, how does Firefox perform the format > conversion when exporting it to PEM? Similarly, when importing a > certificate into the certificate manager, is it possible to import a DER > certificate in PEM format? If so, how is this format conversion implemented? > > 在2025年4月24日星期四 UTC+8 02:08:28<dke...@mozilla.com> 写道: > >> Firefox can import DER or PEM certificates in the certificate manager. In >> the certificate viewer, Firefox exports PEM. >> What is it you're trying to do? If you just want to convert PEM to DER or >> vice-versa, something like openssl (or even a base64 encoder/decoder) would >> probably be easier to use. >> >> On Wed, Apr 23, 2025 at 3:21 AM 饼小干 <bingxi...@gmail.com> wrote: >> >>> Does Firefoxe browser involve format conversion when importing or >>> exporting digital certificates, such as importing local DER format >>> certificates into PEM format or exporting browser DER format certificates >>> into PEM format? If so, could you please tell me how to perform such format >>> conversions accurately? >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "dev-pl...@mozilla.org" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to dev-platform...@mozilla.org. >>> To view this discussion visit >>> https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/09cab96a-f65d-4fbb-9b7a-564b87897cdan%40mozilla.org >>> <https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/09cab96a-f65d-4fbb-9b7a-564b87897cdan%40mozilla.org?utm_medium=email&utm_source=footer> >>> . >>> >> -- You received this message because you are subscribed to the Google Groups "dev-platform@mozilla.org" group. To unsubscribe from this group and stop receiving emails from it, send an email to dev-platform+unsubscr...@mozilla.org. To view this discussion visit https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/CAHP1u2inrFN5fxgJOHsXv29T_uLc4iKHoQef8YQLHpgT7w1YUQ%40mail.gmail.com.