My server side(C# or .Net) people giving me a RSA Key pair in xml format, but the problem is I am not able to use given keys in my Java/ Android code and it always throwing InValidKeySpec exception.
Somehow I managed RSAPublic key conversion into Java understandable RSAPublic key format like this way -
String Modoutput = "pgFkNu7tN3K8VCxxvKMFwqaRJ6I158/aihg1J1p13P5HvVz8Pn2oC7hfdhujlQxHPsV/b8Rc3Snq5KGmC4VBnw==";
String Expoutput = "AQAB";
byte[] exponentBytes = Base64.decode(Expoutput);
byte[] modulusBytes = Base64.decode(Modoutput);
BigInteger e = new BigInteger(1, exponentBytes);
BigInteger m = new BigInteger(1, modulusBytes);
RSAPublicKeySpec keySpec = new RSAPublicKeySpec(m, e);
PublicKey mServerPublicKey = rsaKeyFactory.generatePublic(keySpec);
But not able to convert given RSAPrivate (C#) key into Java/ Android understandable. I tried this link, and this
I am looking into this but not getting any success, need help from the experts.
Happy coding :-)
,