[PD1] Certs done
This commit is contained in:
parent
23584e2901
commit
2c4f1fd2fc
6 changed files with 104 additions and 29 deletions
|
@ -2,6 +2,7 @@ package client
|
|||
|
||||
import (
|
||||
"PD1/internal/protocol"
|
||||
"PD1/internal/utils/cryptoUtils"
|
||||
"PD1/internal/utils/networking"
|
||||
"flag"
|
||||
"fmt"
|
||||
|
@ -24,16 +25,19 @@ func Run() {
|
|||
}
|
||||
uid := flag.Arg(1)
|
||||
subject := flag.Arg(2)
|
||||
// Read message content from stdin
|
||||
messageContent := readMessageContent()
|
||||
cl := networking.NewClient[protocol.Packet]()
|
||||
|
||||
clientCert := cryptoUtils.LoadKeyStore("userdata.p12")
|
||||
|
||||
cl := networking.NewClient[protocol.Packet](clientCert)
|
||||
defer cl.Connection.Conn.Close()
|
||||
// TODO: getuserinfo client cert
|
||||
// TODO: ask server for the recieving client's cert
|
||||
|
||||
|
||||
certRequestPacket := protocol.NewRequestUserCertPacket(uid)
|
||||
cl.Connection.Send(certRequestPacket)
|
||||
certPacket := cl.Connection.Receive()
|
||||
// TODO: cipherContent := cryptoUtils.encryptMessageContent()
|
||||
|
||||
// TODO: Encrypt message
|
||||
submitMessage(cl,uid,cipherContent)
|
||||
|
||||
case "askqueue":
|
||||
|
@ -52,7 +56,7 @@ func Run() {
|
|||
showHelp()
|
||||
|
||||
default:
|
||||
fmt.Println("Invalid command. Use 'help' for instructions.")
|
||||
commandError()
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue