私は現在、ECDHとBouncyCastleを使用してAndroid用の暗号化アプリケーションを開発しようとしています。これまで私が実装してきたのは、以下のコードに従ってアプリケーション上の公開鍵と秘密鍵の生成です。SMSで公開鍵を送信
次のタスクは、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();
特に動作しないのは何ですか?エラーが出ていますか? http://stackoverflow.com/a/4967508/984393を見ましたか? – Craigy