From 8a52340b1a1f70b16358d46233063b6b1a062658 Mon Sep 17 00:00:00 2001 From: Gravit Date: Thu, 17 Oct 2019 01:43:40 +0700 Subject: [PATCH] =?UTF-8?q?[FEATURE]=20=D0=A1=D0=B5=D0=BA=D1=80=D0=B5?= =?UTF-8?q?=D1=82=D0=BD=D0=B0=D1=8F=20=D0=BC=D0=B0=D0=B3=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/pro/gravit/utils/helper/JVMHelper.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/LauncherCore/src/main/java/pro/gravit/utils/helper/JVMHelper.java b/LauncherCore/src/main/java/pro/gravit/utils/helper/JVMHelper.java index 22204cf1..e65b913d 100644 --- a/LauncherCore/src/main/java/pro/gravit/utils/helper/JVMHelper.java +++ b/LauncherCore/src/main/java/pro/gravit/utils/helper/JVMHelper.java @@ -7,6 +7,7 @@ import java.lang.management.RuntimeMXBean; import java.net.MalformedURLException; import java.net.URL; +import java.security.cert.X509Certificate; import java.util.Arrays; import java.util.Collection; import java.util.Locale; @@ -110,6 +111,13 @@ public static URL[] getClassPathURL() { return list; } + public static X509Certificate[] getCertificates(Class clazz) + { + Object[] signers = clazz.getSigners(); + if(signers == null) return new X509Certificate[] {}; + return Arrays.stream(signers).filter((c) -> c instanceof X509Certificate).map((c) -> (X509Certificate) c).toArray(X509Certificate[]::new); + } + public static void checkStackTrace(Class mainClass) { LogHelper.debug("Testing stacktrace"); Exception e = new Exception("Testing stacktrace");