Encode publicKey on Java Card

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 16:44:40

You can implement this function like this:

Card side:

  • 1 KeyPair.getPublicKey() --> publicKey;
  • 2 publicKey.getW() --> W;
  • 3 Send W to outside;

Standard java application side:

  • 1 get W data bytes;
  • 2 W data bytes --> ECPoint;
  • 3 Build PublicKey with the ECPoint generated in step 2 use the class ECPublicKeySpec;
  • 4 Use the public key in your application;

getEncoded() method returns the key in its primary encoding format, or null if the key does not support encoding. So you don't need to use it for your goal. you simply can use down-casting to ECPublicKey:

ECPublicKey pubKey = (ECPublicKey) keyPair.getPublic()

The pubKey in the above line, is equal with output of getEncoded() method in Java applications.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!