Java Card API

memoryaccess

2017-05-22 16:54:44 M&W SmartCard 3

javacardx.external

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 memorysubsystem can be obtained via the Memory class.

Since:

2.2.2

See Also:Memory.getMemoryAccessInstance( byte, short[], short )


Method Summary
 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.

Parameters:src - the source data byte array

src_off - the byte offset into the src array where data begins

src_blen - the byte length of the data to be written

auth_key - the byte array containing the key(password)

auth_key_off - the byte offset into the auth_key array where the key data begins

auth_key_blen - the length in bytes of the key in the auth_key array

other_sector - the external memory subsystem sector number

other_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.

Parameters:dest - the destination data byte array

dest_off - the byte offset into the dest array where data should begin

auth_key - the byte array containing the key(password)

auth_key_off - the byte offset into the auth_key array where the key data begins

auth_key_blen - the length in bytes of the key in the auth_key array

other_sector - the other memory subsystem sector number

other_block - the other memory subsystem block number

other_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.


Home
Product
News
Contact us