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

com.example.CustomCryptoSettings Maven / Gradle / Ivy

Go to download

SDCri is a set of Java libraries that implements a network communication framework conforming with the IEEE 11073 SDC specifications. This project implements examples for using the glue package.

There is a newer version: 5.1.1
Show newest version
package com.example;

import org.somda.sdc.dpws.crypto.CryptoSettings;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.Optional;
import java.util.regex.Pattern;

public class CustomCryptoSettings implements CryptoSettings {

    private static final String keyStorePath = "crypto/sdcparticipant.jks";
    private static final String trustStorePath = "crypto/root.jks";
    private static final String keyStorePassword = "whatever";
    private static final String trustStorePassword = "whatever";

    @Override
    public Optional getKeyStoreFile() {
        return Optional.empty();
    }

    @Override
    public Optional getKeyStoreStream() {
        return Optional.ofNullable(getClass().getClassLoader().getResourceAsStream(keyStorePath));
    }

    @Override
    public String getKeyStorePassword() {
        return keyStorePassword;
    }

    @Override
    public Optional getTrustStoreFile() {
        return Optional.empty();
    }

    @Override
    public Optional getTrustStoreStream() {
        return Optional.ofNullable(getClass().getClassLoader().getResourceAsStream(trustStorePath));
    }

    @Override
    public String getTrustStorePassword() {
        return trustStorePassword;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy