我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用Crypto.PublicKey.RSA.RSAImplementation()。
def setUp(self): RSATest.setUp(self) self.rsa = RSA.RSAImplementation(use_fast_math=True)
def setUp(self): RSATest.setUp(self) self.rsa = RSA.RSAImplementation(use_fast_math=False)
def setUp(self): self.rsa = RSA.RSAImplementation(use_fast_math=0)
def setUp(self): self.rsa = RSA.RSAImplementation(use_fast_math=1)
def rsa_encrypt(text, n, e): impl = RSAImplementation() n = int(n, 16) if isinstance(n, str) else n e = int(e, 16) if isinstance(e, str) else e public_key = impl.construct((n, e)) random_number = 2 # ??? result = public_key.encrypt(encrypt_string(public_key, text), random_number)[0] return dec2hex(result)