[英]Elliptic Curve DSA on JavaCard - what else do I need to initialise?
I am trying to implement ECDSA on JavaCard.我正在尝试在 JavaCard 上实现 ECDSA。 So far I have this code:
到目前为止我有这段代码:
Signature sig = Signature.getInstance(Signature.ALG_ECDSA_SHA_256, false);
KeyPair key = new KeyPair(KeyPair.ALG_EC_FP, (short)256);
key.genKeyPair();
sig.init(key.Private(), Signature.MODE_SIGN);
sig.sign(data, (short)0, dataLen, outputBuf, (short)0);
When I try to retire K using the getK()
method so that I can send the public key in an APDU I get the error code 6F 00.当我尝试使用
getK()
方法停用 K 以便我可以在 APDU 中发送公钥时,我得到了错误代码 6F 00。
According to the documentation getK()
can throw CryptoException.UNINITIALIZED_KEY
if the 'cofactor of the order of the fixed point G of the curve of the key has not been successfully initialized'根据文档
getK()
可以抛出CryptoException.UNINITIALIZED_KEY
如果“密钥曲线的不动点 G 阶的余因子尚未成功初始化”
Is there something else I need to initialise when setting up the keys/signature?设置密钥/签名时我还需要初始化其他东西吗?
You need to initialise the domain parameters: A,B, G, R, K and the field.您需要初始化域参数:A、B、G、R、K 和字段。 For a list of NIST recommended curves you can look here: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-4.pdf
有关 NIST 推荐曲线的列表,您可以在此处查看: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-4.pdf
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.