public static Path cloneKeyStoreWithTC()

in sonar-plugin-agent/src/main/java/jetbrains/buildserver/sonarplugin/util/SSLTools.java [29:44]


    public static Path cloneKeyStoreWithTC(@Nullable String javaHome, String teamcityCertificateFolderPath) {
        try {
            KeyStore cacerts = getCacertsKeyStore(javaHome);
            File f = File.createTempFile("tmpks", ".jks");
            if (storeCertificates(cacerts, teamcityCertificateFolderPath) > 0) {
                try (FileOutputStream fos = new FileOutputStream(f)) {
                    cacerts.store(fos, "changeit".toCharArray());
                }
                return f.toPath();
            }
            log.error("Error while using certificates from {}", teamcityCertificateFolderPath);
        } catch (Exception e) {
            log.error("Error while using certificates from {}", teamcityCertificateFolderPath, e);
        }
        return null;
    }