I'm trying to interoperate with a web service by reverse-engineering it. Currently, when sending a POST request, it encrypts the form data one-by-one with a 'RSA' function. But it's rather weird as everywhere else i've tried to use these values have given me errors. It's using this library: https://code.google.com/p/pajhome/source/browse/trunk/crypt/md5/rsa/RSA.js?r=133 Like this:
var crypto = new RSAKeyPair(
"9d7aa162117a8a9610ed2ddea713d7b",
"",
"c9869917572adbb60a2c30ddec2551f")
I know just a little bit of RSA, but if i'm right, this should be the public key with (e,m). But when trying to work it in Java I get the error saying that the RSA public key must be at least 512 bits in size. Where is my mistake happening here?
BigInteger e = new BigInteger("3855b21eba4eb9a8a88117878e1fda49", 16);
BigInteger m = new BigInteger("ac5d160611804794d3e0240f2042b919", 16);
RSAPublicKeySpec spec = new RSAPublicKeySpec(e, m);
KeyFactory keyFact = KeyFactory.getInstance("RSA");
PublicKey publicKey = keyFact.generatePublic(spec);
On my setup, (e,m) are being (13082845549543033994073971762152947067, 229110545576645850236522690668306544921) in decimal (?!?!)
229110545576645850236522690668306544921 = 13118050575083334077 * 17465289088900344973
so this looks like a plausible modulus, albeit very weak.13082845549543033994073971762152947067 = 37 * 1128586338367 * 313303828194079496938273
It's quite unusual to use a largee
, typically we use small primes with low hamming weight like3
or65537
. $\endgroup$ – CodesInChaos Sep 16 '14 at 9:37