diff --git a/src/client/EncryptionUpdate.java b/src/client/EncryptionUpdate.java
new file mode 100644
index 0000000000000000000000000000000000000000..001c1295c64d042cba748e108675cbe14f3a4503
--- /dev/null
+++ b/src/client/EncryptionUpdate.java
@@ -0,0 +1,58 @@
+package client;
+
+import remote.IDrawingUpdate;
+import remote.IEncryptionUpdate;
+
+import javax.crypto.*;
+import javax.crypto.spec.SecretKeySpec;
+import java.io.Serializable;
+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;
+import java.security.*;
+
+public class EncryptionUpdate extends UnicastRemoteObject implements IEncryptionUpdate, Serializable {
+
+    private PrivateKey priv;
+    private PublicKey pub;
+    private SecretKey sharedSecretKey;
+
+    public PublicKey getPub() {
+        return pub;
+    }
+
+    public void setSharedKey(byte[] encryptedSharedSecretKey){
+        try {
+            Cipher cipher = Cipher.getInstance("RSA", "SunJCE");
+            cipher.init(Cipher.DECRYPT_MODE, priv);
+            sharedSecretKey = new SecretKeySpec(cipher.doFinal(encryptedSharedSecretKey), "AES");
+            System.out.println("Client holds this shared key: "+sharedSecretKey);
+        } catch (NoSuchAlgorithmException e) {
+            e.printStackTrace();
+        } catch (NoSuchProviderException e) {
+            e.printStackTrace();
+        } catch (NoSuchPaddingException | InvalidKeyException e) {
+            e.printStackTrace();
+        } catch (BadPaddingException e) {
+            e.printStackTrace();
+        } catch (IllegalBlockSizeException e) {
+            e.printStackTrace();
+        }
+
+
+    }
+
+    EncryptionUpdate() throws RemoteException {
+        try {
+            KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA", "SunJSSE");
+            keyGen.initialize(2048);
+            KeyPair pair = keyGen.generateKeyPair();
+            this.priv = pair.getPrivate();
+            this.pub = pair.getPublic();
+
+        }
+        catch (Exception e){
+            e.printStackTrace();
+        }
+
+    }
+}
diff --git a/src/remote/IEncryptionUpdate.java b/src/remote/IEncryptionUpdate.java
new file mode 100644
index 0000000000000000000000000000000000000000..3e8edf3e781713db3d351e740c5a692aab733925
--- /dev/null
+++ b/src/remote/IEncryptionUpdate.java
@@ -0,0 +1,10 @@
+package remote;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.security.PublicKey;
+
+public interface IEncryptionUpdate extends Remote {
+    public PublicKey getPub() throws RemoteException;
+    public void setSharedKey(byte[] encryptedSharedSecretKey) throws RemoteException;
+}
diff --git a/src/server/MySharedKey.java b/src/server/MySharedKey.java
new file mode 100644
index 0000000000000000000000000000000000000000..e16485e2e87a5ff48c8ea4bd2bfe05757dc7802f
--- /dev/null
+++ b/src/server/MySharedKey.java
@@ -0,0 +1,41 @@
+package server;
+
+import remote.IEncryptionUpdate;
+
+import javax.crypto.*;
+import javax.crypto.spec.SecretKeySpec;
+import java.rmi.RemoteException;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.security.PublicKey;
+import java.util.Base64;
+
+public class MySharedKey {
+    private byte[] encryptedSharedSecretKey;
+    private IEncryptionUpdate encryptionUpdate;
+    private SecretKey sharedSecretKey;
+
+
+    public MySharedKey (IEncryptionUpdate encryptionUpdate) throws RemoteException {
+        this.encryptionUpdate = encryptionUpdate;
+        this.sharedSecretKey = new SecretKeySpec(new byte[16], "AES");
+        System.out.println(sharedSecretKey);
+        this.encryptedSharedSecretKey = wrapKey(encryptionUpdate.getPub());
+        System.out.println("Shared key on server:" + encryptedSharedSecretKey);
+        encryptionUpdate.setSharedKey(encryptedSharedSecretKey);
+    }
+
+    private byte[] wrapKey(PublicKey clientPubKey){
+
+        try {
+            Cipher c = Cipher.getInstance("RSA", "SunJCE");
+            c.init(Cipher.WRAP_MODE, clientPubKey);
+            byte[] result2 = c.wrap(sharedSecretKey);
+            return result2;
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new IllegalStateException(
+                    e);
+        }
+    }
+}