简体   繁体   中英

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. 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? 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).

I strongly recommend understanding the difference between bit / byte values and their representation / encoding techniques before diving deeper into Java Card. Lookup a few tutorials and check the tags (binary to text) and (text to binary) on 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). Those library will just pick up the file and create the (usually encrypted) APDU's around them.

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 .

Good luck with your project

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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