public final class SensitiveResult extends Object
SensitiveResult
class provides methods for asserting results of
sensitive functions. Sensitive methods of the Java Card API (refer to the
See Also section below) store their
results so that callers of these methods can assert their return values. If
such a method returns abnormally with an exception then the stored result is
tagged as Unassigned and any subsequent assertion of the result will
fail.
reset
method.
SensitiveResult
class:
Note that results from Java Card API methods yielding atry { boolean res = signature.verify(...); if (res) { SensitiveResult.assertTrue(); // Grant service } else { SensitiveResult.assertFalse(); // Deny service } } finally { SensitiveResult.reset(); }
byte
result
are stored as short
after conversion (with sign-extension).SensitiveArrays.isIntegritySensitive(java.lang.Object)
,
SensitiveArrays.isIntegritySensitiveArraysSupported()
,
SensitiveArrays.clearArray(java.lang.Object)
,
AID.equals(Object)
,
AID.equals(byte[], short, byte)
,
AID.partialEquals(byte[], short, byte)
,
AID.RIDEquals(javacard.framework.AID)
,
JCSystem.getAID()
,
JCSystem.lookupAID(byte[], short, byte)
,
JCSystem.getPreviousContextAID()
,
JCSystem.getAppletShareableInterfaceObject(javacard.framework.AID, byte)
,
OwnerPINxWithPredecrement.decrementTriesRemaining()
,
OwnerPINxWithPredecrement.check(byte[], short, byte)
,
OwnerPIN.getTriesRemaining()
,
OwnerPIN.check(byte[], short, byte)
,
OwnerPIN.isValidated()
,
OwnerPIN.getValidatedFlag()
,
PIN.getTriesRemaining()
,
PIN.check(byte[], short, byte)
,
PIN.isValidated()
,
Util.arrayCopy(byte[], short, byte[], short, short)
,
Util.arrayCopyNonAtomic(byte[], short, byte[], short, short)
,
Util.arrayFill(byte[], short, short, byte)
,
Util.arrayFillNonAtomic(byte[], short, short, byte)
,
Util.arrayCompare(byte[], short, byte[], short, short)
,
BioTemplate.isValidated()
,
BioTemplate.getTriesRemaining()
,
BioTemplate.initMatch(byte[], short, short)
,
BioTemplate.match(byte[], short, short)
,
BioMatcher.isValidated()
,
BioMatcher.getTriesRemaining()
,
BioMatcher.initMatch(byte[], short, short)
,
BioMatcher.match(byte[], short, short)
,
BigNumber.compareTo(javacardx.framework.math.BigNumber)
,
BigNumber.compareTo(byte[], short, short, byte)
,
Checksum.doFinal(byte[], short, short, byte[], short)
,
MessageDigest.doFinal(byte[], short, short, byte[], short)
,
MessageDigest.OneShot.doFinal(byte[], short, short, byte[], short)
,
RandomData.getAlgorithm()
,
RandomData.nextBytes(byte[], short, short)
,
RandomData.OneShot.getAlgorithm()
,
RandomData.OneShot.nextBytes(byte[], short, short)
,
Signature.sign(byte[], short, short, byte[], short)
,
Signature.OneShot.sign(byte[], short, short, byte[], short)
,
Signature.signPreComputedHash(byte[], short, short, byte[], short)
,
Signature.OneShot.signPreComputedHash(byte[], short, short, byte[], short)
,
Signature.verify(byte[], short, short, byte[], short, short)
,
Signature.OneShot.verify(byte[], short, short, byte[], short, short)
,
Signature.verifyPreComputedHash(byte[], short, short, byte[], short, short)
,
Signature.OneShot.verifyPreComputedHash(byte[], short, short, byte[], short, short)
,
Cipher.doFinal(byte[], short, short, byte[], short)
,
Cipher.OneShot.doFinal(byte[], short, short, byte[], short)
,
Cipher.update(byte[], short, short, byte[], short)
,
AEADCipher.doFinal(byte[], short, short, byte[], short)
,
AEADCipher.update(byte[], short, short, byte[], short)
,
AEADCipher.retrieveTag(byte[], short, short)
,
AEADCipher.verifyTag(byte[], short, short, short)
Modifier and Type | Method and Description |
---|---|
static void |
assertEquals(Object obj)
Asserts the stored result to be an object reference equal to the provided
object reference.
|
static void |
assertEquals(short val)
Asserts the stored result to be a
short value equal to the provided
short value. |
static void |
assertFalse()
Asserts the stored result to be a
boolean value equal to
false . |
static void |
assertGreaterThan(short val)
Asserts the stored result to be a
short value strictly greater than
the provided short value. |
static void |
assertLessThan(short val)
Asserts the stored result to be a
short value strictly less than
the provided short value. |
static void |
assertNegative()
Asserts the stored result to be a
short value strictly negative. |
static void |
assertPositive()
Asserts the stored result to be a
short value strictly positive. |
static void |
assertTrue()
Asserts the stored result to be a
boolean value equal to
true . |
static void |
assertZero()
Asserts the stored result to be a
short value equal to zero. |
static void |
reset()
Resets the stored result.
|
public static void assertEquals(Object obj) throws SecurityException
res
and the provided object reference obj
do not refer to the same object or are not both null
; in other
words (res == obj)
evaluates to false
.obj
- The object reference to compare with the stored result.SecurityException
- if the provided object reference is not equal to
that of the stored result.public static void assertTrue() throws SecurityException
boolean
value equal to
true
.SecurityException
- if the stored result is not set to true
.public static void assertFalse() throws SecurityException
boolean
value equal to
false
.SecurityException
- if the stored result is not set to false
.public static void assertNegative() throws SecurityException
short
value strictly negative. A
call to this method is semantically equivalent to a call to
assertLessThan(short)
with parameter 0
.SecurityException
- if the stored result is not negative.public static void assertPositive() throws SecurityException
short
value strictly positive. A
call to this method is semantically equivalent to a call to
assertGreaterThan(short)
with parameter 0
.SecurityException
- if the stored result is not positive.public static void assertZero() throws SecurityException
short
value equal to zero. A call
to this method is semantically equivalent to a call to
assertEquals(short)
with parameter 0
.SecurityException
- if the stored result is not zero.public static void assertEquals(short val) throws SecurityException
short
value equal to the provided
short
value.val
- The short
value to compare with the stored result.SecurityException
- if the provided value is not equal to that of the
stored result.public static void assertGreaterThan(short val) throws SecurityException
short
value strictly greater than
the provided short
value.val
- The short
value to compare with the stored result.SecurityException
- if the provided value is not greater than that of
the stored result.public static void assertLessThan(short val) throws SecurityException
short
value strictly less than
the provided short
value.val
- The short
value to compare with the stored result.SecurityException
- if the provided value is not less than that of
the stored result.public static void reset()
Copyright © 1998, 2015, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms