Hi

I have created a Drupal 8 custom module, which uses openssl_x509_fingerprint to generate the thumbprint of certificate which is uploaded in the form. But, openssl_x509_fingerprint fails with the following error

openssl_x509_fingerprint(): cannot get cert from parameter 1 in cert_apic_app_create() (line 39 of /web/platforms/devportal-8.x-2018.4.1.12-20200618-1057/sites/sandbox.portal.net/modules/cert/cert.module) #0 /web/platforms/devportal-8.x-2018.4.1.12-20200618-1057/core/includes/bootstrap.inc(600): _drupal_error_handler_real(2, 'openssl_x509_fi...', '/web/platforms/...', 39, Array)"

When the Certificate is uploaded via form it removes -----BEGIN CERTIFICATE----- and -----END CERTIFICATE-----. So I tried to add it.

$inputCert = '-----BEGIN CERTIFICATE-----\r\n'.$cert.'-----END CERTIFICATE-----';
$thumbprintF = openssl_x509_fingerprint($inputCert, 'sha1', false);

It doesn't seem to work. Appreciate help to get rid of this error. Thanks