Subject: Error converting .cer to DER encoded .crt file

From: Banibrata Dutta <[email-masked]>
Date: Sun, 21 Feb 2021 22:13:08 +0530

Hi

Tried installing a .cer (Private RootCA certificate) file exported from
Windows on my Alpine Linux guest, after copying it into
/usr/local/share/ca-certificates/ directory, which led to the following
error:
WARNING: ca-certificates.crt does not contain exactly one certificate or
CRL: skipping

Did some reading around, including a stackexchange Q&A, and tried
converting the .cer into a DER encoded x509 type .crt file, with the aim to
use this .crt file to add to the CA-certificates on this alpine guest.
However, I got the following error.

dockhost:~$ *openssl x509 -inform DER -in My-PrivateRoot-CA.cer -out
My-PrivateRoot-CA.crt*
unable to load certificate
140527560465224:error:0D0680A8:asn1 encoding routines:asn1_check_tlen:wrong
tag:crypto/asn1/tasn_dec.c:1149:
140527560465224:error:0D07803A:asn1 encoding
routines:asn1_item_embed_d2i:nested asn1
error:crypto/asn1/tasn_dec.c:309:Type=X509

Any help around how to import/add the private root-CA certificate (.cer)
file from Windows (exported from Internet Explorer browser) into Alpine
Linux, would be highly appreciated.

Thanks.