Skip to content

Commit 5c1bdbc

Browse files
committed
Changed core package to crypto.
Created chat package containing prototype classes for networked chat functionality.
1 parent f4c4518 commit 5c1bdbc

File tree

8 files changed

+82
-6
lines changed

8 files changed

+82
-6
lines changed

src/chat/Bow.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package chat;
2+
3+
import java.net.Socket;
4+
import java.security.KeyPair;
5+
6+
public class Bow {
7+
8+
private static Socket socket = null;
9+
private static ChatState chatState = ChatState.NOT_CONNECTED;
10+
private static String userName;
11+
private static KeyPair keys;
12+
13+
public static Socket getSocket() {
14+
return socket;
15+
}
16+
public static void setSocket(Socket socket) {
17+
Bow.socket = socket;
18+
}
19+
public static ChatState getChatState() {
20+
return chatState;
21+
}
22+
public static void setChatState(ChatState chatState) {
23+
Bow.chatState = chatState;
24+
}
25+
26+
}

src/chat/BraveSirRobin.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package chat;
2+
3+
4+
public class BraveSirRobin {
5+
6+
private Patsy patsy;
7+
8+
public BraveSirRobin(Patsy patsy) {
9+
this.patsy = patsy;
10+
}
11+
12+
public void chat(){
13+
//Get username
14+
//Get chat message
15+
//Check if connected
16+
//if not
17+
//Get hostname
18+
//Connect()
19+
//Encrypt
20+
//Send message (Bow.Shoot(Msg))
21+
//Loop back to: "Get chat message"
22+
}
23+
24+
private void connect(String hostName) {
25+
//Put connection stuff here.
26+
}
27+
}

src/chat/ChatState.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package chat;
2+
3+
public enum ChatState {
4+
NOT_CONNECTED, CONNECTED, EXCHANGING;
5+
}

src/chat/Patsy.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package chat;
2+
3+
public class Patsy {
4+
5+
public Patsy() {
6+
// TODO Auto-generated constructor stub
7+
}
8+
9+
public void receiveArrows(){
10+
//Grab and decrypt/print incoming messages.
11+
}
12+
13+
public void listen(){
14+
//Listen and accept new connection.
15+
}
16+
17+
//Needs a stopListening (shutup) method.
18+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package core;
1+
package crypto;
22

33
import java.math.BigInteger;
44
import java.util.Random;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package core;
1+
package crypto;
22

33
import java.math.BigInteger;
44

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package core;
1+
package crypto;
22

33
import util.Pair;
44

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package core;
1+
package crypto;
22

33
import java.math.BigInteger;
44

@@ -10,10 +10,10 @@
1010

1111
public class RSATest {
1212

13-
public static void main(String[] args) {
13+
public static void test() {
1414
RSAKeyPair keys = Cryptography.generateRSAKeys();
1515

16-
String plainText = "Hello, world!";
16+
String plainText = "Hello, world! Hello, world! Hello, world! ";
1717
System.out.println("Message: " + plainText);
1818

1919
BigInteger cipherText = Cryptography.encrypt(plainText, keys.getPublicKey());

0 commit comments

Comments
 (0)