简体   繁体   English

如何将Javacard cap文件转换为其对应的字节stream?

[英]How to convert the Javacard cap file to its corresponding byte stream?

I'm currently developing Javacard and generate the cap file using Ant script(the file name be like demo.cap), and now I want to construct the GP(GlobalPlatform) command to run the LOAD process on a samrt card.我目前正在开发Javacard并使用Ant脚本(文件名类似于demo.cap)生成cap文件,现在我想构建GP(GlobalPlatform)命令以在samrt卡上运行LOAD过程。 But it's encapsulated into cap format.但它被封装成大写格式。 Is there any way I can convert the cap file to its corresponding btye stream so I can truncate it and construct the data field of GP LOAD command, just like the figure link shown below?有什么办法可以将 cap 文件转换为其相应的 btye stream 以便我可以截断它并构造 GP LOAD 命令的数据字段,就像下面显示的图链接一样? Load File Structure加载文件结构

There is no such thing as a "hex format".没有“十六进制格式”之类的东西。 What you see is the human representation of bytes using hexadecimals.您看到的是人类使用十六进制表示的字节 So if you see E2 then this is a byte with value E2 , or 1110 0010 in binary, or 242 in decimals (assuming that it represents a positive number).因此,如果您看到E2那么这是一个值为E2的字节,二进制的1110 0010十进制的 242(假设它表示一个正数)。

I strongly recommend understanding the difference between bit / byte values and their representation / encoding techniques before diving deeper into Java Card.我强烈建议在深入了解 Java 卡之前了解位/字节值及其表示/编码技术之间的区别。 Lookup a few tutorials and check the tags (binary to text) and (text to binary) on Stack Overflow.查找一些教程并检查 Stack Overflow 上的标签(二进制到文本)和(文本到二进制)。

All the conversion to/from those particular command and response APDU's will be performed by a GP library or application, such as GP Shell (no affiliation).所有与这些特定命令和响应 APDU 的转换都将由 GP 库或应用程序执行,例如GP Shell (无从属关系)。 Those library will just pick up the file and create the (usually encrypted) APDU's around them.这些库只会获取文件并在它们周围创建(通常是加密的)APDU。

When sending they may show the transmitted bytes as hexadecimals on your screen - if that kind of logging is enabled.发送时,它们可能会在您的屏幕上将传输的字节显示为十六进制 - 如果启用了这种日志记录。

As @Maarten kindly says -- have a look at GlobalPlatformPro, where LOAD commands are built and its related project CAPFile , where data stream for load is constructed .正如@Maarten所说——看看 GlobalPlatformPro,其中构建了 LOAD 命令及其相关项目CAPFile ,其中构建了用于加载的数据 stream

Good luck with your project祝你的项目好运

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM