I am writing a C# program that has to call an API endpoint that requires authentication via certificates.
I have got a .pfx file, which I can import in Windows and everything works fine, however the app must run in a Linux environment in a Docker container.
I can import crt files into the /etc/ssl/certs
folder in my Docker container just fine using the update-ca-certificates
command.
I have tried the following:
- Use openssl to to convert the pfx file into a crt/pem file that contains both the decrypted private key and the public key
-----BEGIN CERTIFICATE-----
abcd...
-----END CERTIFICATE-----
-----BEGIN RSA PRIVATE KEY-----
abcd...
-----END RSA PRIVATE KEY-----
Bag Attributes
localKeyID: 01 00 00 00
friendlyName: XXX
subject=C = GB, O = 1111.1.1, O = XXX Limited, OU = devices, CN = XXX Limited
issuer=C = gb, O = 1111.1.1, O = YYY CAs, OU = YYY CA, OU = YYY Issuing CA
but the API always says I don't have a valid certificate.
Does anybody know what I'm doing wrong? Do the files have to be in a specific format? Perhaps in a different location?
My app finds the certificate just fine, so that's not the issue. The problem seems to be with the certificate itself.
Thanks in advance.