var u = { getRandomStr: function(t) { for (var e = [], n = 0; n < t; n++) { var r = Math.floor(26 * Math.random()), i = String.fromCharCode(97 + r); e.push(i.toUpperCase()) } return e.join("") }, encodeAES_ECB: function(t, e) { "string" != typeof t && (t = JSON.stringify(t)); var n = i.default.AES.encrypt(t, i.default.enc.Utf8.parse(e), { mode: i.default.mode.ECB, padding: i.default.pad.Pkcs7 }); return i.default.enc.Base64.stringify(n.ciphertext) }, decodeAES_ECB: function(t, e) { "string" != typeof t && (t = JSON.stringify(t)); var n = i.default.AES.decrypt(t, i.default.enc.Utf8.parse(e), { mode: i.default.mode.ECB, padding: i.default.pad.Pkcs7 }); return i.default.enc.Utf8.stringify(n) }, encodeRSA_module: function(t, e, n) { var r = new s.default; return r.setPublic(e, n), function(t) { var e, n, r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", i = ""; for (e = 0; e + 3 <= t.length; e += 3) n = parseInt(t.substring(e, e + 3), 16), i += r.charAt(n >> 6) + r.charAt(63 & n); for (e + 1 == t.length ? (n = parseInt(t.substring(e, e + 1), 16), i += r.charAt(n << 2)) : e + 2 == t.length && (n = parseInt(t.substring(e, e + 2), 16), i += r.charAt(n >> 2) + r.charAt((3 & n) << 4)); (3 & i.length) > 0;) i += "="; return i }(r.encrypt(t)) }, decodeRSA_module: function(t, e, n, r) { var i = new s.default; return i.setPrivate(e, n, r), i.decrypt(function(t) { var e, n = "", r = 0, i = 0; for (e = 0; e < t.length && "=" != t.charAt(e); ++e) { var o = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(t.charAt(e)); o < 0 || (0 == r ? (n += a(o >> 2), i = 3 & o, r = 1) : 1 == r ? (n += a(i << 2 | o >> 4), i = 15 & o, r = 2) : 2 == r ? (n += a(i), n += a(o >> 2), i = 3 & o, r = 3) : (n += a(i << 2 | o >> 4), n += a(15 & o), r = 0)) } return1 == r && (n += a(i << 2)), n }(t)) }, decodeRSA: function(t, e) { var n = new o.default; return n.setPrivateKey(e), n.decrypt(t) } }; e.default = u
r = c.default.getRandomStr(16) i = c.default.encodeRSA_module(r, s.default.getters.currentConfigs.modulus, s.default.getters.currentConfigs.publicExponent)
N = int( "9ee7f2b994fa16b86a1d01ad82663b24d488f2ea6ad2b60264badb6311906674048e70ebbae222744eb8b93d58258eb4dc30d11d4a9408e4ae8eb6d34a4e175a131eaa2484269041947c0d1e4c1652a0992ea952d590ef9836e0144197f30ef837d2df2ea0ba534f3f03ed88e8fe8311f7b6138b254e9b3395132db4f17ee0f3", 16) E = int("10001", 16) D = int( "710bb39aa0c835a7a61dd296bc20bc4c9c427d05954f279a964c744c8b2f3e23a5262c6117074ed98d334edcbc3ba3c538ac25e7ffa946966134380e225b61b25bd38f1d6a2a29edfe2ab59707a6ebdcc31bcb7bf41a853d75a01630098fb3b22387a8fcb1785fd4850c831fa68d7cea93cff945112f0deba069c6716096f651", 16)
# 创建RSA私钥对象 private_key = RSA.construct((N, E, D))
Public Key: -----BEGIN PUBLIC KEY----- MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCjjzkGhTTM8xh5F2BKhXKFMz3u DPAbbib3i+DLVjdj+gsCjQG76Om/blxwfkCnvdI3x/ay6T3hy8j7PoGBEvqB54o2 FPgS5Ny+0gGu+xy3vmyFRr4PhtDXgu5HwCja+WngExVkFxx900sHWpR704ivB+Yq ZPI8EfMUuy4suSnfCwIDAQAB -----END PUBLIC KEY-----
# 输入已知的私钥参数 P = int(input("Enter the prime factor P: ")) Q = int(input("Enter the prime factor Q: ")) E = int(input("Enter the public exponent (E): ")) D = int(input("Enter the private exponent (D): "))
# 计算模N N = P * Q
# 创建RSA私钥对象 private_key = RSA.construct((N, E, D, P, Q))