私は現在、ECDHとBouncyCastleを使用してAndroid用の暗号化アプリを開発しようとしています。これまでに実装したのは、以下のコードに従って、アプリケーションで公開鍵と秘密鍵を生成することです。
次のタスクは、SMSを介して公開鍵を送信することです。私は仕事を成し遂げるためにどのような方法を使うことができるかを知りたいです。現在、生成されたキーを文字列に割り当てて試してから、文字列を送信していますが、それでも正しく機能させることができません。
どんな援助も大歓迎です
ありがとう、そしてハッピーホリデー!
try
{
KeyPairGenerator g = KeyPairGenerator.getInstance("ECDH", "SC");
//Define the Elliptic Curve Field, Points A and B
EllipticCurve curve = new EllipticCurve(new ECFieldFp(Presets.CurveQ),Presets.PointA,Presets.PointB);
//Define the points on the Elliptic Curve
ECParameterSpec ecSpec = new ECParameterSpec(
curve,
ECPointUtil.decodePoint(curve, Hex.decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")), // G
new BigInteger("883423532389192164791648750360308884807550341691627752275345424702807307"), // n
1); // h
//Generate the random point on the Elliptic Curve
g.initialize(ecSpec, new SecureRandom());
//Generate Private Key for User A
KeyPair aKeyPair = g.generateKeyPair();
aKeyAgree = KeyAgreement.getInstance("ECDH", "SC");
aKeyAgree.init(aKeyPair.getPrivate());
//Save Personal Keys
Presets.myPrivateKey = aKeyPair.getPrivate().getEncoded().toString();
Presets.myPublicKey = aKeyPair.getPublic().getEncoded().toString();