diff options
author | Thomas <> | 2021-03-19 16:41:41 +0100 |
---|---|---|
committer | Thomas <> | 2021-03-19 16:41:41 +0100 |
commit | 747484c1cd72a785661ce6c08a470213397baed6 (patch) | |
tree | 14b37f6ff3fb8a2e7aed2bf2853bf132b1dc1e13 /eaaf_core_utils | |
parent | 70004e7814f01e866a9a13a6ff51337e260fcad9 (diff) | |
download | EAAF-Components-747484c1cd72a785661ce6c08a470213397baed6.tar.gz EAAF-Components-747484c1cd72a785661ce6c08a470213397baed6.tar.bz2 EAAF-Components-747484c1cd72a785661ce6c08a470213397baed6.zip |
add new method into X509Utils
Diffstat (limited to 'eaaf_core_utils')
-rw-r--r-- | eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/X509Utils.java | 15 |
1 files changed, 15 insertions, 0 deletions
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,12 +5,26 @@ 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<X509Certificate> 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. + * * @param certs The first element must be the correct one. * @return sorted Certificate Chain */ @@ -48,4 +62,5 @@ public class X509Utils { return certs; } + } |