Files
status-keycard-java/lib/src/main/java/im/status/keycard/applet/ApplicationStatus.java
T
Bitgamma 07fc087cb3 [WIP] rename hardwallet to keycard (#11)
* rename hardwallet to keycard

* rename hardwallet to keycard

* rename hardwallet to keycard

* change constants

* add convenience GlobalPlatform methods

* add javadoc to all classes
2018-12-07 16:44:02 +03:00

51 lines
1.3 KiB
Java

package im.status.keycard.applet;
/**
* Parses the result of a GET STATUS command retrieving application status.
*/
public class ApplicationStatus {
private byte pinRetryCount;
private byte pukRetryCount;
private boolean hasMasterKey;
public static final byte TLV_APPLICATION_STATUS_TEMPLATE = (byte) 0xA3;
/**
* Constructor from TLV data
* @param tlvData the TLV data
* @throws IllegalArgumentException if the TLV does not follow the expected format
*/
public ApplicationStatus(byte[] tlvData) throws IllegalArgumentException {
TinyBERTLV tlv = new TinyBERTLV(tlvData);
tlv.enterConstructed(TLV_APPLICATION_STATUS_TEMPLATE);
pinRetryCount = (byte) tlv.readInt();
pukRetryCount = (byte) tlv.readInt();
hasMasterKey = tlv.readBoolean();
}
/**
* The available PIN retry count.
* @return the available PIN retry count
*/
public byte getPINRetryCount() {
return pinRetryCount;
}
/**
* The available PUK retry count.
* @return the available PUK retry count
*/
public byte getPUKRetryCount() {
return pukRetryCount;
}
/**
* Whether the card has a master key or not.
*
* @return whether the card has a master key or not.
*/
public boolean hasMasterKey() {
return hasMasterKey;
}
}