Qouted from GP2.1.1 API documentation:
setATRHistBytes
public static boolean setATRHistBytes(byte[] baBuffer,
short sOffset,
byte bLength)
This method sets the historical bytes of the ATR (Answer To Reset) string. The sequence of bytes will be visible on a subsequent power-up or reset.
Notes:
This method shall not be invoked from the Applet.install() method.
The OPEN locates the entry of the current applet context in the Open Platform Registry and verifies that the application has the "default selected" privilege.
The OPEN is responsible for updating the length of historical bytes in Format Character T0 of the ATR.
Parameters:
baBuffer - the source byte array containing the ATR historical bytes. Must be a global array.
sOffset - offset of the ATR historical bytes within source byte array.
bLength - the number of historical bytes.
Returns:
true if ATR bytes set, false otherwise.
Question 1: Does GP forces the applet to be default-selected for changing the ATR Hist bytes?
Question 2: Does GP changes the Cold Reset ATR only? Or the Warm Reset ATR changes too?
Question 3: How can I receive my card's Warm Reset ATR? Is there any command for that? Is it reader-specific?
Question 1: Does GP forces the applet to be default-selected for changing the ATR Hist bytes?
No, the Applet needs to have this privilege #5 (or "Card Reset privilege in GP v2.2 speak, see table 11-7) to be able to change it. It is set during INSTALL [and make Selectable]. Basically it needs to be selected by default at boot, otherwise it cannot change the ATR historical bytes. For multi-purpose cards this may be a problem, although you could say that this is a limitation of ISO 7816-4 and the protocol rather than Java Card / Global Platform.
2 fragments from the Global Platform specification v2.2:
The Default Selected privilege is redefined as the Card Reset privilege to modify the historical bytes. An Application is able to refuse explicit selection, e.g. because it does not support the current card I/O interface, and allow the (partial) selection process by OPEN to continue. To provide backward compatibility, the privilege confers implicit selectability if it has not been awarded to another Application.
The presence of the Privileges is required. If an Application is only being installed and not made selectable with the same
INSTALL
command the Card Reset privilege cannot be set.
Question 2: Does GP changes the Cold Reset ATR only? Or the Warm Reset ATR changes too?
Usually both are changed, and most platforms will at least initiate those to the same values. Note that only the historical bytes are changed, which usually indicate the type of card, but not the communication parameters (speed, timeout values etc.)
Question 3: How can I receive my card's Warm Reset ATR? Is there any command for that? Is it reader-specific?
Generally you just perform a reset without powering down. This can certainly be done using standard commands such as SCardReconnect
but I'm not sure about other tools. Generally you'd just perform a reset, and for a cold reboot you'd simply remove the card, the reader or indeed, just the power.
Generally you would not expect a difference between the cold or warm reboot, but it is certainly possible to use different ATR's for both (knowing from proprietary information about several Java Card chips). Vendors usually have a method of setting the full ATR, given enough privileges and knowledge of proprietary commands.