从证书中提取公钥并对数据进行加密 [英] extracting public key from certificate and encrypting data

查看:694
本文介绍了从证书中提取公钥并对数据进行加密的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一项家庭作业! 我使用get_peer_certificate()获取服务器的证书 并调用dump_certificate将证书转储到变量中.格式为PEM,对我来说正确.

This is for a homework assignment! I get the server's certificate using get_peer_certificate() and the calling dump_certificate to dump the certificate in a variable. The format is PEM and looks right to me.

-----BEGIN CERTIFICATE-----
GIBBERISH................
......................
........................

-----END CERTIFICATE-----

如何从此文件("server.pubkey")中提取服务器的公钥,并使用RSA算法和任何python库对plaintext进行加密.在撰写本文时,我正在使用pyOpenSSL

How do I extract the server's public key from this file ('server.pubkey') and encrypt plaintext using RSA algorithm and any python library. At the time of writing this, I am using pyOpenSSL

推荐答案

我建议使用更广泛的 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆