use of org.dataportabilityproject.gateway.ApiMain in project data-transfer-project by google.
the class SingleVMMain method initializeGateway.
public void initializeGateway() {
ApiMain apiMain = new ApiMain();
try (InputStream stream = ReferenceApiServer.class.getClassLoader().getResourceAsStream("demo-selfsigned-keystore.jks")) {
if (stream == null) {
throw new IllegalArgumentException("Demo keystore was not found");
}
// initialise the keystore
char[] password = "password".toCharArray();
KeyStore keyStore = KeyStore.getInstance("JKS");
keyStore.load(stream, password);
KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance("SunX509");
keyManagerFactory.init(keyStore, password);
TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance("SunX509");
trustManagerFactory.init(keyStore);
apiMain.initializeHttps(trustManagerFactory, keyManagerFactory);
apiMain.start();
} catch (Exception e) {
errorCallback.accept(e);
}
}
Aggregations