python X.509非对称加密

发布于 2024-08-13 12:26:20 字数 840 浏览 7 评论 0原文

我试图了解证书和非对称加密的工作原理。我正在寻找一个 python 库,我可以在其中导入公共或私有 ca 签名证书并自动以字符串格式加密或解密消息,我查看了嵌入在 python 源代码中的加密库,但我不知道如何使用十六进制模数以及证书这部分的指数:

RSA Public Key: (1024 bit)  

               Modulus (1024 bit):

               00:b4:31:98:0a:c4:bc:62:c1:88:aa:dc:b0:c8:bb:  
               33:35:19:d5:0c:64:b9:3d:41:b2:96:fc:f3:31:e1:  
               66:36:d0:8e:56:12:44:ba:75:eb:e8:1c:9c:5b:66:  
               70:33:52:14:c9:ec:4f:91:51:70:39:de:53:85:17:  
               16:94:6e:ee:f4:d5:6f:d5:ca:b3:47:5e:1b:0c:7b:  
               c5:cc:2b:6b:c1:90:c3:16:31:0d:bf:7a:c7:47:77:  
               8f:a0:21:c7:4c:d0:16:65:00:c1:0f:d7:b8:80:e3:  
               d2:75:6b:c1:ea:9e:5c:5c:ea:7d:c1:a1:10:bc:b8:  
               e8:35:1c:9e:27:52:7e:41:8f  

           Exponent: 65537 (0x10001)  

有人可以帮助我吗?

谢谢

I'm trying to understand how certificate and asymmetric encryption works. I'm looking for a python library where i can import public or private ca signed certificates and automatically encrypt or decrypt message in string format, i viewed the crypto library embedded in python source, but i don't know how to use the hex modulus and exponent in this part of the certificate:

RSA Public Key: (1024 bit)  

               Modulus (1024 bit):

               00:b4:31:98:0a:c4:bc:62:c1:88:aa:dc:b0:c8:bb:  
               33:35:19:d5:0c:64:b9:3d:41:b2:96:fc:f3:31:e1:  
               66:36:d0:8e:56:12:44:ba:75:eb:e8:1c:9c:5b:66:  
               70:33:52:14:c9:ec:4f:91:51:70:39:de:53:85:17:  
               16:94:6e:ee:f4:d5:6f:d5:ca:b3:47:5e:1b:0c:7b:  
               c5:cc:2b:6b:c1:90:c3:16:31:0d:bf:7a:c7:47:77:  
               8f:a0:21:c7:4c:d0:16:65:00:c1:0f:d7:b8:80:e3:  
               d2:75:6b:c1:ea:9e:5c:5c:ea:7d:c1:a1:10:bc:b8:  
               e8:35:1c:9e:27:52:7e:41:8f  

           Exponent: 65537 (0x10001)  

is there anyone can help me?

thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

遮云壑 2024-08-20 12:26:20

MeTooCrypto

M2Crypto 是 OpenSSL 最完整的 Python 包装器,具有 RSA、DSA、DH、HMAC、消息摘要、对称密码(包括 AES);用于实现客户端和服务器的 SSL 功能;对 Python 的 httplib、urllib 和 xmlrpclib 的 HTTPS 扩展;用于 Web 会话管理的不可伪造的 HMAC'ing AuthCookie; FTP/TLS 客户端和服务器; S/MIME; ZServerSSL:Zope 的 HTTPS 服务器和 ZSmime:Zope 的 S/MIME 信使。 M2Crypto 还可用于为 Twisted 提供 SSL。

有关加载和操作 PKI 密钥的示例,请参阅测试源 test_rsa.py。测试源目录包含 .pem 格式的密钥,这些密钥由代码使用。

MeTooCrypto:

M2Crypto is the most complete Python wrapper for OpenSSL featuring RSA, DSA, DH, HMACs, message digests, symmetric ciphers (including AES); SSL functionality to implement clients and servers; HTTPS extensions to Python's httplib, urllib, and xmlrpclib; unforgeable HMAC'ing AuthCookies for web session management; FTP/TLS client and server; S/MIME; ZServerSSL: A HTTPS server for Zope and ZSmime: An S/MIME messenger for Zope. M2Crypto can also be used to provide SSL for Twisted.

For an example of loading and manipulating PKI keys, see the test source, test_rsa.py. The test source directory contains keys in .pem format, and those are used by the code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文