From console it's working as
curl
http://127.0.0.1:9898/addpsp -d service=pkpservice -d pushservicetype=gcm -d projectid=172993292454 -d apikey=AIzaSyDPuuxs_c4paDQcmWabiGmmaViXOrIC5d0
[AddPushServiceProvider][Info] 2015/05/02 19:21:58 From=
127.0.0.1:41535 Service=pkpservice PushServiceProvider=gcm:8b3cf1f54e6baa5ac338708d778f111b95344bcc Success!
but in android it's always through Error on connection: java.net.ConnectException: /
127.0.0.1:9898 - Connection refused in android
My source code is :
BigInteger modulus = new BigInteger(
"17388413383649711290254825310339272211319767525363227404074762677568514182143042061437868796167591657550511002079944736281939887225873458139996723826487428401781326377898963252196351565707602724215593767581359596805150972910866410145077679809190513515791700412131297152963158161216863933118912237764396054712362877219981113432778260759907285938711897115187091296093563327334234754294283390985106557355671509013541665508032935881514071942658154269549566084778139622274561728679270315969220599430415442568612476273211334694395646067337896362196452349792104972786584396268761019495750809374141828098785614861562903854521");
BigInteger exp = new BigInteger("65537");
KeySpec keyspec = new RSAPublicKeySpec(modulus, exp);
KeyFactory kf = null;
try {
kf = KeyFactory.getInstance("RSA");
} catch (NoSuchAlgorithmException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
pubKey = null;
try {
pubKey = (RSAPublicKey) kf.generatePublic(keyspec);
} catch (InvalidKeySpecException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
this.cinfo = new ConnectionInfo("127.0.0.1", 9898, "pkpservice", "pkp");
this.cinfo2 = new ConnectionInfo("127.0.0.1", 9898, "pkpservice",
"monnand", true, false, 1024, 1024);
}
@Override
public String getToken(String service, String username) {
return "token/password";
}
@Override
public RSAPublicKey getPublicKey(String addr, int port) {
return this.pubKey;
}
@Override
public String[] getSenderIds() {
String[] senderIds = new String[1];
senderIds[0] = "172993292454";
return senderIds;
}
@Override
public MessageHandler getMessageHandler(String service, String username) {
return new MessageEcho(this.context);
}
@Override
public ConnectionInfo getConnectionInfo() {
if (Math.random() > 0.5) {
Log.i(TAG, "Use the second config");
return cinfo2;
}
Log.i(TAG, "Use the first config");
return cinfo;
}
i dont know BigInteger value