I have private key (ecdsa,secp256r1).
private final static String SHA = "SHA-256";
private final static String MODE = "EC";
private final static String PROV = "SunEC";
private final static String ECC_ALGO = "secp256r1";
public static KeyPair eccKeyGen() {
KeyPairGenerator kpg;
KeyPair kp = null;
try {
kpg = KeyPairGenerator.getInstance(MODE, PROV);
ECGenParameterSpec ecsp;
ecsp = new ECGenParameterSpec(ECC_ALGO);
kpg.initialize(ecsp);
kp = kpg.genKeyPair();
return kp;
} catch (Exception e) {
System.out.println("Key generation error.");
e.printStackTrace();
}
return kp;
How I can make public key from it in java without Bouncy Castle?