support new starcrypto package

This commit is contained in:
2022-04-27 13:45:22 +08:00
parent 2db6102668
commit 996f94eef0
3 changed files with 27 additions and 12 deletions
+7 -2
View File
@@ -146,8 +146,13 @@ func (c *ClientConn) readTUMessage() {
}
func (c *ClientConn) rsaDecode(message Message) {
unknownKey := message.Value
data, err := starcrypto.RSADecrypt(unknownKey, c.handshakeRsaKey, "")
privKey, err := starcrypto.DecodePrivateKey(c.handshakeRsaKey, "")
if err != nil {
fmt.Println(err)
message.Reply([]byte("failed"))
return
}
data, err := starcrypto.RSADecrypt(privKey, message.Value)
if err != nil {
fmt.Println(err)
message.Reply([]byte("failed"))