I am trying to re-construct an ECPublicKey (generated by a smart card) in java with BouncyCastle.
I have this code, found from an example online:
KeyFactory keyFact = KeyFactory.getInstance("EC");
ECNamedCurveParameterSpec paramSpec = ECNamedCurveTable.getParameterSpec("secp256k1");
ECParameterSpec params = new ECNamedCurveSpec("secp256k1", paramSpec.getCurve(), paramSpec.getG(), paramSpec.getN(), paramSpec.getH());
ECPublicKey ecPublicKey = (ECPublicKey) keyFact.generatePublic(new ECPublicKeySpec(w, params));
(w is an ECPoint made of the x and y values I have from the smartcard)
What are n and h? Are they the cofactor and order of the cofactor of g, or something else?
Is there anymore values I need to get from the card to re-construct the key?
N is de order of G and h is the cofactor
id recommend looking at this