mirror of
https://github.com/GravitLauncher/Launcher
synced 2025-02-08 15:29:36 +03:00
[FEATURE] Fix truststore path
This commit is contained in:
parent
1d63fbbd93
commit
907332ff06
2 changed files with 7 additions and 1 deletions
|
@ -63,7 +63,7 @@ public static void main(String[] args) throws Exception {
|
|||
directories.collect();
|
||||
CertificateManager certificateManager = new CertificateManager();
|
||||
try {
|
||||
certificateManager.readTrustStore(dir.resolve("truststore"));
|
||||
certificateManager.readTrustStore(directories.trustStore);
|
||||
} catch (CertificateException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
public class CertificateManager {
|
||||
private transient final Logger logger = LogManager.getLogger();
|
||||
public LauncherTrustManager trustManager;
|
||||
private Path truststorePath;
|
||||
|
||||
public void writePrivateKey(Path file, PrivateKey privateKey) throws IOException {
|
||||
writePrivateKey(IOHelper.newWriter(file), privateKey);
|
||||
|
@ -91,6 +92,7 @@ public X509CertificateHolder readCertificate(Reader reader) throws IOException {
|
|||
}
|
||||
|
||||
public void readTrustStore(Path dir) throws IOException, CertificateException {
|
||||
this.truststorePath = dir;
|
||||
if (!IOHelper.isDir(dir)) {
|
||||
Files.createDirectories(dir);
|
||||
try {
|
||||
|
@ -131,4 +133,8 @@ public LauncherTrustManager.CheckClassResult checkClass(Class<?> clazz) {
|
|||
X509Certificate[] certificates = JVMHelper.getCertificates(clazz);
|
||||
return trustManager.checkCertificates(certificates, trustManager::stdCertificateChecker);
|
||||
}
|
||||
|
||||
public Path getTruststorePath() {
|
||||
return truststorePath;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue