mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +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.NoSuchAlgorithmException;
|
||||||
import java.security.NoSuchProviderException;
|
import java.security.NoSuchProviderException;
|
||||||
import java.security.SignatureException;
|
import java.security.SignatureException;
|
||||||
import java.security.cert.CertificateEncodingException;
|
import java.security.cert.*;
|
||||||
import java.security.cert.CertificateException;
|
|
||||||
import java.security.cert.CertificateFactory;
|
|
||||||
import java.security.cert.X509Certificate;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -87,4 +84,15 @@ public boolean isTrusted(X509Certificate certificate) throws CertificateEncoding
|
||||||
public X509Certificate[] getTrusted() {
|
public X509Certificate[] getTrusted() {
|
||||||
return Arrays.copyOf(trustSigners, trustSigners.length); // AntiModify orig array!!!
|
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