Getting this error:
java.security.InvalidAlgorithmParameterException: Unsupported curve: secp256k1 (1.3.132.0.10)
is there any kind of method that i can use secp256k1 in eclipse? i cannot found any help. how i can use secp256k1 to generate a public and private key pair of the elliptic curve?
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.spec.ECGenParameterSpec;
import java.security.spec.*;
public class ECCKeyGeneration {
public static void main(String[] args) {
try {
KeyPairGenerator kpg;
kpg = KeyPairGenerator.getInstance("EC");
ECGenParameterSpec ecsp;
ecsp = new ECGenParameterSpec("secp256k1");
kpg.initialize(ecsp);
KeyPair kp = kpg.genKeyPair();
PrivateKey privKey = kp.getPrivate();
PublicKey pubKey = kp.getPublic();
System.out.println(privKey.toString());
System.out.println(pubKey.toString());
} catch (Exception ex) {
System.out.println(ex);
}
}
}