From ed6915cfb99edb2718b9e3bdb682b4578d9e70af Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 29 Jun 2024 07:44:51 +0200 Subject: [PATCH] fix: Fixed Keypair validity display to link only the leaf [backport release-5.5.0] (#5303) fix: Fixed Keypair validity display to link only the leaf (#5300) * fix: Fixed Keypair validity display to link only the leaf Signed-off-by: MMaiero * chore: Copyright date update --------- Signed-off-by: MMaiero (cherry picked from commit ffcd90ec47f3b93abe4a54cbf92f7c44b2c2120e) Co-authored-by: Matteo Maiero --- .../kura/web/server/GwtCertificatesServiceImpl.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtCertificatesServiceImpl.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtCertificatesServiceImpl.java index 5843534c306..13da21fbbe6 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtCertificatesServiceImpl.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtCertificatesServiceImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2023 Eurotech and/or its affiliates and others + * Copyright (c) 2011, 2024 Eurotech and/or its affiliates and others * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -163,7 +163,7 @@ public List listEntries() throws GwtKuraException { Certificate[] chain = pke.getCertificateChain(); if (chain.length > 0) { - Certificate leaf = chain[chain.length - 1]; + Certificate leaf = chain[0]; if (leaf instanceof X509Certificate) { validityStartDate = ((X509Certificate) leaf).getNotBefore(); @@ -178,7 +178,7 @@ public List listEntries() throws GwtKuraException { Certificate cert = chain[i]; if (cert instanceof X509Certificate) { X509Certificate x509Cert = CertificateUtil.toJavaX509Certificate(cert); - distinguishedNames.add(index + x509Cert.getSubjectX500Principal().getName()); + distinguishedNames.add(index + x509Cert.getSubjectX500Principal().toString()); } } } @@ -192,7 +192,7 @@ public List listEntries() throws GwtKuraException { validityEndDate = ((X509Certificate) cert).getNotAfter(); X509Certificate x509Cert = CertificateUtil.toJavaX509Certificate(cert); - distinguishedNames.add(x509Cert.getSubjectX500Principal().getName()); + distinguishedNames.add(x509Cert.getSubjectX500Principal().toString()); } } else if (e.getValue() instanceof SecretKeyEntry) { kind = Kind.SECRET_KEY; @@ -243,4 +243,4 @@ public void removeEntry(GwtXSRFToken xsrfToken, GwtKeystoreEntry entry) throws G } } } -} \ No newline at end of file +}