All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sherpa.TrustStore Maven / Gradle / Ivy

Go to download

Sherpa is a Java library that provides support to the integration of Java simulators with Everest through its REST APIs.

The newest version!
package org.sherpa;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;

public class TrustStore {

    private File file;

    public TrustStore() {
        try {
            file = File.createTempFile("cacerts", "truststore");
            extractTrustStore();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public String path() {
        return file.getAbsolutePath();
    }

    public String password() {
        return "1234";
    }

    public String type() {
        return "JKS";
    }

    private void extractTrustStore() throws IOException {
        Files.write(file.toPath(), readTrustStore());
    }

    private byte[] readTrustStore() throws IOException {
        InputStream in = ClassLoader.getSystemResourceAsStream("truststore");
        byte[] buffer = new byte[4096];
        in.read(buffer);
        in.close();
        return buffer;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy