Usage: rsa [options]
Valid options are:
-help Display this summary 查看资助
-inform format Input format, one of DER PEM 指定输入格式
-outform format Output format, one of DER PEM PVK 指定输出格式
-in val Input file 输入文件
-out outfile Output file 输出文件
-pubin Expect a public key in input file 盼望输入时一个公钥
-pubout Output a public key 输出公钥文件
-passout val Output file pass phrase source 给输出文件设置暗码
-passin val Input file pass phrase source 输入文件的暗码
-RSAPublicKey_in Input is an RSAPublicKey 指定输入是一个RSA公钥
-RSAPublicKey_out Output is an RSAPublicKey 指定输出是一个RSA公钥
-noout Don't print key out 不要打印输入的密钥内容
-text Print the key in text 用文本格式打印密钥内容
-modulus Print the RSA key modulus 打印RSA密钥的模数
-check Verify key consistency 检测密钥是否一致
-* Any supported cipher 其他参数
-pvk-strong Enable 'Strong' PVK encoding level (default) 启用“强”PVK编码级别(默认)
-pvk-weak Enable 'Weak' PVK encoding level 启用“弱”PVK编码级别
-pvk-none Don't enforce PVK encoding 不强制执行PVK编码
-engine val Use engine, possibly a hardware device 指定解析引擎
import binascii,gmpy2
from functools import reduce
import libnum
def CRT(mi, ai):
assert(reduce(gmpy2.gcd,mi)==1)
assert (isinstance(mi, list) and isinstance(ai, list))
M = reduce(lambda x, y: x * y, mi)
ai_ti_Mi = [a * (M // m) * gmpy2.invert(M // m, m) for (m, a) in zip(mi, ai)]