diff --git a/LauncherCore/src/main/java/pro/gravit/utils/verify/LauncherTrustManager.java b/LauncherCore/src/main/java/pro/gravit/utils/verify/LauncherTrustManager.java index 8e4de504..b35fb07e 100644 --- a/LauncherCore/src/main/java/pro/gravit/utils/verify/LauncherTrustManager.java +++ b/LauncherCore/src/main/java/pro/gravit/utils/verify/LauncherTrustManager.java @@ -9,10 +9,7 @@ import java.security.NoSuchAlgorithmException; import java.security.NoSuchProviderException; import java.security.SignatureException; -import java.security.cert.CertificateEncodingException; -import java.security.cert.CertificateException; -import java.security.cert.CertificateFactory; -import java.security.cert.X509Certificate; +import java.security.cert.*; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -87,4 +84,15 @@ public boolean isTrusted(X509Certificate certificate) throws CertificateEncoding public X509Certificate[] getTrusted() { return Arrays.copyOf(trustSigners, trustSigners.length); // AntiModify orig array!!! } + + public void isCertificateCodeSign(X509Certificate certificate) + { + if(!certificate.getKeyUsage()[0]) throw new SecurityException("Certificate keyUsage \"digitalSignature\" check failed"); + List extended; + try { + extended = certificate.getExtendedKeyUsage(); + } catch (CertificateParsingException e) { + throw new SecurityException(e); + } + } }