Convert .cer certificate exported from Keychain.app to PEM format:
openssl x509 -inform der -outform pem -in moonist-ca.cer -out moonist-ca.pem
Convert .p12 bundle (certificate + key) exported from Keychain.app to PEM format:
openssl pkcs12 -in grafana.p12 -out grafana.pem -nodes
Then split resulting pem file into two separate files (certificate and key) using text editor.
Note: CA certificate (and all intermediate ones) should be «chained» into leaf certificate pem file.