Package KM104
Interface T104OpenAPI
- All Superinterfaces:
javacard.framework.Shareable
public interface T104OpenAPI
extends javacard.framework.Shareable
-
Field Summary
-
Method Summary
Modifier and Type Method Description shortappLogin(byte[] param, short paramOffset, short paramLen)Login of current applet to the T104 applet for an authenticated session to perform T104 OpenAPI calls.booleancreateAOCContainer(byte secretType, byte[] secret, short secretOffset, short secretLen, short maxRetry)Registers an applet to allow access to the T104OpenAPI interface.booleandestroyAOCContainer()Deregisters and deletes an existing applet from the T104 Environment only.voiddisplayToScreen(byte[] input, short off, short len, byte[] ticket, short ticketOff)Displays arbitrary positive integer digits up to 6 digits to screen.shortgetAOCInfo(byte[] output, short outOffset)Extracts the publicly available AOC container information.shortgetCardInfo(byte[] output, short outOffset)Returns information about the card.shortgetCardTimeout()Returns the card timeout time.shortgetGlobalWalletAmount(byte type, byte[] output, short off, byte[] ticket, short ticketOff)Retrieves wallet amount for a particular slot (Balance, Payment or Loaded Funds).booleanmanageAOCContainer(byte fieldType, byte[] input, short offset, short len, short maxRetry, byte[] ticket, short ticketOff)Manage but not delete the registered applet and AOC container profile.shortsetCardTimeout(short timeout, byte[] ticket, short ticketOff)Set the timeout on the card.shortsetGlobalWalletAmount(byte displayWalletRecordSlot, byte[] balance, short balanceOff, short balanceLen, byte[] payment, short paymentOff, short paymentLen, byte[] loading, short loadingOff, short loadingLen, byte[] ticket, short ticketOff)Sets one or more wallet slots (Balance, Payment and/or Loaded Funds) and then displays the particular slot value on the screen after successfully updating the wallet slots.
-
Field Details
-
MAX_OBJ_PER_CRED
static final short MAX_OBJ_PER_CRED- See Also:
- Constant Field Values
-
MAX_AOC
static final short MAX_AOC- See Also:
- Constant Field Values
-
MAX_LIST_OBJ_CNT
static final short MAX_LIST_OBJ_CNT- See Also:
- Constant Field Values
-
MAX_KMAC_LEN
static final short MAX_KMAC_LEN- See Also:
- Constant Field Values
-
MAX_GEN_MAT_LEN
static final short MAX_GEN_MAT_LEN- See Also:
- Constant Field Values
-
MAX_PIN_LEN
static final short MAX_PIN_LEN- See Also:
- Constant Field Values
-
MAX_WALLET_DATA_LEN
static final short MAX_WALLET_DATA_LEN- See Also:
- Constant Field Values
-
MAX_DISPLAY_DATA_LEN
static final short MAX_DISPLAY_DATA_LEN- See Also:
- Constant Field Values
-
AUTH_TICKET_LEN
static final short AUTH_TICKET_LEN- See Also:
- Constant Field Values
-
OBJ_TYPE_GENERIC
static final byte OBJ_TYPE_GENERIC- See Also:
- Constant Field Values
-
OBJ_TYPE_CRED
static final byte OBJ_TYPE_CRED- See Also:
- Constant Field Values
-
OBJ_TYPE_KEY
static final byte OBJ_TYPE_KEY- See Also:
- Constant Field Values
-
OBJ_FIELD_VER
static final byte OBJ_FIELD_VER- See Also:
- Constant Field Values
-
OBJ_FIELD_TYPE
static final byte OBJ_FIELD_TYPE- See Also:
- Constant Field Values
-
OBJ_FIELD_SUBTYPE_CLASS
static final byte OBJ_FIELD_SUBTYPE_CLASS- See Also:
- Constant Field Values
-
OBJ_FIELD_SUBTYPE_TYPE
static final byte OBJ_FIELD_SUBTYPE_TYPE- See Also:
- Constant Field Values
-
OBJ_FIELD_SN
static final byte OBJ_FIELD_SN- See Also:
- Constant Field Values
-
OBJ_FIELD_CREATE
static final byte OBJ_FIELD_CREATE- See Also:
- Constant Field Values
-
OBJ_FIELD_EXPIRE
static final byte OBJ_FIELD_EXPIRE- See Also:
- Constant Field Values
-
OBJ_FIELD_ID
static final byte OBJ_FIELD_ID- See Also:
- Constant Field Values
-
OBJ_FIELD_EXPORT
static final byte OBJ_FIELD_EXPORT- See Also:
- Constant Field Values
-
OBJ_FIELD_ACL
static final byte OBJ_FIELD_ACL- See Also:
- Constant Field Values
-
OBJ_FIELD_MATERIAL_SECRET
static final byte OBJ_FIELD_MATERIAL_SECRET- See Also:
- Constant Field Values
-
OBJ_FIELD_MATERIAL_PUBLIC
static final byte OBJ_FIELD_MATERIAL_PUBLIC- See Also:
- Constant Field Values
-
OBJ_FIELD_ATTEST
static final byte OBJ_FIELD_ATTEST- See Also:
- Constant Field Values
-
OBJ_FIELD_HANDLE
static final byte OBJ_FIELD_HANDLE- See Also:
- Constant Field Values
-
OBJ_EXPIRED
static final byte OBJ_EXPIRED- See Also:
- Constant Field Values
-
OBJ_NOT_EXPIRED
static final byte OBJ_NOT_EXPIRED- See Also:
- Constant Field Values
-
OBJ_EXPIRY_UNDETERMINED
static final byte OBJ_EXPIRY_UNDETERMINED- See Also:
- Constant Field Values
-
OBJ_PERM_EXPORT_ALLOW_FLAG
static final byte OBJ_PERM_EXPORT_ALLOW_FLAG- See Also:
- Constant Field Values
-
OBJ_PERM_EXPORT_DENY_FLAG
static final byte OBJ_PERM_EXPORT_DENY_FLAG- See Also:
- Constant Field Values
-
LOOKUP_AVAILABLE_AOC
static final byte LOOKUP_AVAILABLE_AOC- See Also:
- Constant Field Values
-
LOOKUP_HAS_FREE_AOC
static final byte LOOKUP_HAS_FREE_AOC- See Also:
- Constant Field Values
-
LOOKUP_AVAILABLE_CRED_BY_NAME
static final byte LOOKUP_AVAILABLE_CRED_BY_NAME- See Also:
- Constant Field Values
-
LOOKUP_AVAILABLE_CRED_BY_ID
static final byte LOOKUP_AVAILABLE_CRED_BY_ID- See Also:
- Constant Field Values
-
LOOKUP_HAS_FREE_CRED
static final byte LOOKUP_HAS_FREE_CRED- See Also:
- Constant Field Values
-
LOOKUP_HAS_FREE_OBJ
static final byte LOOKUP_HAS_FREE_OBJ- See Also:
- Constant Field Values
-
LOOKUP_AVAILABLE_OBJ_BY_HANDLE
static final byte LOOKUP_AVAILABLE_OBJ_BY_HANDLE- See Also:
- Constant Field Values
-
LOOKUP_LIST_OBJ
static final byte LOOKUP_LIST_OBJ- See Also:
- Constant Field Values
-
LOOKUP_COUNT_OBJ_AOC
static final byte LOOKUP_COUNT_OBJ_AOC- See Also:
- Constant Field Values
-
LOOKUP_COUNT_OBJ_GLOBCRED
static final byte LOOKUP_COUNT_OBJ_GLOBCRED- See Also:
- Constant Field Values
-
LOOKUP_LIST_CRED
static final byte LOOKUP_LIST_CRED- See Also:
- Constant Field Values
-
KEY_CLASS_SYMMETRIC
static final byte KEY_CLASS_SYMMETRIC- See Also:
- Constant Field Values
-
KEY_CLASS_ASYMMETRIC
static final byte KEY_CLASS_ASYMMETRIC- See Also:
- Constant Field Values
-
KEY_TYPE_AES
static final byte KEY_TYPE_AES- See Also:
- Constant Field Values
-
KEY_TYPE_DES
static final byte KEY_TYPE_DES- See Also:
- Constant Field Values
-
KEY_TYPE_CHACHA
static final byte KEY_TYPE_CHACHA- See Also:
- Constant Field Values
-
KEY_TYPE_RSA
static final byte KEY_TYPE_RSA- See Also:
- Constant Field Values
-
KEY_TYPE_DH
static final byte KEY_TYPE_DH- See Also:
- Constant Field Values
-
KEY_TYPE_ECC_P256R1
static final byte KEY_TYPE_ECC_P256R1- See Also:
- Constant Field Values
-
KEY_TYPE_ECC_P384R1
static final byte KEY_TYPE_ECC_P384R1- See Also:
- Constant Field Values
-
KEY_TYPE_ECC_P521R1
static final byte KEY_TYPE_ECC_P521R1- See Also:
- Constant Field Values
-
KEY_TYPE_ECC_P256K1
static final byte KEY_TYPE_ECC_P256K1- See Also:
- Constant Field Values
-
KEY_TYPE_KMAC
static final byte KEY_TYPE_KMAC- See Also:
- Constant Field Values
-
CRED_AUTHTYPE_PIN
static final byte CRED_AUTHTYPE_PIN- See Also:
- Constant Field Values
-
CRED_AUTHTYPE_PWD
static final byte CRED_AUTHTYPE_PWD- See Also:
- Constant Field Values
-
CRED_AUTHTYPE_FP
static final byte CRED_AUTHTYPE_FP- See Also:
- Constant Field Values
-
CRED_AUTHTYPE_ASYMMKEY
static final byte CRED_AUTHTYPE_ASYMMKEY- See Also:
- Constant Field Values
-
CRED_AOC_ADMIN_RESET_FLAG
static final byte CRED_AOC_ADMIN_RESET_FLAG- See Also:
- Constant Field Values
-
CRED_PERM_ADMIN_FLAG
static final byte CRED_PERM_ADMIN_FLAG- See Also:
- Constant Field Values
-
CRED_FIELD_NAME
static final byte CRED_FIELD_NAME- See Also:
- Constant Field Values
-
CRED_FIELD_IDPUBKEY
static final byte CRED_FIELD_IDPUBKEY- See Also:
- Constant Field Values
-
CRED_FIELD_SECRET
static final byte CRED_FIELD_SECRET- See Also:
- Constant Field Values
-
CRED_FIELD_EXPORT
static final byte CRED_FIELD_EXPORT- See Also:
- Constant Field Values
-
CRED_FIELD_ACTIVE
static final byte CRED_FIELD_ACTIVE- See Also:
- Constant Field Values
-
CRED_FIELD_MANAGEMENT
static final byte CRED_FIELD_MANAGEMENT- See Also:
- Constant Field Values
-
CRED_FIELD_CREDID
static final byte CRED_FIELD_CREDID- See Also:
- Constant Field Values
-
CRED_FIELD_ADMIN
static final byte CRED_FIELD_ADMIN- See Also:
- Constant Field Values
-
CRED_FIELD_SECRET_TYPE
static final byte CRED_FIELD_SECRET_TYPE- See Also:
- Constant Field Values
-
CRED_FIELD_MAX_RETRIES
static final byte CRED_FIELD_MAX_RETRIES- See Also:
- Constant Field Values
-
CRED_FIELD_RETAIN_ORPHAN
static final byte CRED_FIELD_RETAIN_ORPHAN- See Also:
- Constant Field Values
-
CRED_FIELD_CREATE
static final byte CRED_FIELD_CREATE- See Also:
- Constant Field Values
-
CRED_FIELD_EXPIRE
static final byte CRED_FIELD_EXPIRE- See Also:
- Constant Field Values
-
CRED_FIELD_ATTEST
static final byte CRED_FIELD_ATTEST- See Also:
- Constant Field Values
-
CRED_FIELD_OID
static final byte CRED_FIELD_OID- See Also:
- Constant Field Values
-
CRED_FIELD_OBJCTR
static final byte CRED_FIELD_OBJCTR- See Also:
- Constant Field Values
-
CRED_STAT_INACTIVE
static final byte CRED_STAT_INACTIVE- See Also:
- Constant Field Values
-
CRED_STAT_INIT
static final byte CRED_STAT_INIT- See Also:
- Constant Field Values
-
CRED_STAT_ACTIVE
static final byte CRED_STAT_ACTIVE- See Also:
- Constant Field Values
-
AOCS_NONE
static final byte AOCS_NONE- See Also:
- Constant Field Values
-
AOCS_LOGIN_BEGIN
static final byte AOCS_LOGIN_BEGIN- See Also:
- Constant Field Values
-
AOCS_READY
static final byte AOCS_READY- See Also:
- Constant Field Values
-
ACT_AOC_MGMT
static final byte ACT_AOC_MGMT- See Also:
- Constant Field Values
-
ACT_USR_MGMT
static final byte ACT_USR_MGMT- See Also:
- Constant Field Values
-
ACT_USR_FIND
static final byte ACT_USR_FIND- See Also:
- Constant Field Values
-
ACT_USR_SIZE
static final byte ACT_USR_SIZE- See Also:
- Constant Field Values
-
ACT_USR_CREATE
static final byte ACT_USR_CREATE- See Also:
- Constant Field Values
-
ACT_USR_UPDATE
static final byte ACT_USR_UPDATE- See Also:
- Constant Field Values
-
ACT_USR_DELETE
static final byte ACT_USR_DELETE- See Also:
- Constant Field Values
-
ACT_STE_AUTH
static final byte ACT_STE_AUTH- See Also:
- Constant Field Values
-
ACT_STE_CRYPT
static final byte ACT_STE_CRYPT- See Also:
- Constant Field Values
-
ACT_STE_PROC
static final byte ACT_STE_PROC- See Also:
- Constant Field Values
-
ACT_STATUS_BEGIN
static final byte ACT_STATUS_BEGIN- See Also:
- Constant Field Values
-
ACT_STATUS_UPDATE
static final byte ACT_STATUS_UPDATE- See Also:
- Constant Field Values
-
ACT_STATUS_FINAL
static final byte ACT_STATUS_FINAL- See Also:
- Constant Field Values
-
ACT_STATUS_CANCEL
static final byte ACT_STATUS_CANCEL- See Also:
- Constant Field Values
-
ACT_STATUS_SUCCESS
static final byte ACT_STATUS_SUCCESS- See Also:
- Constant Field Values
-
ACT_STATUS_FAIL
static final byte ACT_STATUS_FAIL- See Also:
- Constant Field Values
-
CRYPT_LOAD
static final byte CRYPT_LOAD- See Also:
- Constant Field Values
-
CRYPT_UPDATE
static final byte CRYPT_UPDATE- See Also:
- Constant Field Values
-
CRYPT_FINAL
static final byte CRYPT_FINAL- See Also:
- Constant Field Values
-
CRYPT_RESET
static final byte CRYPT_RESET- See Also:
- Constant Field Values
-
CRYPT_KEYGEN
static final byte CRYPT_KEYGEN- See Also:
- Constant Field Values
-
AUTH_INTERNAL
static final byte AUTH_INTERNAL- See Also:
- Constant Field Values
-
AUTH_MODE_USR_AUTH
static final byte AUTH_MODE_USR_AUTH- See Also:
- Constant Field Values
-
AUTH_MODE_CONTAINER_AUTH
static final byte AUTH_MODE_CONTAINER_AUTH- See Also:
- Constant Field Values
-
AUTH_MODE_STATE_AUTH
static final byte AUTH_MODE_STATE_AUTH- See Also:
- Constant Field Values
-
EXEC_COMPARE
static final byte EXEC_COMPARE- See Also:
- Constant Field Values
-
EXEC_CRYPT_INTEGRITY_CREATION
static final byte EXEC_CRYPT_INTEGRITY_CREATION- See Also:
- Constant Field Values
-
EXEC_CRYPT_INTEGRITY_VERIFICATION
static final byte EXEC_CRYPT_INTEGRITY_VERIFICATION- See Also:
- Constant Field Values
-
EXEC_CRYPT_CONTENT_PROTECT
static final byte EXEC_CRYPT_CONTENT_PROTECT- See Also:
- Constant Field Values
-
EXEC_CRYPT_CONTENT_EXTRACT
static final byte EXEC_CRYPT_CONTENT_EXTRACT- See Also:
- Constant Field Values
-
ATTEST_LEVEL_ROOT_AUTH
static final byte ATTEST_LEVEL_ROOT_AUTH- See Also:
- Constant Field Values
-
ATTEST_LEVEL_INTERMEDIATE_AUTH
static final byte ATTEST_LEVEL_INTERMEDIATE_AUTH- See Also:
- Constant Field Values
-
ATTEST_LEVEL_KM_AUTH
static final byte ATTEST_LEVEL_KM_AUTH- See Also:
- Constant Field Values
-
ATTEST_LEVEL_GLOBUSER_AUTH
static final byte ATTEST_LEVEL_GLOBUSER_AUTH- See Also:
- Constant Field Values
-
ATTEST_LEVEL_AOC_AUTH
static final byte ATTEST_LEVEL_AOC_AUTH- See Also:
- Constant Field Values
-
ATTEST_LEVEL_OBJECT
static final byte ATTEST_LEVEL_OBJECT- See Also:
- Constant Field Values
-
ACL_ALLOW_READ
static final byte ACL_ALLOW_READ- See Also:
- Constant Field Values
-
ACL_ALLOW_EDIT
static final byte ACL_ALLOW_EDIT- See Also:
- Constant Field Values
-
ACL_ALLOW_EXEC
static final byte ACL_ALLOW_EXEC- See Also:
- Constant Field Values
-
NULL
static final byte NULL- See Also:
- Constant Field Values
-
WALLET_BALANCE_RECORD_SLOT
static final byte WALLET_BALANCE_RECORD_SLOT- See Also:
- Constant Field Values
-
WALLET_PAYMENT_RECORD_SLOT
static final byte WALLET_PAYMENT_RECORD_SLOT- See Also:
- Constant Field Values
-
WALLET_LOADING_RECORD_SLOT
static final byte WALLET_LOADING_RECORD_SLOT- See Also:
- Constant Field Values
-
SW_CARD_NOT_READY
static final short SW_CARD_NOT_READY- See Also:
- Constant Field Values
-
SW_INVALID_USER_ROLE
static final short SW_INVALID_USER_ROLE- See Also:
- Constant Field Values
-
SW_INVALID_USER_PIN
static final short SW_INVALID_USER_PIN- See Also:
- Constant Field Values
-
SW_INVALID_USER_ACCESS_RIGHTS
static final short SW_INVALID_USER_ACCESS_RIGHTS- See Also:
- Constant Field Values
-
SW_NO_MORE_RETRIES
static final short SW_NO_MORE_RETRIES- See Also:
- Constant Field Values
-
SW_UI_ERR
static final short SW_UI_ERR- See Also:
- Constant Field Values
-
-
Method Details
-
appLogin
short appLogin(byte[] param, short paramOffset, short paramLen)Login of current applet to the T104 applet for an authenticated session to perform T104 OpenAPI calls.
Call the appLogin twice. The first appLogin call will retrieve a session challenge from the T104OpenAPI and placed into theparamparameter by the T104 Applet. The second call will require a HMAC-SHA256 signature over the challenge as the message and the AOC PIN or Password as the HMAC key.
Execution sequence:- Call appLogin with a global array to contain the challenge (10 bytes).
- If returned length from the initial appLogin returns 10 bytes length, proceed further else an error has occured.
- Perform HMAC-SHA256 signature with the AOC PIN/Password as the key and challenge as the message. Copy the signature into a global array.
- Call appLogin with the
param,paramOffset,paramLenrespectively loaded with the global array details containing the signature. - If returned is '1' it indicates Success, if '0' it indicates failure on the signature based authentication and '-1' as an error indicating an invalid AOC container (not registered), invalid or null param related inputs or an internally invalid authentication state.
- Cache the challenge as the session ticket.
- Parameters:
param- the first call of appLogin will be a global array (i.e. APDU buffer) to receive the 10 byte challenge and the second call of appLogin will be a global array set with the HMAC-SHA256 signed challenge.paramOffset- offset into the global array to contain the challenge if it is an initial call or an offset into the global array that contains the signature of the challenge.paramLen- initial call of appLogin will omit this. Second call of appLogin will indicate the length of the signature in the global array to read.- Returns:
- If returned is '1' it indicates Success, if '0' it indicates failure on the signature based authentication and '-1' as an error indicating an invalid AOC container (not registered), invalid or null param related inputs or an internally invalid authentication state.
-
createAOCContainer
boolean createAOCContainer(byte secretType, byte[] secret, short secretOffset, short secretLen, short maxRetry)Registers an applet to allow access to the T104OpenAPI interface. An AOC container profile would be created in the T104 applet to represent the applet. During the registering of the applet and creation of the AOC container, a shared secret in the form of a PIN or a binary Password can be selected up to a length of 64 bytes. The PIN or binary Password would be used for HMAC-SHA256 signature based challenge-response session login via theappLogincall.
A maximum of 10 unique applets maybe registered and AOC container profile created only.
A maximum retry of 99 retries and a minimum of 1 retry is allowed.
Accepted secret types:CRED_AUTHTYPE_PIN: 0 to 9 in ASCIIfied binaryCRED_AUTHTYPE_PIN: 8-bit octet
The authentication secret stored in the AOC container profile on the T104 applet side is encrypted with a non-exportable randomly generated 256-bit storage master key withCipher.ALG_AES_CBC_PKCS5with an all zero IV.
If an applet already exists with the exact same AID (RID + PIX) , it will fail to register.
It is always advisable to retrieve a shareable interface and call agetAOCInfocall which is accessible without registration of applet before attempting to register applet and create an AOC container profile.- Parameters:
secretType- secret type used for authenticationsecret- global array containing secret used for authenticationsecretOffset- offset into global array containing authentication secretsecretLen- length of authentication secretmaxRetry- maximum retry for session login before locking of applet- Returns:
- result of AOC container creation
-
destroyAOCContainer
boolean destroyAOCContainer()Deregisters and deletes an existing applet from the T104 Environment only. GP environment remains intact. No appLogin is required.
If an applet does not exist in the T104 Environment, it will simply return a false value.
Note: When an applet gets locked out due to too many invalid authentication attempts, it is advisable to destroy the container and recreate a new container.- Returns:
- result of applet deregistration and AOC container destruction.
-
manageAOCContainer
boolean manageAOCContainer(byte fieldType, byte[] input, short offset, short len, short maxRetry, byte[] ticket, short ticketOff)Manage but not delete the registered applet and AOC container profile. Currently only allows the changing of PIN or Password.
If a PIN type was registered, a new PIN is expected. If a Password type was registered, a new Password is expected. Mixing of a registered PIN authenticator type for a new Password type secret authenticator is not allowed.
Rules for PIN / Password authenticator is the same as createAOCContainer method.
If an applet does not exist in the T104 Environment, it will simply return a false value.
The applet must have logged in via appLogin to access this method.- Parameters:
fieldType- only theCRED_FIELD_SECRETfield type is allowed.input- global array containing the new authenticator secretoffset- offset within global array containing the new authenticator secret to readlen- length of new authenticator secretmaxRetry- new maximum retry lengthticket- global array containing the current session ticket.ticketOff- offset in the global array to read the current session ticket.- Returns:
- result of management activities on the AOC container.
-
getAOCInfo
short getAOCInfo(byte[] output, short outOffset)Extracts the publicly available AOC container information. Does not require AOC container registration and login to access.
AOC Container Information Format (sequence)
- Is Applet Registered - 1 byte - 0x00 (No), 0x01 (Yes)
- Secret Type - 1 byte -
CRED_AUTHTYPE_PINorCRED_AUTHTYPE_PWD - Auth Retry Left - 1 byte - Number of retries left
- Auth Retry Max - 1 byte - Number of maximum retries allowed
- AID Length - 1 byte - Length of AID
- AID - AIDLength byte - AID
- Parameters:
output- global array to store information of the AOC container information.outOffset- offset within global array to store information of the AOC container information.- Returns:
- amount of bytes of returned AOC container information.
-
getCardInfo
short getCardInfo(byte[] output, short outOffset)Returns information about the card.
TLV is being used after the initial two byte version sequence. All TLV length are restricte to one byte length only.
A list of supported TLV tags:
public static final byte TLV_TAG_HW_INFO = (byte) 0x01;
public static final byte TLV_TAG_HW_CAP = (byte) 0x02;
public static final byte TLV_TAG_HW_USR = (byte) 0x03;
public static final byte TLV_TAG_HW_MEM_PERSIST = (byte) 0x04;
public static final byte TLV_TAG_HW_MEM_TEMP_RST = (byte) 0x41;
public static final byte TLV_TAG_HW_MEM_TEMP_DST = (byte) 0x42;
public static final byte TLV_TAG_HW_ID = (byte) 0x05;
public static final byte TLV_TAG_HW_ID_PUB = (byte) 0x51;
public static final byte TLV_TAG_HW_ID_ATTEST = (byte) 0x52;
public static final byte TLV_TAG_HW_SCP = (byte) 0x06;
public static final byte TLV_TAG_HW_BK = (byte) 0x07;
public static final byte TLV_TAG_HW_INTERACT = (byte) 0x08;
public static final byte TLV_TAG_HW_CRED_FORMAT = (byte) 0x09;
public static final byte TLV_TAG_AOC_CRED_ID = (byte) 0x0A;
public static final byte TLV_TAG_AOC_AUXDATA = (byte) 0x0B;
public static final byte TLV_OBJ_FIELD_ID = (byte) 0x08;
public static final byte TLV_OBJ_FIELD_HANDLE = (byte) 0x0E;
HW Info Format (sequence):
- Version - 2 byte - 0x0100
- HW Secure Input Capability (TLV) - 5 byte - TLV_TAG_HW_CAP; 0x00 - No capability (i.e. secure keypad)
- User (TLV) - 4 byte - TLV_TAG_HW_USR; 0x01 - Card Admin User
- Secure Channel (TLV) - 4 byte - TLV_TAG_HW_SCP; 0x0A03 - Proprietary ThothTrust A03 SCP protocol
- HW Partition Backup Capability (TLV) - 2 byte - TLV_TAG_HW_BK; 0 length - No known backup
- HW Interactive Capability (TLV) - 3 byte - TLV_TAG_HW_INTERACT; 0x01 - Screen available
- Credential Secret Format (TLV) - 3 byte - TLV_TAG_HW_CRED_FORMAT; CRED_AUTHTYPE_PIN (0x80)
- Persistent Memory (TLV) - 6 byte - TLV_TAG_HW_MEM_PERSIST; 4 byte integer of remaining persistent memory size
- Temporary Resettable Memory (TLV) - 6 byte - TLV_TAG_HW_MEM_TEMP_RST; 4 byte integer of remaining resettable RAM memory size
- Temporary Deselectable Memory (TLV) - 6 byte - TLV_TAG_HW_MEM_TEMP_DST; 4 byte integer of remaining deselectable RAM memory size
- Hardware ID (TLV) - 2 byte ++ - TLV_TAG_HW_ID; Contains nested TLV tag(s)
- Hardware Public Key (TLV) - 66 byte - TLV_TAG_HW_ID_PUB; raw 64 bytes X || Y representation of non-exportable ECC-SECP256K1 public key for secure channel and other hardware related PKI security for T104 environment
- Parameters:
output- global array to store information of the Hardware information.outOffset- offset within global array to store Hardware information.- Returns:
- length of card information.
- Since:
- version 1.0-Stable
-
displayToScreen
void displayToScreen(byte[] input, short off, short len, byte[] ticket, short ticketOff)Displays arbitrary positive integer digits up to 6 digits to screen. Useful for OTP code.- Parameters:
input- global array containing ASCIIfied hexadecimal bytes of 6 digit positive integer.off- offset within global array containing input for displaylen- lengh of input for displayticket- global array containing the current session ticket.ticketOff- offset in the global array to read the current session ticket.
-
setGlobalWalletAmount
short setGlobalWalletAmount(byte displayWalletRecordSlot, byte[] balance, short balanceOff, short balanceLen, byte[] payment, short paymentOff, short paymentLen, byte[] loading, short loadingOff, short loadingLen, byte[] ticket, short ticketOff)Sets one or more wallet slots (Balance, Payment and/or Loaded Funds) and then displays the particular slot value on the screen after successfully updating the wallet slots.
The E-Wallet module has three global value storage slots to store values for 'Balance', 'Payment' and 'Loaded Funds' related amount. These amount will need to be accessed and displayed on demand whenever the user powers on the cards.
Applets have to follow these steps to utilize the global stored value:
- Manually retrieve the value(s) of the targeted slot(s)
- Convert them to a format that their applets could process (i.e. to short, int or BigNumber types)
- Perform the required logical operations in their own applets
- Convert the results of the logical operations for each of the global value(s) they wish to update
- Write the updated value(s) to the slot(s)
The following requirements for slot value must be met for rendering:
- Either a 8 digit positive integer or a two-decimal placed positive decimal with the the numbers before the decimal place up to 6 digit place
- The maximum positive two-decimal placed decimal value shall be 999999.99 and the smallest value shall be 0.00
- Encoding of the input shall be in hexadecimal value
- Example of value 999999.99 shall be encoded in hexadecimal as input as 3939393939392E3939
The displayWalletRecordSlot variable shall use the following:
T104OpenAPI.WALLET_BALANCE_RECORD_SLOT- Displays Balance slot upon successful write operationT104OpenAPI.WALLET_PAYMENT_RECORD_SLOT- Displays Payment slot upon successful write operationT104OpenAPI.WALLET_LOADING_RECORD_SLOT- Displays Loaded Funds slot upon successful write operation.
Upon successful updating of the slots, the values are stored persistently and powering up the card will allow on-demand access to these values displayed on screen via toggling the E-Wallet scrolling mechanical button.- Parameters:
displayWalletRecordSlot- the record type to display upon successful update of record(s)balance- global array carrying containing the balance value for updatebalanceOff- offset in the global array carrying containing the balance value for update to readbalanceLen- length of balance value to readpayment- global array carrying containing the payment value for updatepaymentOff- offset in the global array carrying containing the payment value for update to readpaymentLen- length of payment value to readloading- global array carrying containing the loaded funds value for updateloadingOff- offset in the global array carrying containing the loaded funds value for update to readloadingLen- length of laoded funds value to readticket- global array containing the current session ticket.ticketOff- offset in the global array to read the current session ticket.- Returns:
- If returned is '1' it indicates Success, '-1' as a general error, '-2' as a invalid displayWalletRecordSlot, '-3' and beyond as incorrect data values or length of the value slot(s) for updating. format of value,
-
getGlobalWalletAmount
short getGlobalWalletAmount(byte type, byte[] output, short off, byte[] ticket, short ticketOff)Retrieves wallet amount for a particular slot (Balance, Payment or Loaded Funds). Output will be ASCIIfied hexadecimal.
An example for123456.78will be returned as0x3132333435362E3738- Parameters:
type- wallet slot type eitherWALLET_BALANCE_RECORD_SLOT,WALLET_PAYMENT_RECORD_SLOTorWALLET_LOADING_RECORD_SLOT.output- global array to store information of the wallet slot selected.off- offset within global array to store wallet slot information.ticket- global array containing the current session ticket.ticketOff- offset in the global array to read the current session ticket.- Returns:
- returns the length of byte array data of selected slot for reading.
If '-1', invalid calling applet, if '-2', invalid
typeparameter.
-
setCardTimeout
short setCardTimeout(short timeout, byte[] ticket, short ticketOff)Set the timeout on the card.
Use the following accepted timeout in seconds and their effects:
65535- Disable timeout by. Card stays powered on forever if the power button is not pressed again to shutdown the card manually.0to9- Card timeout automatically readjusts to 10 seconds.10to65534- Accepted.- Others - Unaccepted.
- Parameters:
timeout- timeout timing in seconds.ticket- global array containing the current session ticket.ticketOff- offset in the global array to read the current session ticket.- Returns:
- If returned is '1' it indicates Success, if '0' it indicates failure and '-1' as an error.
- Since:
- version 1.0-Stable
-
getCardTimeout
short getCardTimeout()Returns the card timeout time. Publicly accessible without requiring registration of applet to T104 Environment for access.
Return Results
0- No timeout of card. Remains on when switched on.1to65534- Timeout in seconds.-1- Internal error.
- Returns:
- card timeout in seconds.
- Since:
- version 1.0-Stable
-