python - 我如何告诉服务器来自加密模块的公钥?
问题描述
我正在尝试使用密码学模块在 python 中创建一个简单的信使。我已经对客户端和服务器进行了编码,但现在我仍然坚持,我告诉服务器我的公钥,以便服务器可以加密组密钥或客户端可以用他的私钥解密的某种密钥。我尝试使用常规发送字符串的方式发送密钥,但我只是发送内存地址。我还尝试将密钥保存到文件并发送文件,但这也不起作用。我该如何解决这个问题?
解决方案
您可以通过二进制文件发送密钥,客户端应将此二进制文件转换为 utf8 或您想要使用的任何形式,以下是向客户端发送加密数据的场景:
- server asks the client for the public key
- client sends public key with a binary file to the server
- server unpacks the binary file and transform it into another form
- server use public key extracted to encrypt data
- server sends encrypted data to the client
- client decrypt the encrypted data
你可以在另一边做同样的事情
推荐阅读
- javascript - 如何从JSON动态地在图表js中添加多个数据
- javascript - 在 JavaScript Discord Bot 中,为什么 message.react() “不是函数”
- vue.js - VueJS - 如何在 axios 中设置根证书
- reactjs - AntTable React - 无法通过 rowClassName 设置行边框
- ios - 无法从 Swiftui 中的 Picker 获取选定的值
- python-3.x - 具有多重继承和元类定义的 SyntaxError
- android - 文本字段更改的变量值未在平面按钮中更新
- c# - 当 AllowUserToAddRows 为真时 DataGridView 生成错误
- google-app-engine - 为 GCP App Engine 服务添加标签
- django - 如何在 a-Tag Django 中编写 url