public class SensitiveArrays extends Object
SensitiveArrays
class provides methods for creating and handling
integrity-sensitive array objects.
The makeIntegritySensitiveArray
method can be
used to create integrity-sensitive array objects. Integrity-sensitive array
objects include an integrity control element that is automatically and
transparently updated by the platform whenever the array content is legally
modified. The integrity control element is automatically checked by the
platform before any array update operation. If an inconsistency is detected
during an array integrity check a SecurityException
is thrown. The
integrity control element is not automatically checked by the platform before
a read operation: it is up to the applet to trigger such a check by calling
the assertIntegrity
method.Modifier and Type | Method and Description |
---|---|
static void |
assertIntegrity(Object obj)
Checks the integrity of the specified integrity-sensitive array object.
|
static short |
clearArray(Object obj)
Clears the specified array object.
|
static boolean |
isIntegritySensitive(Object obj)
Returns whether the provided object is an integrity-sensitive array.
|
static boolean |
isIntegritySensitiveArraysSupported()
Returns whether the implementation for the Java Card platform supports integrity-sensitive arrays.
|
static Object |
makeIntegritySensitiveArray(byte type,
byte memory,
short length)
Creates an integrity-sensitive array of the specified array and memory
type, with the specified array length.
|
public static void assertIntegrity(Object obj)
obj
- the integrity-sensitive array object being queriedNullPointerException
- if obj
is null
.SecurityException
- if the integrity of obj
has been
compromised.SystemException
- with the following reason codes:
ILLEGAL_VALUE
if the specified
object is not an integrity-sensitive array object.makeIntegritySensitiveArray(byte, byte, short)
public static boolean isIntegritySensitive(Object obj)
boolean
result, this method sets the
result in an internal state which can be rechecked using assertion methods
of the SensitiveResult
class.obj
- the object being queried.true
if the provided object is an integrity-sensitive
array; false
otherwise.NullPointerException
- if obj
is null
.makeIntegritySensitiveArray(byte, byte, short)
public static boolean isIntegritySensitiveArraysSupported()
boolean
result, this method sets the
result in an internal state which can be rechecked using assertion methods
of the SensitiveResult
class.true
if integrity-sensitive arrays are supported; false
otherwise.makeIntegritySensitiveArray(byte, byte, short)
public static Object makeIntegritySensitiveArray(byte type, byte memory, short length)
type
- the array type - must be one of: ARRAY_TYPE_BOOLEAN
,
ARRAY_TYPE_BYTE
, ARRAY_TYPE_SHORT
, ARRAY_TYPE_INT
or ARRAY_TYPE_OBJECT
.memory
- the memory type - must be one of:
MEMORY_TYPE_PERSISTENT
, MEMORY_TYPE_TRANSIENT_RESET
or
MEMORY_TYPE_TRANSIENT_DESELECT
.length
- the length of the sensitive array.NegativeArraySizeException
- if the length
parameter is
negativeSystemException
- with the following reason codes:
ILLEGAL_USE
if integrity-sensitive
arrays are not supported.ILLEGAL_VALUE
if type
or
memory
is not a valid type code. An implementation which does not
support integrity-sensitive array objects of int
array type may
throw this exception.NO_TRANSIENT_SPACE
if no
sufficient transient space is available.NO_RESOURCE
if no sufficient
persistent space is available.public static short clearArray(Object obj) throws TransactionException
null
for
ARRAY_TYPE_OBJECT
arrays and to zero for
all other array types. The integrity of the array object is not checked by
this method before the clearing and the reinitialization of the
integrity-control information.
In addition to returning a short
result, this method sets the
result in an internal state which can be rechecked using assertion methods
of the SensitiveResult
class.
Note:
TransactionException
exception is thrown.obj
- the array being cleared.SystemException
- with the following reason codes:
ILLEGAL_VALUE
if the specified
object is not an integrity-sensitive array object.NullPointerException
- if obj
is null
.TransactionException
- if clearing would cause the commit capacity to
be exceeded.JCSystem.getUnusedCommitCapacity()
Copyright © 1998, 2015, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms