0

I am able to generate Public key and Private key using spongy castle in Android by using the following code

KeyPairGenerator keyGen = KeyPairGenerator.getInstance("ECDH", "SC");
ECGenParameterSpec ecSpecCurve163k1 = new ECGenParameterSpec("sect163r2"); // Curve: B-163
keyGen.initialize(ecSpecCurve163k1);
aKeyPair = keyGen.generateKeyPair();
String pubStr = Crypto.base64Encode(aKeyPair.getPublic().getEncoded());
String privStr = Crypto.base64Encode(aKeyPair.getPrivate().getEncoded());

I get Affine coordinates by using the following code

PublicKey otherKey // key generated by the code above
ECPublicKey ecPubKey = (ECPublicKey) otherKey;
Log.d("public key Wx", ecPubKey.getW().getAffineX().toString(16));
Log.d("public key Wy", ecPubKey.getW().getAffineY().toString(16));

I am trying to get the projective coordinates for the above coordinates by using spongy castle. Is there any way to get it?

Cœur
  • 37,241
  • 25
  • 195
  • 267
student
  • 53
  • 1
  • 7
  • I have found somethind from [link](http://bouncy-castle.1462172.n4.nabble.com/Elliptic-curve-query-td4310337.html) which is available for bouncy castle. But again class EC Proj Point is not available under spongy castle. Any idea? – student Sep 27 '13 at 08:44
  • Going from affine coordinates to the usual projective coordinates is trivial: (x,y) --> (x,y,1). – President James K. Polk Sep 29 '13 at 13:56
  • @GregS well mathematicaly is not such a big problem. Although I have no idea how to implement this by having the above informations.. Do you have any idea or any implemented source code? – student Sep 30 '13 at 06:01
  • Can I do in the following Way? X_projCord = ecPubKey.getW().getAffineX(); – student Sep 30 '13 at 08:15

0 Answers0