Package javacardx.external
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:
Memory.getMemoryAccessInstance( byte, short[], short )
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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)
This method is used to read data from non-directly addressable memory after providing the correct key(password) to authenticate.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)
This method is used to write data into non-directly addressable memory after providing the correct key(password) to authenticate.
-
-
-
Method Detail
-
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 thesrc
array 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_key
array where the key data beginsauth_key_blen
- the length in bytes of the key in theauth_key
arrayother_sector
- the external memory subsystem sector numberother_block
- the external memory subsystem block number- Returns:
true
if the write was successful,false
otherwise- Throws:
ExternalException
- with the following reason codes:ExternalException.INVALID_PARAM
if any of the input parameters are invalid.ExternalException.INTERNAL_ERROR
if 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 array
where data should beginauth_key
- the byte array containing the key(password)auth_key_off
- the byte offset into theauth_key
array where the key data beginsauth_key_blen
- the length in bytes of the key in theauth_key
arrayother_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
dest
array. 0 if none. - Throws:
ExternalException
- with the following reason codes:ExternalException.INVALID_PARAM
if any of the input parameters are invalid.ExternalException.INTERNAL_ERROR
if an unrecoverable external memory access error occurred.
-
-