summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/satellitedaemon/App.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/openslx/satellitedaemon/App.java')
-rw-r--r--src/main/java/org/openslx/satellitedaemon/App.java56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/main/java/org/openslx/satellitedaemon/App.java b/src/main/java/org/openslx/satellitedaemon/App.java
new file mode 100644
index 0000000..9eb1cd6
--- /dev/null
+++ b/src/main/java/org/openslx/satellitedaemon/App.java
@@ -0,0 +1,56 @@
+package org.openslx.satellitedaemon;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.security.InvalidKeyException;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.SignatureException;
+import java.security.UnrecoverableKeyException;
+import java.security.cert.CertificateException;
+import java.util.UUID;
+
+import org.apache.thrift.TException;
+import org.apache.thrift.protocol.TBinaryProtocol;
+import org.apache.thrift.protocol.TProtocol;
+import org.apache.thrift.transport.TSocket;
+import org.apache.thrift.transport.TTransport;
+import org.openslx.imagemaster.thrift.iface.FtpCredentials;
+import org.openslx.imagemaster.thrift.iface.ImageData;
+import org.openslx.imagemaster.thrift.iface.ImageServer;
+import org.openslx.imagemaster.thrift.iface.ServerSessionData;
+import org.openslx.satellitedaemon.util.RndStringEncrypt;
+
+/**
+ * HS Server.
+ *
+ */
+public class App {
+ public static void main(String[] args) throws UnrecoverableKeyException, NoSuchAlgorithmException, CertificateException, FileNotFoundException, KeyStoreException, IOException, InvalidKeyException, SignatureException {
+ try {
+ TTransport transport;
+
+ transport = new TSocket("132.230.4.23", 9090); //Nils IP
+ transport.open();
+
+ TProtocol protocol = new TBinaryProtocol(transport);
+ ImageServer.Client client = new ImageServer.Client(
+ protocol);
+
+ String rnd = client.startServerAuthentication("uni-freiburg.de");
+ System.out.println(rnd);
+
+ RndStringEncrypt rse = new RndStringEncrypt("serverid", "password", "/home/michael/satellite-daemon/config/serverid.jks");
+ byte[] byteArray = rse.encryptRndString(rnd);
+ ServerSessionData sSD = client.serverAuthenticate("uni-freiburg.de", ByteBuffer.wrap(byteArray));
+ System.out.println(sSD.sessionId);
+ ImageData imDat = new ImageData(UUID.randomUUID().toString(), 113, "TestImage", 100, 105, "me", "anyThing", true, false, "theBest", "theVeryBest", 1024 );
+ FtpCredentials ftpc = client.submitImage(sSD.sessionId, imDat);
+
+ transport.close();
+ } catch (TException x) {
+ x.printStackTrace();
+ }
+ }
+}