Actually, here is the error:

/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, neither at the beginning nor at the end:

 /ssl xxd -l 10 site_ru.crt 00000000: 2d2d 2d2d 2d42 4547 494e -----BEGIN 
  • one
    All is well, thank you. Indeed, they forgot to add a key - theblackpost

1 answer 1

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 your certificate information with the command

 openssl x509 -in site_ru.crt -text 
  • It turned out to do: openssl x509 -inform pem -in site_ru.crt -out site_ru.pem but the Apache error: Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details. Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details. error_log: [Fri Dec 28 15:04:59.020414 2018] [ssl:emerg] [pid 22187] AH02312: Fatal error initialising mod_ssl, exiting. [Fri Dec 28 15:04:59.020417 2018] [ssl:emerg] [pid 22187] AH02564: Failed to configure encrypted (?) private key sheerdecor.ru:443:0, check /ssl/site_ru.pem AH00016: Configuration Failed [Fri Dec 28 15:04:59.020414 2018] [ssl:emerg] [pid 22187] AH02312: Fatal error initialising mod_ssl, exiting. [Fri Dec 28 15:04:59.020417 2018] [ssl:emerg] [pid 22187] AH02564: Failed to configure encrypted (?) private key sheerdecor.ru:443:0, check /ssl/site_ru.pem AH00016: Configuration Failed - theblackpost
  • And the key in your config is? This option is a certificate - SSLCertificateFile /path/to/site_ru.crt, and this key is SSLCertificateKeyFile /path/to/site_ru.key - Sergey Gamov