mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-22 16:41:46 +03:00
[FEATURE][EXPERIMENTAL] Проверка CodeSign сертификатов
This commit is contained in:
parent
cf63e96c1e
commit
40bd92229a
1 changed files with 12 additions and 4 deletions
|
@ -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<String> extended;
|
||||
try {
|
||||
extended = certificate.getExtendedKeyUsage();
|
||||
} catch (CertificateParsingException e) {
|
||||
throw new SecurityException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue