1 Star 0 Fork 3

lidazhanghao/认证密钥交换协议实验

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.py 1.34 KB
一键复制 编辑 原始数据 按行查看 历史
from info import *
from getkeys import *
# messages
# (ClientHello||ServerHello||
# Hash(ServerCertificate)||
# Hash(ClientCertificate)||
# CertificateVerify||ClientKeyExchange);
messages = []
if __name__ == '__main__':
info = Info()
client_hello = info.build_client_hello()
server_hello = info.build_server_hello()
with open('RSA_public_key_server.pem', 'r') as f:
public_key_bin = f.read().encode()
server_certificate = info.build_server_certificate(public_key_bin)
client_certificate = info.build_client_certificate(public_key_bin)
key_client = RSA.import_key(open('RSA_private_key_client.pem').read())
certificate_verify = info.build_certificate_verify(key_client, client_hello, server_hello, server_certificate)
key_server = RSA.import_key(open('RSA_public_key_server.pem').read())
client_key_exchange = info.build_client_key_exchange(key_server)
messages.append(client_hello)
messages.append(server_hello)
messages.append(server_certificate)
messages.append(client_certificate)
messages.append(certificate_verify)
messages.append(client_key_exchange)
server_finished = info.build_server_finished(messages, client_key_exchange[3:])
client_finished=info.build_client_finished(messages, client_key_exchange[3:])
error_message=info.build_error_message(0x01.to_bytes(1,'big'))
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/lidazhanghao/key_exchange_lab.git
git@gitee.com:lidazhanghao/key_exchange_lab.git
lidazhanghao
key_exchange_lab
认证密钥交换协议实验
master

搜索帮助