Skip to main content

4. Trust a Private Certificate Authority

The orders service now has to call a partner system over HTTPS. That system presents a certificate signed by your company's own authority.

TLS handshake failure on a private CA​

Add the call to the route:

orders.camel.yaml
- to:
uri: https://inventory.corp.example/stock

Deploy. The integration starts, but the call fails, and the logs say:

Logs of the integration
PKIX path building failed: unable to find valid certification path to requested target

Java only trusts the public certificate authorities it ships with. Yours is not one of them.

Truststore built from a PEM bundle​

How the truststore of an integration is built

1. PEM file in a Resources File configuration​

Get the certificate of the authority as a PEM file, such as corp-ca.pem. If the partner's certificate was signed by an intermediate authority, put the root and the intermediate in the same file, one after the other.

corp-ca.pem
-----BEGIN CERTIFICATE-----
MIIDdzCCAl+gAwIBAgIE... the root authority
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIDqDCCApCgAwIBAgIJ... an intermediate authority, if there is one
-----END CERTIFICATE-----

In Secret Manager, create a Resources File configuration named corp-ca and drop the file in it. Make it available to the environment.

2. Set Trusted CA Certificates in the JVM settings​

On orders-api, add the setting JVM. In Trusted CA Certificates, choose the configuration corp-ca, then the file corp-ca.pem. Leave Keep Public Authorities on.

3. Deploy​

Apply changes. Before the integration starts, a step builds its truststore: the public authorities, plus yours. The call to the partner now succeeds, and calls to public services keep working.

Trusting public CAs along with yours, or yours only​

One switch decides whether your authorities are added to the public ones or replace them.

Keep Public AuthoritiesThe integration trusts
On (default)Public services and your authority
OffYour authority only; every call to a public HTTPS service is refused

Turn it off only for an integration that must talk to your own systems and nothing else.

Turning Keep Public Authorities off

With the switch off, the integration trusts only the authorities of your file. Every call to a service signed by a public authority (a SaaS API, a cloud provider) then fails. Turn it off only for an integration that must talk to private services exclusively.

Truststore build failures​

The step that builds the truststore fails when the file holds no certificate: the integration then does not start, and the instance shows which step failed. Check that the file is a PEM file, with its -----BEGIN CERTIFICATE----- lines.

The complete reference is in Trust a Private Certificate Authority.

Other JVM options​

The JVM setting is not only about certificates.

FieldUse it to
JVM OptionsPass flags such as -Xmx512m
Remote DebuggingAttach a debugger, in a development environment
Extra ClasspathAdd a driver or a library mounted as a file
AgentsAttach a Java agent

Next: scale the integration.