Search code examples
openssledi

OpenSSL trusted certificate error


Trying to create an AS2 EDI connection with a signed MDN using the PHP AS2Secure library running on Ubuntu 14.04.

When the app issues this command:

openssl smime  -encrypt -in '/tmp/as2file_ipLjR3' -out '/tmp/as2file_j2HDRa' -des3 '/home/server/app/as2secure/partners/sourcingco/SourcingCoAS2.cer'

It produces this error:

unable to load certificate
140035455448736:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:703:Expecting: TRUSTED CERTIFICATE

Any ideas where I'm getting this wrong?


Solution

  • The PHP AS2Secure library requires a PEM certificate file. While some AS2 implementations rely on .cer self-signed certificate files, this particular library requires PEM.

    As it relies on OpenSSL, you can convert .cer / .der via the following command:

     openssl x509 -inform der -in certificate.cer -out certificate.pem
    

    This should solve the problem of the software looking for the right format.