java卡安全,Java卡小程序,安全数据传输和安全通道

本文探讨Java卡APDU命令和状态字在传输通道中的安全问题,提出对APDU命令数据部分加密、使用SD安全通道两种方案,并分析第一种方案的不足。还讨论确保小程序仅接收安全通道传输的APDU命令的方法,最后询问如何利用SD与小程序安全通信,给出相关解答。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

I want to write my applet in a way that its APDU commands and status words wasn't be clear in the transmission channel between my card and my reader. I mean I don't want to send APDU commands and responses to be plain text for third parties.

I think I have two option :

After selecting my applet on the card, for all the other commands, do an encryption function on the data section of APDU commands and decrypt them on the card and after that analyze them. Note that I can't encrypt whole the command using this methodology because the result may have conflict with another SELECT APDU command and the SD of card recognize it as a SELECT command wrongly. is that right?

Its Diagram :

T9HnA.jpg

Using SD Secure Channel : As far as I know secure channel means : Whole of the APDU commands and responses transmit in an encrypted form (i.e. they encrypt in the source(Security Domain/Card reader) and decrypt in the destination(Secutity Domain/Card Reader). is that right? As far as I know the SD perform the cryptography method role in this mechanism and the communication between my applet and the SD is in plain (Below diagram), right?

Its Diagram :

afIIi.jpg

Is there any other way?

It seems that the first solution is not good enough, because :

I must implement it myself! :)

We can't hide all parts of the command and response from third-parties.(We can hide data only)

Am I right?

Now, let assume that I want to be sure that my applet works only with APDU commands that transmitted using secure channel . I think I have two option again :

Put the card in SECURED state. As the user can't communicate with the card with plain text APDU commands in this state (right?) therefore he must send the commands to my applet using secure channel. right? if it is not correct, is there any way to force the SD to work with Secure Channel only?

Keep the card in any life cycle that it is (for example OP_READY), But instead, on reception of any APDU command, check the CLA section to see if it is a secure transmitted or not! (Is it possible? Is there any difference between CLA part of APDU commands that come from secure channel and the other ones? Am I right?)

Is there any other way?

And finally the main question :

How can I use SD to have a secure communication with my applet? As I thought I must use GlobalPlatform classes(Am I?), I took a look at its API-s. I found a method named getSecureChannel in a package named org.globalplatform.GPSystem. Am I in a right way? Am I must use this method?

I know that this may be too long to answer, but I'm sure that it clarify a lot of questions not only for me, but also for other future viewers.

I appreciate any body shed any light in this issue for me.

And a sample applet is more appreciable.

解决方案

I'll answer in order:

Yes, for ISO/IEC 7816-4 only the data section is encrypted. The header is just protected by the authentication tag.

No, the Global Platform secure channel also just (optionally) encrypts the data. The integrity is over header and command data though.

No, the secured state is for Global Platform only, you'll have to program this for yourself using the on card GP API. The GP API has access methods to perform authentication, request the secure channel and to retrieve the current state.

Correct, the CLA byte determines if the APDU is encrypted (not how it is encrypted though). If the first bit of the CLA is zero then your secure channel must however be compliant to ISO/IEC 7816-4.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值