|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /usr/lib64/python2.4/site-packages/M2Crypto/PGP/ |
Upload File : |
"""M2Crypto PGP2 RSA.
Copyright (c) 1999-2003 Ng Pheng Siong. All rights reserved."""
import sys
from M2Crypto import m2, RSA
_RSA = RSA
del RSA
class RSA(_RSA.RSA):
pass
class RSA_pub(_RSA.RSA_pub):
pass
def new_pub_key((e, n)):
"""
Factory function that instantiates an RSA_pub object from a (e, n) tuple.
'e' is the RSA public exponent; it is a string in OpenSSL's binary format,
i.e., a number of bytes in big-endian.
'n' is the RSA composite of primes; it is a string in OpenSSL's binary format,
i.e., a number of bytes in big-endian.
"""
rsa = m2.rsa_new()
m2.rsa_set_e_bin(rsa, e)
m2.rsa_set_n_bin(rsa, n)
return RSA_pub(rsa, 1)