Unable to load certificate.pem

Actually, here is such a mistake:

/ssl openssl x509 -inform der -in site_ru.crt -out site_ru.pem
unable to load certificate
140451851716160:error:0D0680A8:asn1 encoding routines:asn1_check_tlen:wrong tag:../crypto/asn1/tasn_dec.c:1130:
140451851716160:error:0D07803A:asn1 encoding routines:asn1_item_embed_d2i:nested asn1 error:../crypto/asn1/tasn_dec.c:290:Type=X509

There are no extra characters, either at the beginning or at the end:

/ssl xxd -l 10 site_ru.crt
00000000: 2d2d 2d2d 2d42 4547 494e                 -----BEGIN 
Author: theblackpost, 2018-12-28

1 answers

File extensions X509

.DER – расширение .DER примеяется к двоичным файлам сертификатов. Такие файлы так же могут иметь расширение .CER или .CRT. 
.PEM – используется для различных типов файлов X.509v3, которые содержат данные в виде ASCII (Base64), и начинаются со строки — BEGIN.

Common file extensions

.CRT – расширение для файлов сертификатов. Сам сертификат может быть бинарным файлом .DER или ASCII – .PEM. Расширения .CER и .CRT фактически являются синонимами. Наиболее часто встречаются в UNIX-системах.
.CER – альтернативная форма .CRT у Microsoft.
.KEY – это расширение используется для публичных и приватных ключей PKCS8, которые могут храниться в бинарном .DER или ASCII .PEM формате.

Source: , in Russian

Probably your certificate is not in DER encoding try running the command

openssl x509 -inform pem -in site_ru.crt -out site_ru.pem

You can also view the information about your certificate with the command

openssl x509 -in site_ru.crt -text
 1
Author: Сергей Гамов, 2018-12-28 07:04:35