Encoding of certificate values
In trustedCACerts and clientCerts, you must provide an x509 DER-encoded certificate in base64 form. Tools that can save certificates in “plain text” (such as openssl) often support saving the DER data in base64, enclosed with a header BEGIN CERTIFICATE and a footer END CERTIFICATE. In that case, you simply need to copy the base64 contents and specify it in the configuration as a single JSON string.
For example, let’s say you have the following certificate file.
Note:
To make this example easier to follow, the binary content is made shorter and isn’t a valid x509 certificate.-----BEGIN CERTIFICATE-----
MIIFfjCCA2YCFExbVZz05QJD5R2VVXs0pcSzS7S7MA0GCSqGSIb3DQEBCwUAMIGH
QxbkdMN9wZjPpK73bmNJ+RoH
-----END CERTIFICATE-----
The JSON value would then be:
"trustedCACerts": [
"MIIFfjCCA2YCFExbVZz05QJD5R2VVXs0pcSzS7S7MA0GCSqGSIb3DQEBCwUAMIGHQxbkdMN9wZjPpK73bmNJ+RoH"
]
The following UNIX shell script does the transformation:
cat in.crt | sed 's/-----.*-----//' | tr -d '\n'