Skip to main content

Trust Private Certificates in the JVM Truststore

An integration that calls a service over HTTPS checks the certificate that service presents. If the certificate was signed by a private certificate authority (the one of your company, of a partner, or a self-signed one on a test system), the call is refused, because the integration only knows the public authorities.

The JVM setting of an integration lets you add your own authorities to the ones it trusts.

How an integration comes to trust a private authority

Default truststore behavior​

A JVM only trusts the certificate authorities in its truststore. Out of the box that is the public authorities shipped with Java, which decides what an integration can call over TLS.

The service is signed byWithout this settingWith this setting
A public authority (Let's Encrypt, DigiCert…)The call worksThe call works
Your company's authorityThe call is refusedThe call works
A self-signed certificateThe call is refusedThe call works

A refused call typically shows in the logs of the integration as PKIX path building failed or unable to find valid certification path to requested target.

PEM bundle requirements​

One PEM file holding the certificate of the authority. The file may hold several certificates, one after the other, for example a root authority and an intermediate one, or the authorities of two partners:

company-ca.pem
-----BEGIN CERTIFICATE-----
MIIDdzCCAl+gAwIBAgIE...
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIDqDCCApCgAwIBAgIJ...
-----END CERTIFICATE-----

Lines outside the BEGIN / END blocks, such as comments, are ignored.

Certificates only

The file holds certificates, which are public. It never holds a private key.

Truststore Configuration​

1. Resources File configuration​

In Secret Manager, create a configuration of the kind Resources File and drop your PEM file in it. Make it available to the environment the integration runs in.

You can also do it from the integration itself: in the field described below, New secret opens the same creation panel and selects what you created.

2. Set Trusted CA Certificates in the JVM settings​

Open the integration, add or edit its JVM setting, and fill in Trusted CA Certificates:

  1. choose the configuration that holds the file;
  2. choose the file in it.

The field shows where the file is mounted for you. Nothing else has to be mounted by hand.

3. Deploy​

Deploy the integration. Before it starts, a step builds its truststore; the integration then starts with it.

Parameters​

FieldWhat it isDefault
Trusted CA CertificatesThe PEM file of your authorities, chosen in a stored configuration. One file; it may hold several certificates.None
Keep Public AuthoritiesAlso trust the public authorities Java ships with, so that calls to public HTTPS services keep working.On
Truststore PasswordThe password of the truststore that is built, in plain text: at least 6 letters, digits or . _ @ % + -.changeit

The truststore only holds certificates, which are public: its password protects nothing secret. The default is the one Java itself uses, and there is rarely a reason to change it.

Trust scenarios​

Two fields decide what the integration trusts. These are the combinations that make sense.

You want the integration to trustTrusted CA CertificatesKeep Public Authorities
Public services onlyLeave empty—
Public services and your authorityYour fileOn
Public services and several private authoritiesOne file holding them allOn
Only your authority, and nothing publicYour fileOff
Turning public authorities off

With Keep Public Authorities off, every call to a public HTTPS service (a cloud API, a SaaS) is refused. Use it only for an integration that must talk to your own systems and nothing else.

Truststore build sequence (init container)​

  1. The configuration is mounted in the integration.
  2. A step runs before the integration: it starts from the truststore Java ships with (unless public authorities are off), then adds each certificate of your file.
  3. The integration starts with that truststore.

If the file holds no certificate, the step fails and the integration does not start: you see the error instead of running with an authority that is silently missing.

Changing the file, the password or the switch restarts the integration.

Verification​

  • The integration reaches Running and is ready.
  • A call to the service signed by your authority succeeds.

If the integration stays in its starting phase, open its instance and look at the step that runs first: it says which certificate could not be read.

Limits and Constraints​

  • One file per integration. Put all the authorities an integration needs in the same file.
  • PEM only. A file in another format (DER, PKCS#12, JKS) is not read: convert it to PEM first.
  • For calls the integration makes. This is about the services an integration calls. To serve HTTPS to the outside, publish the integration through an API Gateway, which holds the certificate.