在Java卡上编码publicKey [英] Encode publicKey on Java Card

查看:159
本文介绍了在Java卡上编码publicKey的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Java卡上编码ECDSA PublicKey,以便在我可以在另一个平台上进行解码(例如,在响应APDU中发送编码的密钥并在标准Java应用程序中处理它)? #code> keyPair.getPublic()。getEncoded()在Java上将使用PKCS#8编码的技巧,但据我所知 getEncoded()在Java卡平台上不可用。

解决方案

您可以这样实现这个功能: p>

卡片边:




  • 1 KeyPair.getPublicKey ) - > publicKey;

  • 2 publicKey.getW() - > W;

  • 3发送W到外面;



标准java应用程序端:




  • 1获取W数据字节;

  • 2 W数据字节 - > ECPoint;

  • 3使用步骤2中生成的ECPoint构建PublicKey类ECPublicKeySpec;

  • 4使用您的应用程序中的公钥;


How to encode an ECDSA PublicKey on Java Card so that after I can decode it on another platform (e.g. sending the encoded key in a response APDU and processing it in a standard Java application)? keyPair.getPublic().getEncoded() on Java would do the trick with PKCS#8 encoding, but as far as I know getEncoded() is not available on the Java Card platform.

解决方案

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;

这篇关于在Java卡上编码publicKey的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆