[PD1] cryptoUtils start and protocol tweaks

This commit is contained in:
Tiago Sousa 2024-04-17 19:54:14 +01:00
parent cdaae8fb7e
commit c57c093867
Signed by: tiago
SSH key fingerprint: SHA256:odOD9vln9U7qNe1R8o3UCbE3jkQCkr5/q5mgd5hwua0
4 changed files with 128 additions and 80 deletions

View file

@ -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)
}