From e1a1d0e233926c8612d073d43bbcf96fdd77b17e Mon Sep 17 00:00:00 2001 From: Garvit Joshi Date: Mon, 26 Jan 2026 15:22:20 +0530 Subject: [PATCH 1/2] Show certificates from truststore in SSL info endpoint See gh-48967 Signed-off-by: Garvit Joshi --- .../springframework/boot/info/SslInfo.java | 19 ++++- .../boot/info/SslInfoTests.java | 69 +++++++++++++++++- .../springframework/boot/info/keystore.jks | Bin 0 -> 2604 bytes .../springframework/boot/info/truststore.jks | Bin 0 -> 1837 bytes .../info/InfoEndpointDocumentationTests.java | 38 +++++++++- 5 files changed, 119 insertions(+), 7 deletions(-) create mode 100644 core/spring-boot/src/test/resources/org/springframework/boot/info/keystore.jks create mode 100644 core/spring-boot/src/test/resources/org/springframework/boot/info/truststore.jks diff --git a/core/spring-boot/src/main/java/org/springframework/boot/info/SslInfo.java b/core/spring-boot/src/main/java/org/springframework/boot/info/SslInfo.java index 46da37d4e64..4c848b0d82e 100644 --- a/core/spring-boot/src/main/java/org/springframework/boot/info/SslInfo.java +++ b/core/spring-boot/src/main/java/org/springframework/boot/info/SslInfo.java @@ -104,9 +104,12 @@ public class SslInfo { private final List certificateChains; + private final List trustStoreCertificates; + private BundleInfo(String name, SslBundle sslBundle) { this.name = name; this.certificateChains = extractCertificateChains(sslBundle.getStores().getKeyStore()); + this.trustStoreCertificates = extractCertificateChains(sslBundle.getStores().getTrustStore()); } private List extractCertificateChains(@Nullable KeyStore keyStore) { @@ -132,6 +135,10 @@ public class SslInfo { return this.certificateChains; } + public List getTrustStoreCertificates() { + return this.trustStoreCertificates; + } + } /** @@ -150,9 +157,17 @@ public class SslInfo { private List extractCertificates(KeyStore keyStore, String alias) { try { + // First try to get the certificate chain (works for PrivateKeyEntry) Certificate[] certificates = keyStore.getCertificateChain(alias); - return (!ObjectUtils.isEmpty(certificates)) - ? Arrays.stream(certificates).map(CertificateInfo::new).toList() : Collections.emptyList(); + if (!ObjectUtils.isEmpty(certificates)) { + return Arrays.stream(certificates).map(CertificateInfo::new).toList(); + } + // Fall back to single certificate (works for trustedCertEntry) + Certificate certificate = keyStore.getCertificate(alias); + if (certificate != null) { + return List.of(new CertificateInfo(certificate)); + } + return Collections.emptyList(); } catch (KeyStoreException ex) { return Collections.emptyList(); diff --git a/core/spring-boot/src/test/java/org/springframework/boot/info/SslInfoTests.java b/core/spring-boot/src/test/java/org/springframework/boot/info/SslInfoTests.java index d36f1f2ce27..4b5a35295b2 100644 --- a/core/spring-boot/src/test/java/org/springframework/boot/info/SslInfoTests.java +++ b/core/spring-boot/src/test/java/org/springframework/boot/info/SslInfoTests.java @@ -60,9 +60,9 @@ class SslInfoTests { assertThat(bundle.getCertificateChains().get(1).getAlias()).isEqualTo("test-alias"); assertThat(bundle.getCertificateChains().get(1).getCertificates()).hasSize(1); assertThat(bundle.getCertificateChains().get(2).getAlias()).isEqualTo("spring-boot-cert"); - assertThat(bundle.getCertificateChains().get(2).getCertificates()).isEmpty(); + assertThat(bundle.getCertificateChains().get(2).getCertificates()).hasSize(1); assertThat(bundle.getCertificateChains().get(3).getAlias()).isEqualTo("test-alias-cert"); - assertThat(bundle.getCertificateChains().get(3).getCertificates()).isEmpty(); + assertThat(bundle.getCertificateChains().get(3).getCertificates()).hasSize(1); CertificateInfo cert1 = bundle.getCertificateChains().get(0).getCertificates().get(0); assertThat(cert1.getSubject()).isEqualTo("CN=localhost,OU=Spring,O=VMware,L=Palo Alto,ST=California,C=US"); assertThat(cert1.getIssuer()).isEqualTo(cert1.getSubject()); @@ -85,6 +85,7 @@ class SslInfoTests { assertThat(cert2.getValidity()).isNotNull(); assertThat(cert2.getValidity().getStatus()).isSameAs(Status.VALID); assertThat(cert2.getValidity().getMessage()).isNull(); + assertThat(bundle.getTrustStoreCertificates()).isEmpty(); } @Test @@ -149,7 +150,7 @@ class SslInfoTests { .flatMap((bundle) -> bundle.getCertificateChains().stream()) .flatMap((certificateChain) -> certificateChain.getCertificates().stream()) .toList(); - assertThat(certs).hasSize(5); + assertThat(certs).hasSize(7); assertThat(certs).allSatisfy((cert) -> { assertThat(cert.getSubject()).isEqualTo("CN=localhost,OU=Spring,O=VMware,L=Palo Alto,ST=California,C=US"); assertThat(cert.getIssuer()).isEqualTo(cert.getSubject()); @@ -188,6 +189,68 @@ class SslInfoTests { SslInfo sslInfo = new SslInfo(sslBundleRegistry, CLOCK); assertThat(sslInfo.getBundles()).hasSize(1); assertThat(sslInfo.getBundles().get(0).getCertificateChains()).isEmpty(); + assertThat(sslInfo.getBundles().get(0).getTrustStoreCertificates()).isEmpty(); + } + + @Test + @WithPackageResources("test.p12") + void trustStoreCertificatesShouldProvideSslInfo() { + DefaultSslBundleRegistry sslBundleRegistry = new DefaultSslBundleRegistry(); + JksSslStoreDetails trustStoreDetails = JksSslStoreDetails.forLocation("classpath:test.p12") + .withPassword("secret"); + SslStoreBundle sslStoreBundle = new JksSslStoreBundle(null, trustStoreDetails); + sslBundleRegistry.registerBundle("test-trust", SslBundle.of(sslStoreBundle)); + SslInfo sslInfo = new SslInfo(sslBundleRegistry, CLOCK); + assertThat(sslInfo.getBundles()).hasSize(1); + BundleInfo bundle = sslInfo.getBundles().get(0); + assertThat(bundle.getName()).isEqualTo("test-trust"); + assertThat(bundle.getCertificateChains()).isEmpty(); + assertThat(bundle.getTrustStoreCertificates()).hasSize(4); + assertThat(bundle.getTrustStoreCertificates().get(0).getAlias()).isEqualTo("spring-boot"); + assertThat(bundle.getTrustStoreCertificates().get(1).getAlias()).isEqualTo("test-alias"); + } + + @Test + @WithPackageResources("test.p12") + void bothKeyStoreAndTrustStoreCertificatesShouldProvideSslInfo() { + DefaultSslBundleRegistry sslBundleRegistry = new DefaultSslBundleRegistry(); + JksSslStoreDetails storeDetails = JksSslStoreDetails.forLocation("classpath:test.p12").withPassword("secret"); + SslStoreBundle sslStoreBundle = new JksSslStoreBundle(storeDetails, storeDetails); + sslBundleRegistry.registerBundle("test-both", SslBundle.of(sslStoreBundle)); + SslInfo sslInfo = new SslInfo(sslBundleRegistry, CLOCK); + assertThat(sslInfo.getBundles()).hasSize(1); + BundleInfo bundle = sslInfo.getBundles().get(0); + assertThat(bundle.getName()).isEqualTo("test-both"); + assertThat(bundle.getCertificateChains()).hasSize(4); + assertThat(bundle.getTrustStoreCertificates()).hasSize(4); + } + + @Test + @WithPackageResources({ "keystore.jks", "truststore.jks" }) + void separateKeyStoreAndTrustStoreShouldProvideSslInfo() { + DefaultSslBundleRegistry sslBundleRegistry = new DefaultSslBundleRegistry(); + JksSslStoreDetails keyStoreDetails = JksSslStoreDetails.forLocation("classpath:keystore.jks") + .withPassword("secret"); + JksSslStoreDetails trustStoreDetails = JksSslStoreDetails.forLocation("classpath:truststore.jks") + .withPassword("secret"); + SslStoreBundle sslStoreBundle = new JksSslStoreBundle(keyStoreDetails, trustStoreDetails); + sslBundleRegistry.registerBundle("test-separate", SslBundle.of(sslStoreBundle)); + SslInfo sslInfo = new SslInfo(sslBundleRegistry, CLOCK); + assertThat(sslInfo.getBundles()).hasSize(1); + BundleInfo bundle = sslInfo.getBundles().get(0); + assertThat(bundle.getName()).isEqualTo("test-separate"); + // Keystore has 2 PrivateKeyEntry entries + assertThat(bundle.getCertificateChains()).hasSize(2); + assertThat(bundle.getCertificateChains()).allSatisfy((chain) -> { + assertThat(chain.getCertificates()).hasSize(1); + assertThat(chain.getCertificates().get(0).getSubject()).startsWith("CN=localhost"); + }); + // Truststore has 3 trustedCertEntry entries + assertThat(bundle.getTrustStoreCertificates()).hasSize(3); + assertThat(bundle.getTrustStoreCertificates()).allSatisfy((chain) -> { + assertThat(chain.getCertificates()).hasSize(1); + assertThat(chain.getCertificates().get(0).getSubject()).startsWith("CN=localhost"); + }); } private SslInfo createSslInfo(String... locations) { diff --git a/core/spring-boot/src/test/resources/org/springframework/boot/info/keystore.jks b/core/spring-boot/src/test/resources/org/springframework/boot/info/keystore.jks new file mode 100644 index 0000000000000000000000000000000000000000..4e3e26f8195a6f7c40a7eaa0564fa136a1c6d7ee GIT binary patch literal 2604 zcmZ{lXH?VK7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o{YL8|rQ{j^lS6HnHf zpIF>^R9PW%muqtNeZP*IJnD_M%he53*%sA@-8gvV_>+t!heIA_h5UNK;a;uQe@)Y? zLnzZFuScm-2b^3G)*|Yb(wzbA2L^XekqLqCe}UiJJAKIn(Q8?gmb| znXZt%ZTaCHuVod!y8T`HKh!!=H==CEpUWa2(!88FmhF97SGVum9LujV6(S5-#3< z&1dTN$8R=knqA0g_nGlo_~oZx3yqG*f3TIb%(G-kx_tTjb-nP}np53;Sg$-(m%Z7y z&e?H7=fb+`-+v`nALHKr@8m|NzN}@wR;Fqi8<(~JTvX#cL%>ceLSV(OA1^FSD|VRu ziL=R)oftVSK}u~_Y-^9ro(oY%%j5e@E?7D?))!`T8}Um1W($ZuTlH;K^DfZ{?zM-6 z33dx`m2*Yv4=btUU+n{DwS2xr%mp4BRFyM!xOh|Nl|HW2{?rdx@*Hz zIHNW&C8--Uo`WXvJbzCI1I8EG(|mL)FWvwws;^Xst z&pC5b+26Fpd(F!#Jm#F?kNtBbwW2$!{c+BPNpF+1jOx`?f0yTd-nIKvtJyuPDr6@! zdoUQdGAXz*P4iW5{pwQICu#n)PKYTzSh2xT{J@jt?VEh~$`9;kQe;?ZoxVze>4w4O z%lX$HA6nqBbU9c3Hk&u+Z}=>ka8u^>KeY0~2ppOc`wZZrIa*$fmKQ^{yqF%cmd9`6 Tp(8$AZm;+!JmEOe_xK|Kwg%hN literal 0 HcmV?d00001 diff --git a/documentation/spring-boot-actuator-docs/src/test/java/org/springframework/boot/actuate/docs/info/InfoEndpointDocumentationTests.java b/documentation/spring-boot-actuator-docs/src/test/java/org/springframework/boot/actuate/docs/info/InfoEndpointDocumentationTests.java index 0d11d51829b..db1e2a5c9ee 100644 --- a/documentation/spring-boot-actuator-docs/src/test/java/org/springframework/boot/actuate/docs/info/InfoEndpointDocumentationTests.java +++ b/documentation/spring-boot-actuator-docs/src/test/java/org/springframework/boot/actuate/docs/info/InfoEndpointDocumentationTests.java @@ -208,6 +208,40 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests { .description("Certificate validity status.") .type(JsonFieldType.STRING), fieldWithPath("bundles[].certificateChains[].certificates[].signatureAlgorithmName") + .description("Signature algorithm name.") + .type(JsonFieldType.STRING), + fieldWithPath("bundles[].trustStoreCertificates").description("Certificate chains in the trust store.") + .type(JsonFieldType.ARRAY), + fieldWithPath("bundles[].trustStoreCertificates[].alias").description("Alias of the certificate chain.") + .type(JsonFieldType.STRING), + fieldWithPath("bundles[].trustStoreCertificates[].certificates") + .description("Certificates in the chain.") + .type(JsonFieldType.ARRAY), + fieldWithPath("bundles[].trustStoreCertificates[].certificates[].subject") + .description("Subject of the certificate.") + .type(JsonFieldType.STRING), + fieldWithPath("bundles[].trustStoreCertificates[].certificates[].version") + .description("Version of the certificate.") + .type(JsonFieldType.STRING), + fieldWithPath("bundles[].trustStoreCertificates[].certificates[].issuer") + .description("Issuer of the certificate.") + .type(JsonFieldType.STRING), + fieldWithPath("bundles[].trustStoreCertificates[].certificates[].validityStarts") + .description("Certificate validity start date.") + .type(JsonFieldType.STRING), + fieldWithPath("bundles[].trustStoreCertificates[].certificates[].serialNumber") + .description("Serial number of the certificate.") + .type(JsonFieldType.STRING), + fieldWithPath("bundles[].trustStoreCertificates[].certificates[].validityEnds") + .description("Certificate validity end date.") + .type(JsonFieldType.STRING), + fieldWithPath("bundles[].trustStoreCertificates[].certificates[].validity") + .description("Certificate validity information.") + .type(JsonFieldType.OBJECT), + fieldWithPath("bundles[].trustStoreCertificates[].certificates[].validity.status") + .description("Certificate validity status.") + .type(JsonFieldType.STRING), + fieldWithPath("bundles[].trustStoreCertificates[].certificates[].signatureAlgorithmName") .description("Signature algorithm name.") .type(JsonFieldType.STRING)); } @@ -259,9 +293,9 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests { @Bean SslInfo sslInfo() { DefaultSslBundleRegistry sslBundleRegistry = new DefaultSslBundleRegistry(); - JksSslStoreDetails keyStoreDetails = JksSslStoreDetails.forLocation("classpath:test.p12") + JksSslStoreDetails storeDetails = JksSslStoreDetails.forLocation("classpath:test.p12") .withPassword("secret"); - SslStoreBundle sslStoreBundle = new JksSslStoreBundle(keyStoreDetails, null); + SslStoreBundle sslStoreBundle = new JksSslStoreBundle(storeDetails, storeDetails); sslBundleRegistry.registerBundle("test-0", SslBundle.of(sslStoreBundle)); return new SslInfo(sslBundleRegistry); } From 27b9402df1b9104421a4aa0d52df0db73e6a166e Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Fri, 6 Feb 2026 12:04:31 +0100 Subject: [PATCH 2/2] Polish "Show certificates from truststore in SSL info endpoint" See gh-48967 --- .../springframework/boot/info/SslInfo.java | 33 ++++++++++++------- .../boot/info/SslInfoTests.java | 16 ++++----- .../info/InfoEndpointDocumentationTests.java | 26 ++++++++------- 3 files changed, 44 insertions(+), 31 deletions(-) diff --git a/core/spring-boot/src/main/java/org/springframework/boot/info/SslInfo.java b/core/spring-boot/src/main/java/org/springframework/boot/info/SslInfo.java index 4c848b0d82e..b3be703613d 100644 --- a/core/spring-boot/src/main/java/org/springframework/boot/info/SslInfo.java +++ b/core/spring-boot/src/main/java/org/springframework/boot/info/SslInfo.java @@ -104,12 +104,12 @@ public class SslInfo { private final List certificateChains; - private final List trustStoreCertificates; + private final List trustStoreCertificateChains; private BundleInfo(String name, SslBundle sslBundle) { this.name = name; this.certificateChains = extractCertificateChains(sslBundle.getStores().getKeyStore()); - this.trustStoreCertificates = extractCertificateChains(sslBundle.getStores().getTrustStore()); + this.trustStoreCertificateChains = extractCertificateChains(sslBundle.getStores().getTrustStore()); } private List extractCertificateChains(@Nullable KeyStore keyStore) { @@ -135,8 +135,8 @@ public class SslInfo { return this.certificateChains; } - public List getTrustStoreCertificates() { - return this.trustStoreCertificates; + public List getTrustStoreCertificateChains() { + return this.trustStoreCertificateChains; } } @@ -157,15 +157,13 @@ public class SslInfo { private List extractCertificates(KeyStore keyStore, String alias) { try { - // First try to get the certificate chain (works for PrivateKeyEntry) - Certificate[] certificates = keyStore.getCertificateChain(alias); - if (!ObjectUtils.isEmpty(certificates)) { - return Arrays.stream(certificates).map(CertificateInfo::new).toList(); + List certificates = readCertificateChain(keyStore, alias); + if (certificates != null) { + return certificates; } - // Fall back to single certificate (works for trustedCertEntry) - Certificate certificate = keyStore.getCertificate(alias); + List certificate = readCertificate(keyStore, alias); if (certificate != null) { - return List.of(new CertificateInfo(certificate)); + return certificate; } return Collections.emptyList(); } @@ -174,6 +172,19 @@ public class SslInfo { } } + private @Nullable List readCertificate(KeyStore keyStore, String alias) + throws KeyStoreException { + Certificate certificate = keyStore.getCertificate(alias); + return (certificate != null) ? List.of(new CertificateInfo(certificate)) : null; + } + + private @Nullable List readCertificateChain(KeyStore keyStore, String alias) + throws KeyStoreException { + Certificate[] certificates = keyStore.getCertificateChain(alias); + return ObjectUtils.isEmpty(certificates) ? null + : Arrays.stream(certificates).map(CertificateInfo::new).toList(); + } + public String getAlias() { return this.alias; } diff --git a/core/spring-boot/src/test/java/org/springframework/boot/info/SslInfoTests.java b/core/spring-boot/src/test/java/org/springframework/boot/info/SslInfoTests.java index 4b5a35295b2..57b9d3e38fb 100644 --- a/core/spring-boot/src/test/java/org/springframework/boot/info/SslInfoTests.java +++ b/core/spring-boot/src/test/java/org/springframework/boot/info/SslInfoTests.java @@ -85,7 +85,7 @@ class SslInfoTests { assertThat(cert2.getValidity()).isNotNull(); assertThat(cert2.getValidity().getStatus()).isSameAs(Status.VALID); assertThat(cert2.getValidity().getMessage()).isNull(); - assertThat(bundle.getTrustStoreCertificates()).isEmpty(); + assertThat(bundle.getTrustStoreCertificateChains()).isEmpty(); } @Test @@ -189,7 +189,7 @@ class SslInfoTests { SslInfo sslInfo = new SslInfo(sslBundleRegistry, CLOCK); assertThat(sslInfo.getBundles()).hasSize(1); assertThat(sslInfo.getBundles().get(0).getCertificateChains()).isEmpty(); - assertThat(sslInfo.getBundles().get(0).getTrustStoreCertificates()).isEmpty(); + assertThat(sslInfo.getBundles().get(0).getTrustStoreCertificateChains()).isEmpty(); } @Test @@ -205,9 +205,9 @@ class SslInfoTests { BundleInfo bundle = sslInfo.getBundles().get(0); assertThat(bundle.getName()).isEqualTo("test-trust"); assertThat(bundle.getCertificateChains()).isEmpty(); - assertThat(bundle.getTrustStoreCertificates()).hasSize(4); - assertThat(bundle.getTrustStoreCertificates().get(0).getAlias()).isEqualTo("spring-boot"); - assertThat(bundle.getTrustStoreCertificates().get(1).getAlias()).isEqualTo("test-alias"); + assertThat(bundle.getTrustStoreCertificateChains()).hasSize(4); + assertThat(bundle.getTrustStoreCertificateChains().get(0).getAlias()).isEqualTo("spring-boot"); + assertThat(bundle.getTrustStoreCertificateChains().get(1).getAlias()).isEqualTo("test-alias"); } @Test @@ -222,7 +222,7 @@ class SslInfoTests { BundleInfo bundle = sslInfo.getBundles().get(0); assertThat(bundle.getName()).isEqualTo("test-both"); assertThat(bundle.getCertificateChains()).hasSize(4); - assertThat(bundle.getTrustStoreCertificates()).hasSize(4); + assertThat(bundle.getTrustStoreCertificateChains()).hasSize(4); } @Test @@ -246,8 +246,8 @@ class SslInfoTests { assertThat(chain.getCertificates().get(0).getSubject()).startsWith("CN=localhost"); }); // Truststore has 3 trustedCertEntry entries - assertThat(bundle.getTrustStoreCertificates()).hasSize(3); - assertThat(bundle.getTrustStoreCertificates()).allSatisfy((chain) -> { + assertThat(bundle.getTrustStoreCertificateChains()).hasSize(3); + assertThat(bundle.getTrustStoreCertificateChains()).allSatisfy((chain) -> { assertThat(chain.getCertificates()).hasSize(1); assertThat(chain.getCertificates().get(0).getSubject()).startsWith("CN=localhost"); }); diff --git a/documentation/spring-boot-actuator-docs/src/test/java/org/springframework/boot/actuate/docs/info/InfoEndpointDocumentationTests.java b/documentation/spring-boot-actuator-docs/src/test/java/org/springframework/boot/actuate/docs/info/InfoEndpointDocumentationTests.java index db1e2a5c9ee..41ee62ec7eb 100644 --- a/documentation/spring-boot-actuator-docs/src/test/java/org/springframework/boot/actuate/docs/info/InfoEndpointDocumentationTests.java +++ b/documentation/spring-boot-actuator-docs/src/test/java/org/springframework/boot/actuate/docs/info/InfoEndpointDocumentationTests.java @@ -210,38 +210,40 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests { fieldWithPath("bundles[].certificateChains[].certificates[].signatureAlgorithmName") .description("Signature algorithm name.") .type(JsonFieldType.STRING), - fieldWithPath("bundles[].trustStoreCertificates").description("Certificate chains in the trust store.") + fieldWithPath("bundles[].trustStoreCertificateChains") + .description("Certificate chains in the trust store.") .type(JsonFieldType.ARRAY), - fieldWithPath("bundles[].trustStoreCertificates[].alias").description("Alias of the certificate chain.") + fieldWithPath("bundles[].trustStoreCertificateChains[].alias") + .description("Alias of the certificate chain.") .type(JsonFieldType.STRING), - fieldWithPath("bundles[].trustStoreCertificates[].certificates") + fieldWithPath("bundles[].trustStoreCertificateChains[].certificates") .description("Certificates in the chain.") .type(JsonFieldType.ARRAY), - fieldWithPath("bundles[].trustStoreCertificates[].certificates[].subject") + fieldWithPath("bundles[].trustStoreCertificateChains[].certificates[].subject") .description("Subject of the certificate.") .type(JsonFieldType.STRING), - fieldWithPath("bundles[].trustStoreCertificates[].certificates[].version") + fieldWithPath("bundles[].trustStoreCertificateChains[].certificates[].version") .description("Version of the certificate.") .type(JsonFieldType.STRING), - fieldWithPath("bundles[].trustStoreCertificates[].certificates[].issuer") + fieldWithPath("bundles[].trustStoreCertificateChains[].certificates[].issuer") .description("Issuer of the certificate.") .type(JsonFieldType.STRING), - fieldWithPath("bundles[].trustStoreCertificates[].certificates[].validityStarts") + fieldWithPath("bundles[].trustStoreCertificateChains[].certificates[].validityStarts") .description("Certificate validity start date.") .type(JsonFieldType.STRING), - fieldWithPath("bundles[].trustStoreCertificates[].certificates[].serialNumber") + fieldWithPath("bundles[].trustStoreCertificateChains[].certificates[].serialNumber") .description("Serial number of the certificate.") .type(JsonFieldType.STRING), - fieldWithPath("bundles[].trustStoreCertificates[].certificates[].validityEnds") + fieldWithPath("bundles[].trustStoreCertificateChains[].certificates[].validityEnds") .description("Certificate validity end date.") .type(JsonFieldType.STRING), - fieldWithPath("bundles[].trustStoreCertificates[].certificates[].validity") + fieldWithPath("bundles[].trustStoreCertificateChains[].certificates[].validity") .description("Certificate validity information.") .type(JsonFieldType.OBJECT), - fieldWithPath("bundles[].trustStoreCertificates[].certificates[].validity.status") + fieldWithPath("bundles[].trustStoreCertificateChains[].certificates[].validity.status") .description("Certificate validity status.") .type(JsonFieldType.STRING), - fieldWithPath("bundles[].trustStoreCertificates[].certificates[].signatureAlgorithmName") + fieldWithPath("bundles[].trustStoreCertificateChains[].certificates[].signatureAlgorithmName") .description("Signature algorithm name.") .type(JsonFieldType.STRING)); }