ECDSA for Android using SpongyCastle

2.4k Views Asked by At

I've just added SpongyCastle to Eclipse for my Android Project, however I don't seem to be able to find a single good/complete example of how to use ECDSA for encryption & decryption of plain texts. I would imagine this should be a 'hello world' for ecnryption libraries.

Can anyone help me with this? or direct me towards some other resource that can help me achieve the same goals?

Thanks.

1

There are 1 best solutions below

0
On

Here's the example from bouncycastle.org for generating a key, from there it's just standard use of the KeyPair. Also @nelenkov wrote a great article (as usual) on Elliptic curve on Android

ECGenParameterSpec ecGenSpec = new ECGenParameterSpec("prime192v1");
//using spongycastle provider
KeyPairGenerator  g = KeyPairGenerator.getInstance("ECDSA", "SC");

g.initialize(ecGenSpec, new SecureRandom());

KeyPair pair = g.generateKeyPair();