为什么我不能接收APDU缓冲区内容

为什么我不能接收APDU缓冲区内容

本文介绍了为什么我不能接收APDU缓冲区内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了以下程序,以在收到每个APDU命令时返回所有APDU缓冲区的内容:

I wrote the following program to return all the APDU buffer contents on reception of each APDU command:

package testPack;

import javacard.framework.APDU;
import javacard.framework.Applet;
import javacard.framework.ISOException;

public class BufferReturner extends Applet {

    private BufferReturner() {
    }

    public static void install(byte bArray[], short bOffset, byte bLength) throws ISOException {
        new BufferReturner().register();
    }

    public void process(APDU arg0) throws ISOException {
        if(selectingApplet()){
            return;
        }
        arg0.setOutgoingAndSend((short)0, (short)255);

    }

}

当我发送通过使用 T = 0 协议的联系人界面命令,我收到以下结果:

When I send commands though the contact interface using T=0 protocol, I receive the following result:


Connect successful.
Send: 00 A4 04 00 06 01 02 03 04 05 00 00
Recv: 90 00
Time used: 8.000 ms
Send: 00 00 00 00 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 00
Send Apdu error: A device attached to the system is not functioning.
Send: 00 00 00 00 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 00
Recv: 6C FF
Time used: 5.000 ms
Send: 00 00 00 00 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 FF
Recv: 6C FF
Time used: 5.000 ms
Send: 00 00 00 00 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 FF
Recv: 6C FF
Time used: 5.000 ms
Send: 00 00 00 00 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 FF
Recv: 6C FF
Time used: 6.000 ms
Send: 00 C0 00 00 FF
Send Apdu error: A device attached to the system is not functioning.
Send: 00 C0 00 00 FF
Send Apdu error: A device attached to the system is not functioning.

如您所见,我无法收到APDU缓冲区的内容。怎么了?

As you see I can't receive the APDU buffer contents. What's wrong?

推荐答案

就像您的卡没有问题,这是一种预期的行为。

Just like with Transmission error for T=0 JavaCards there is nothing wrong with your card and this is kind of "expected" behavior.

对于 setOutgoing()方法( setOutgoingAndSend()只是包装 setOutgoing()),Java Card API规范明确指出:

For the setOutgoing() method (setOutgoingAndSend() is just a convenience method wrapping setOutgoing()), the Java Card API specification clearly states:

因此,您看到的正是 错误行为在API规范中指出。

Hence, what you see is exactly that "erroneous behavior" indicated in the API specification.

这篇关于为什么我不能接收APDU缓冲区内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 01:48