public class SecureStorageProvider extends Provider
| Modifier and Type | Field and Description |
|---|---|
static byte |
INS_CREATE_SS_ENTRY
SIM Alliance Secure Storage CREATE SS ENTRY instruction value.
|
static byte |
INS_DELETE_ALL_SS_ENTRIES
SIM Alliance Secure Storage DELETE ALL SS ENTRIES instruction value.
|
static byte |
INS_DELETE_SS_ENTRY
SIM Alliance Secure Storage DELETE SS ENTRY instruction value.
|
static byte |
INS_GET_SS_ENTRY_DATA
SIM Alliance Secure Storage GET SS ENTRY DATA instruction value.
|
static byte |
INS_GET_SS_ENTRY_ID
SIM Alliance Secure Storage GET SS ENTRY ID instruction value.
|
static byte |
INS_PING_SS_APPLET
SIM Alliance Secure Storage PING SS APPLET instruction value.
|
static byte |
INS_PUT_SS_ENTRY_DATA
SIM Alliance Secure Storage PUT SS ENTRY DATA instruction value.
|
static byte |
INS_SELECT_SS_ENTRY
SIM Alliance Secure Storage SELECT SS ENTRY instruction value.
|
static int |
MAX_TITLE_LENGTH
Maximum length for a SS title.
|
| Constructor and Description |
|---|
SecureStorageProvider(Channel channel)
Creates a SecureStorageProvider instance which will be connected to the
preselected SE Secure Storage Applet on defined channel.
|
| Modifier and Type | Method and Description |
|---|---|
void |
create(java.lang.String title,
byte[] data)
This command creates a Secure Storage entry with the defined title and
data.
|
boolean |
delete(java.lang.String title)
This command deletes the Secure Storage entry referenced by the title.
|
void |
deleteAll()
This command deletes all Secure Storage entry referenced.
|
boolean |
exist(java.lang.String title)
This command checks if the Secure Storage entry with the defined title
exists.
|
java.lang.String[] |
list()
This command returns an entry list with all title-identifier.
|
byte[] |
read(java.lang.String title)
This command reads and returns the byte stream of a data entry stored in
the Secure Element referenced by the title.
|
void |
update(java.lang.String title,
byte[] data)
This command updates the data of the Secure Storage entry referenced by
the defined title.
|
getChannelpublic static final int MAX_TITLE_LENGTH
public static final byte INS_PING_SS_APPLET
public static final byte INS_CREATE_SS_ENTRY
public static final byte INS_DELETE_ALL_SS_ENTRIES
public static final byte INS_DELETE_SS_ENTRY
public static final byte INS_GET_SS_ENTRY_DATA
public static final byte INS_GET_SS_ENTRY_ID
public static final byte INS_SELECT_SS_ENTRY
public static final byte INS_PUT_SS_ENTRY_DATA
public SecureStorageProvider(Channel channel) throws java.lang.IllegalStateException
channel - the channel that shall be used by this Provider for
operations on the Secure Storage.java.lang.IllegalStateException - if the defined channel is closed.java.lang.IllegalStateException - if the defined channel is not connected to
a Secure Storage applet.public void create(java.lang.String title,
byte[] data)
throws java.lang.IllegalStateException,
java.lang.IllegalArgumentException,
java.lang.SecurityException,
java.io.IOException
title - The title of the entry that shall be written. The max. title
length is 60. All characters must be supported by UTF-8.data - The data of the entry that shall be written. If data is empty
or null then only the defined title will be assigned to the new
entry.java.lang.SecurityException - if old PIN to access the Secure Storage Applet
was not verified.java.lang.IllegalStateException - if the used channel is closed.java.lang.IllegalArgumentException - if the title already exists, if the data
chain is too long or if the title has bad encoding or wrong
length (empty or too long).java.io.IOException - if the entry couldn't be created because of an
incomplete write procedure.public void update(java.lang.String title,
byte[] data)
throws java.lang.IllegalStateException,
java.lang.IllegalArgumentException,
java.lang.SecurityException,
java.io.IOException
title - the title of the entry that must already exist. The max.
title length is 60. All characters must be supported by UTF-8.data - the data of the entry that shall be written. If data is
empty or null then the data of the existing entry (referenced by the
title) will be deleted.java.lang.IllegalStateException - if the used channel is closed.java.lang.IllegalArgumentException - if the title does not already exists.java.lang.IllegalArgumentException - if the title is incorrect: bad encoding
or wrong length (empty or too long).java.lang.IllegalArgumentException - if the data chain is too long.java.io.IOException - if the entry couldn’t be updated because of an
incomplete write procedure.java.lang.SecurityException - if the PIN to access the Secure Storage Applet
was not verified.public byte[] read(java.lang.String title)
throws java.lang.IllegalStateException,
java.io.IOException,
java.lang.IllegalArgumentException,
java.lang.SecurityException
title - the title of the entry that must already exist. The max.
title length is 60. All characters must be supported by UTF-8.java.lang.SecurityException - if the PIN to access the Secure Storage Applet
was not verified.java.lang.IllegalStateException - if the used channel is closed.java.lang.IllegalArgumentException - if the title has bad encoding or wrong
length (empty or too long).java.io.IOException - if the entry couldn't be read because of an
incomplete read procedure.java.lang.IllegalArgumentException - when there are incorrect P1 or P2.
TODO: should be an IllegalReferenceErrorpublic boolean exist(java.lang.String title)
throws java.lang.IllegalStateException,
java.lang.IllegalArgumentException,
java.lang.SecurityException,
java.io.IOException
title - the title of the entry that shall be checked. The max. title
length is 60. All characters must be supported by UTF-8.java.lang.IllegalStateException - if the used channel is closed.java.lang.IllegalArgumentException - if the title is incorrect: bad encoding
or wrong length (empty or too long).java.lang.SecurityException - if the PIN to access the Secure Storage Applet
was not verified.java.io.IOException - lower-level API exception.public boolean delete(java.lang.String title)
throws java.lang.IllegalStateException,
java.lang.IllegalArgumentException,
java.io.IOException,
java.lang.SecurityException
title - The title of the entry that must already exist. The max.
title length is 60. All characters must be supported by UTF-8.java.lang.IllegalStateException - if the used channel is closed.java.lang.IllegalArgumentException - if the title is incorrect: bad encoding
or wrong length (empty or too long).java.io.IOException - if there is an error in the transport layer.java.lang.SecurityException - if old PIN to access the Secure Storage Applet
was not verified.public void deleteAll()
throws java.lang.IllegalStateException,
java.lang.SecurityException,
java.io.IOException
java.lang.SecurityException - if the PIN to access the Secure Storage Applet
was not verified.java.lang.IllegalStateException - if the used channel is closed.java.io.IOException - if there is an error in the transport layer.public java.lang.String[] list()
throws java.lang.IllegalStateException,
java.lang.SecurityException,
java.io.IOException
java.lang.SecurityException - if the PIN to access the Secure Storage Applet
was not verified.java.lang.IllegalStateException - if the used channel is closed.java.io.IOException - if there is an error in the transport layer.SEEK for Android Copyright 2015, Giesecke & Devrient GmbH