|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjavacard.security.Checksum
The Checksum class is the base class for CRC (cyclic
redundancy check) checksum algorithms. Implementations of Checksum
algorithms must extend this class and implement all the abstract
methods.
A tear or card reset event resets a Checksum object
to the initial state (state upon construction).
Even if a transaction is in progress, update of intermediate result state in the implementation instance shall not participate in the transaction.
| Field Summary | |
static byte |
ALG_ISO3309_CRC16
ISO/IEC 3309 compliant 16 bit CRC algorithm. |
static byte |
ALG_ISO3309_CRC32
ISO/IEC 3309 compliant 32 bit CRC algorithm. |
| Constructor Summary | |
protected |
Checksum()
Protected Constructor |
| Method Summary | |
abstract short |
doFinal(byte[] inBuff,
short inOffset,
short inLength,
byte[] outBuff,
short outOffset)
Generates a CRC checksum of all/last input data. |
abstract byte |
getAlgorithm()
Gets the Checksum algorithm. |
static Checksum |
getInstance(byte algorithm,
boolean externalAccess)
Creates a Checksum object instance of the selected
algorithm. |
abstract void |
init(byte[] bArray,
short bOff,
short bLen)
Resets and initializes the Checksum object with the
algorithm specific parameters. |
abstract void |
update(byte[] inBuff,
short inOffset,
short inLength)
Accumulates a partial checksum of the input data. |
| Methods inherited from class java.lang.Object |
equals |
| Field Detail |
public static final byte ALG_ISO3309_CRC32
public static final byte ALG_ISO3309_CRC16
| Constructor Detail |
protected Checksum()
| Method Detail |
public abstract void update(byte[] inBuff,
short inOffset,
short inLength)
inOffset and continuing on until the byte at
(inOffset+inLength-1) of the inBuff
array. Within each byte the processing proceeds from the least
significant bit to the most.
This method requires temporary storage of intermediate
results. This may result in additional resource consumption
and/or slow performance. This method should only be used if all
the input data required for the checksum is not available in one
byte array. The doFinal(byte[], short, short, byte[], short) method is
recommended whenever possible.
Note:
inLength is 0 this method does
nothing.
inBuff - the input buffer of data to be checksummedinOffset - the offset into the input buffer at which to
begin checksum generationinLength - the byte length to checksumdoFinal(byte[], short, short,
byte[], short)
public static final Checksum getInstance(byte algorithm,
boolean externalAccess)
throws CryptoException
Checksum object instance of the selected
algorithm.
algorithm - the desired checksum algorithm. Valid codes
listed in ALG_ .. constants above, for example, ALG_ISO3309_CRC16externalAccess - true indicates that the
instance will be shared among multiple applet instances and that
the Checksum instance will also be accessed (via a
Shareable. interface) when the owner of the
Checksum instance is not the currently selected
applet. If true the implementation must not
allocate CLEAR_ON_DESELECT transient space for internal data.
Checksum object instance of the
requested algorithm.
CryptoException - with the following reason codes:
CryptoException.NO_SUCH_ALGORITHM if the
requested algorithm or shared access mode is not supported.
public abstract short doFinal(byte[] inBuff,
short inOffset,
short inLength,
byte[] outBuff,
short outOffset)
inOffset and continuing on until the byte at
(inOffset+inLength-1) of the inBuff
array. Within each byte the processing proceeds from the least
significant bit to the most.
Completes and returns the checksum computation. The
Checksum object is reset to the initial state(state
upon construction) when this method completes.
Note:
init(byte[], short, short) method. The input and output buffer data may overlap.
inBuff - the input buffer of data to be checksummedinOffset - the offset into the input buffer at which to
begin checksum generationinLength - the byte length to checksumoutBuff - the output buffer, may be the same as the input
bufferoutOffset - the offset into the output buffer where the
resulting checksum value begins
outBuffpublic abstract byte getAlgorithm()
ALG_ISO3309_CRC16
public abstract void init(byte[] bArray,
short bOff,
short bLen)
throws CryptoException
Checksum object with the
algorithm specific parameters.
Note:
bArray
representing the initial checksum value.
bArray
representing the initial checksum value.
bArray - byte array containing algorithm specific
initialization informationbOff - offset within bArray where the
algorithm specific data beginsbLen - byte length of algorithm specific parameter data
CryptoException - with the following reason codes:
CryptoException.ILLEGAL_VALUE if a byte array
parameter option is not supported by the algorithm or if the
bLen is an incorrect byte length for the algorithm
specific data.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||