Class APDUUtil
java.lang.Object
javacardx.apdu.util.APDUUtil
The
APDUUtil class contains utility methods to parse CLA byte from
a command APDU. All methods in APDUUtil, class are static methods.
- Since:
- 3.0.5
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic bytegetCLAChannel(byte CLAbyte) Returns the logical channel number encoded in theCLAbyteparameter which represents a CLA byte from a command APDU encoded according to APDU.static booleanisCommandChainingCLA(byte CLAbyte) Based on encoding of theCLAByteparameter which represents a CLA byte from a command APDU, returns whether anAPDUcommand is the first or part of a command chain.static booleanisISOInterindustryCLA(byte CLAbyte) Returns whether theCLAByteparameter which represents a CLA bye from a command APDU, corresponds to an interindustry command as defined in ISO 7816-4:2013 specification.static booleanisSecureMessagingCLA(byte CLAbyte) Returnstrueif encoding of theCLAbyteparameter, which represents a CLA byte from a command APDU, indicates secure messaging.static booleanisValidCLA(byte CLAbyte) Returns whether the currentCLAByteparameter represents a valid CLA byte.
-
Method Details
-
getCLAChannel
public static byte getCLAChannel(byte CLAbyte) Returns the logical channel number encoded in theCLAbyteparameter which represents a CLA byte from a command APDU encoded according to APDU. LC_ENCODING_TYPE_4_TYPE _16. A number in the range 0-19 based on the CLA byte encoding is returned if the CLA contains logical channel encoding. If the CLA byte does not contain logical channel information, 0 is returned.Note:
- This method returns 0 if the CLA bits (b8,b7,b6) is %b001 which is a CLA encoding reserved for future use(RFU), or if CLA is 0xFF which is an invalid value as defined in the ISO 7816-4:2013 specification.
See Runtime Environment Specification, Java Card Platform, Classic Edition, section 4.3 for encoding details.
- Parameters:
CLAbyte- is CLA byte from a command APDU- Returns:
- logical channel number, if present, within the CLA byte, 0 otherwise
- Since:
- 3.0.5
- See Also:
-
isSecureMessagingCLA
public static boolean isSecureMessagingCLA(byte CLAbyte) Returnstrueif encoding of theCLAbyteparameter, which represents a CLA byte from a command APDU, indicates secure messaging. The secure messaging information is in bits (b4,b3) for commands with origin channel numbers 0-3, and in bit b6 for origin channel numbers 4-19.Note:
- This method returns
falseif the CLA bits (b8,b7,b6) is %b001 which is a CLA encoding reserved for future use(RFU), or if CLA is 0xFF which is an invalid value as defined in the ISO 7816-4:2013 specification.
See Runtime Environment Specification, Java Card Platform, Classic Edition, section 4.3 for encoding details.
- Parameters:
CLAbyte- is CLA byte from a command APDU- Returns:
trueif the secure messaging bit(s) is(are) nonzero,falseotherwise- Since:
- 3.0.5
- See Also:
- This method returns
-
isCommandChainingCLA
public static boolean isCommandChainingCLA(byte CLAbyte) Based on encoding of theCLAByteparameter which represents a CLA byte from a command APDU, returns whether anAPDUcommand is the first or part of a command chain. Bit b5 of the CLA byte if set, indicates that theAPDUis the first or part of a chain of commands.Note:
- This method returns
falseif the CLA bits (b8,b7,b6) is %b001 which is a CLA encoding reserved for future use(RFU), or if CLA is 0xFF which is an invalid value as defined in the ISO 7816-4:2013 specification.
See Runtime Environment Specification, Java Card Platform, Classic Edition, section 4.3 for encoding details.
- Parameters:
CLAbyte- is CLA byte from a command APDU- Returns:
trueif the CLA byte encoding indicates if an APDU is not the last APDU of a command chain,falseotherwise.- Since:
- 3.0.5
- See Also:
- This method returns
-
isISOInterindustryCLA
public static boolean isISOInterindustryCLA(byte CLAbyte) Returns whether theCLAByteparameter which represents a CLA bye from a command APDU, corresponds to an interindustry command as defined in ISO 7816-4:2013 specification. Bit b8 of the CLA byte if0, indicates that theAPDUis an interindustry command.- Parameters:
CLAbyte- is CLA byte from a command APDU- Returns:
trueif this APDU CLA byte corresponds to an ISO interindustry command,falseotherwise.- Since:
- 3.0.5
- See Also:
-
isValidCLA
public static boolean isValidCLA(byte CLAbyte) Returns whether the currentCLAByteparameter represents a valid CLA byte. The CLA byte is invalid if the CLA bits (b8,b7,b6) is %b001, which is a CLA encoding reserved for future use(RFU), or if CLA is 0xFF which is an invalid value as defined in the ISO 7816-4:2013 specification.See Runtime Environment Specification, Java Card Platform, Classic Edition, section 4.3 for encoding details.
- Parameters:
CLAbyte- is CLA byte from a command APDU- Returns:
trueif CLA byte is valid,falseotherwise.- Since:
- 3.0.5
- See Also:
-