Interface MemoryAccess
public interface MemoryAccess
This interface provides methods to read and write the external memory space.
Note that it is up to the implementation to ensure that no instance of this
interface can ever be created or used to access memory that is directly
accessed and managed by the Java Card RE for code, heap and other data
structures.
An instance of this interface suitable for the available external memory
subsystem can be obtained via the Memory class.
- Since:
- 2.2.2
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionshortreadData(byte[] dest, short dest_off, byte[] auth_key, short auth_key_off, short auth_key_blen, short other_sector, short other_block, short other_len) This method is used to read data from non-directly addressable memory after providing the correct key(password) to authenticate.booleanwriteData(byte[] src, short src_off, short src_blen, byte[] auth_key, short auth_key_off, short auth_key_blen, short other_sector, short other_block) This method is used to write data into non-directly addressable memory after providing the correct key(password) to authenticate.
-
Method Details
-
writeData
boolean writeData(byte[] src, short src_off, short src_blen, byte[] auth_key, short auth_key_off, short auth_key_blen, short other_sector, short other_block) throws ExternalException This method is used to write data into non-directly addressable memory after providing the correct key(password) to authenticate.If the authentication fails or writes are disallowed at the specified memory subsystem location(s), this method returns
false.- Parameters:
src- the source data byte arraysrc_off- the byte offset into thesrcarray where data beginssrc_blen- the byte length of the data to be writtenauth_key- the byte array containing the key(password)auth_key_off- the byte offset into theauth_keyarray where the key data beginsauth_key_blen- the length in bytes of the key in theauth_keyarrayother_sector- the external memory subsystem sector numberother_block- the external memory subsystem block number- Returns:
trueif the write was successful,falseotherwise- Throws:
ExternalException- with the following reason codes:ExternalException.INVALID_PARAMif any of the input parameters are invalid.ExternalException.INTERNAL_ERRORif an unrecoverable external memory access error occurred.
-
readData
short readData(byte[] dest, short dest_off, byte[] auth_key, short auth_key_off, short auth_key_blen, short other_sector, short other_block, short other_len) throws ExternalException This method is used to read data from non-directly addressable memory after providing the correct key(password) to authenticate.If the authentication fails or reads are disallowed at the specified memory subsystem location(s), this method returns
0.- Parameters:
dest- the destination data byte arraydest_off- the byte offset into thedest arraywhere data should beginauth_key- the byte array containing the key(password)auth_key_off- the byte offset into theauth_keyarray where the key data beginsauth_key_blen- the length in bytes of the key in theauth_keyarrayother_sector- the other memory subsystem sector numberother_block- the other memory subsystem block numberother_len- the number of bytes of memory to be read- Returns:
- the length in bytes of the data returned in the
destarray. 0 if none. - Throws:
ExternalException- with the following reason codes:ExternalException.INVALID_PARAMif any of the input parameters are invalid.ExternalException.INTERNAL_ERRORif an unrecoverable external memory access error occurred.
-