[PD1] cryptoUtils start and protocol tweaks
This commit is contained in:
parent
cdaae8fb7e
commit
c57c093867
4 changed files with 128 additions and 80 deletions
|
@ -28,13 +28,16 @@ func Run() {
|
|||
messageContent := readMessageContent()
|
||||
cl := networking.NewClient[protocol.Packet]()
|
||||
defer cl.Connection.Conn.Close()
|
||||
|
||||
// TODO: cipherSubject := CHAMAR CRYPTO
|
||||
// TODO: cipherBody := CHAMAR CRYPTO
|
||||
submitMessage(cl,uid,cipherSubject,cipherBody)
|
||||
// TODO: getuserinfo client cert
|
||||
// TODO: ask server for the recieving client's cert
|
||||
certRequestPacket := protocol.NewRequestPubKey()
|
||||
cl.Connection.Send(certRequestPacket)
|
||||
certPacket := cl.Connection.Receive()
|
||||
// TODO: cipherContent := cryptoUtils.encryptMessageContent()
|
||||
submitMessage(cl,uid,cipherContent)
|
||||
|
||||
case "askqueue":
|
||||
cl = networking.NewClient[protocol.Packet]()
|
||||
cl := networking.NewClient[protocol.Packet]()
|
||||
defer cl.Connection.Conn.Close()
|
||||
|
||||
case "getmsg":
|
||||
|
@ -42,7 +45,7 @@ func Run() {
|
|||
panic("Insufficient arguments for 'getmsg' command. Usage: getmsg <NUM>")
|
||||
}
|
||||
num := flag.Arg(1)
|
||||
cl = networking.NewClient[protocol.Packet]()
|
||||
cl := networking.NewClient[protocol.Packet]()
|
||||
defer cl.Connection.Conn.Close()
|
||||
|
||||
case "help":
|
||||
|
@ -54,7 +57,7 @@ func Run() {
|
|||
|
||||
}
|
||||
|
||||
func submitMessage(cl networking.Client[protocol.Packet],uid string,subject []byte,body []byte) {
|
||||
pack := protocol.NewSubmitMessage(uid, subject, body)
|
||||
func submitMessage(cl networking.Client[protocol.Packet],uid string, content []byte) {
|
||||
pack := protocol.NewSubmitMessage(uid,content)
|
||||
cl.Connection.Send(pack)
|
||||
}
|
||||
|
|
|
@ -10,6 +10,15 @@ func readMessageContent() string {
|
|||
fmt.Println("Enter message content (limited to 1000 bytes):")
|
||||
scanner := bufio.NewScanner(os.Stdin)
|
||||
scanner.Scan()
|
||||
// FIX: make sure this doesnt die
|
||||
return scanner.Text()
|
||||
}
|
||||
|
||||
func AskUserPassword() string {
|
||||
fmt.Println("Enter message content (limited to 1000 bytes):")
|
||||
scanner := bufio.NewScanner(os.Stdin)
|
||||
scanner.Scan()
|
||||
// FIX: make sure this doesnt die
|
||||
return scanner.Text()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue