Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法通过公钥对字符串进行编码?
我找到了两个包,pycrypto 和 m2crypto。但我找不到如何使用它们。
使用公钥对字符串进行编码:
#!/usr/bin/env python from M2Crypto import RSA, X509 x509 = X509.load_cert("recipient_cert.pem") rsa = x509.get_pubkey().get_rsa() print rsa.public_encrypt("your string to encrypt", RSA.pkcs1_oaep_padding)