Hi..am new to java..i have generated keys using ECC..i need to add random number and secret key i.e x=r+s.here's my code..
KeyPairGenerator kpg = KeyPairGenerator.getInstance("ECDSA", "BC");
kpg.initialize(ecSpec, new SecureRandom());
KeyPair keyPair = kpg.generateKeyPair();
PublicKey pubKey = keyPair.getPublic();
PrivateKey privKey = keyPair.getPrivate();
Random rand = new Random();
int numNoRange = rand.nextInt();
now i need to add x=numNoRange+privkey; but i couldn add it..please suggest me some ideas..Thanks..
For what purpose?
The key is supposed to be secret. Why do you need a random element?
In general you should be very wary of trying to implement cryptography yourself. It is already designed and very secure, and ideas like this don't necessarily have any value.