From 747484c1cd72a785661ce6c08a470213397baed6 Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Fri, 19 Mar 2021 16:41:41 +0100 Subject: add new method into X509Utils --- .../java/at/gv/egiz/eaaf/core/impl/utils/X509Utils.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'eaaf_core_utils/src') diff --git a/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/X509Utils.java b/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/X509Utils.java index 72c183bf..e2fc4d1b 100644 --- a/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/X509Utils.java +++ b/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/X509Utils.java @@ -5,8 +5,22 @@ import java.util.List; import javax.security.auth.x500.X500Principal; +import org.springframework.util.CollectionUtils; + public class X509Utils { + /** + * Sorts the Certificate Chain by IssuerDN and SubjectDN. The [0]-Element should + * be the Hostname, the last Element should be the Root Certificate. + * + * @param certChain The first element must be the correct one. + * @return sorted Certificate Chain + */ + public static List sortCertificates(X509Certificate[] certChain) { + return sortCertificates(CollectionUtils.arrayToList(certChain)); + + } + /** * Sorts the Certificate Chain by IssuerDN and SubjectDN. The [0]-Element should * be the Hostname, the last Element should be the Root Certificate. @@ -48,4 +62,5 @@ public class X509Utils { return certs; } + } -- cgit v1.2.3