|
Java Card 2.1 Platform Final Revision 1.0 |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--javacardx.crypto.Cipher
The Cipher class is the abstract base class for Cipher algorthims. Implementations of Cipher
algorithms must extend this class and implement all the abstract methods.
The term "pad" is used in the public key cipher algorithms below to refer to all the operations specified in the referenced scheme to transform the message block into the cipher block size.
| Field Summary | |
static byte |
ALG_DES_CBC_ISO9797_M1
Cipher algorithm ALG_DES_CBC_ISO9797_M1 provides a cipher using DES
in CBC mode. This algorithm uses outer CBC for triple DES.
Input data is padded according to the ISO 9797 method 1 scheme. |
static byte |
ALG_DES_CBC_ISO9797_M2
Cipher algorithm ALG_DES_CBC_ISO9797_M2 provides a cipher using DES
in CBC mode. This algorithm uses outer CBC for triple DES.
Input data is padded according to the ISO 9797 method 2 (ISO 7816-4, EMV'96) scheme. |
static byte |
ALG_DES_CBC_NOPAD
Cipher algorithm ALG_DES_CBC_NOPAD provides a cipher using DES in CBC mode.
This algorithm uses outer CBC for triple DES.
This algorithm does not pad input data. |
static byte |
ALG_DES_CBC_PKCS5
Cipher algorithm ALG_DES_CBC_PKCS5 provides a cipher using DES in CBC mode. This algorithm uses outer CBC for triple DES. Input data is padded according to the PKCS#5 scheme. |
static byte |
ALG_DES_ECB_ISO9797_M1
Cipher algorithm ALG_DES_ECB_ISO9797_M1 provides a cipher using DES
in ECB mode.
Input data is padded according to the ISO 9797 method 1 scheme. |
static byte |
ALG_DES_ECB_ISO9797_M2
Cipher algorithm ALG_DES_ECB_ISO9797_M2 provides a cipher using DES
in ECB mode.
Input data is padded according to the ISO 9797 method 2 (ISO 7816-4, EMV'96) scheme. |
static byte |
ALG_DES_ECB_NOPAD
Cipher algorithm ALG_DES_ECB_NOPAD provides a cipher using DES in ECB mode.
This algorithm does not pad input data. |
static byte |
ALG_DES_ECB_PKCS5
Cipher algorithm ALG_DES_ECB_PKCS5 provides a cipher using DES
in ECB mode.
Input data is padded according to the PKCS#5 scheme. |
static byte |
ALG_RSA_ISO14888
Cipher algorithm ALG_RSA_ISO14888 provides a cipher using RSA.
Input data is padded according to the ISO 14888 scheme. |
static byte |
ALG_RSA_ISO9796
Cipher algorithm ALG_RSA_ISO9796 provides a cipher using RSA.
Input data is padded according to the ISO 9796 (EMV'96) scheme. |
static byte |
ALG_RSA_PKCS1
Cipher algorithm ALG_RSA_PKCS1 provides a cipher using RSA.
Input data is padded according to the PKCS#1 (v1.5) scheme. |
static byte |
MODE_DECRYPT
Used in init() methods to indicate decryption mode. |
static byte |
MODE_ENCRYPT
Used in init() methods to indicate encryption mode. |
| Constructor Summary | |
protected |
Cipher()
Protected Constructor |
| Method Summary | |
abstract short |
doFinal(byte[] inBuff,
short inOffset,
short inLength,
byte[] outBuff,
short outOffset)
Generates encrypted/decrypted output from all/last input data. |
abstract byte |
getAlgorithm()
Gets the Cipher algorithm. |
static Cipher |
getInstance(byte algorithm,
boolean externalAccess)
Creates a Cipher object instance of the selected algorithm. |
abstract void |
init(Key theKey,
byte theMode)
Initializes the Cipher object with the appropriate Key. |
abstract void |
init(Key theKey,
byte theMode,
byte[] bArray,
short bOff,
short bLen)
Initializes the Cipher object with the appropriate Key and algorithm specific
parameters. |
abstract short |
update(byte[] inBuff,
short inOffset,
short inLength,
byte[] outBuff,
short outOffset)
Generates encrypted/decrypted output from input data. |
| Methods inherited from class java.lang.Object |
equals |
| Field Detail |
public static final byte ALG_DES_CBC_NOPAD
ALG_DES_CBC_NOPAD provides a cipher using DES in CBC mode.
This algorithm uses outer CBC for triple DES.
This algorithm does not pad input data. If the input data is not (8 byte) block
aligned it throws CryptoExeption with the reason code ILLEGAL_USE.public static final byte ALG_DES_CBC_ISO9797_M1
ALG_DES_CBC_ISO9797_M1 provides a cipher using DES
in CBC mode. This algorithm uses outer CBC for triple DES.
Input data is padded according to the ISO 9797 method 1 scheme.public static final byte ALG_DES_CBC_ISO9797_M2
ALG_DES_CBC_ISO9797_M2 provides a cipher using DES
in CBC mode. This algorithm uses outer CBC for triple DES.
Input data is padded according to the ISO 9797 method 2 (ISO 7816-4, EMV'96) scheme.public static final byte ALG_DES_CBC_PKCS5
public static final byte ALG_DES_ECB_NOPAD
ALG_DES_ECB_NOPAD provides a cipher using DES in ECB mode.
This algorithm does not pad input data. If the input data is not (8 byte) block
aligned it throws CryptoExeption with the reason code ILLEGAL_USE.public static final byte ALG_DES_ECB_ISO9797_M1
ALG_DES_ECB_ISO9797_M1 provides a cipher using DES
in ECB mode.
Input data is padded according to the ISO 9797 method 1 scheme.public static final byte ALG_DES_ECB_ISO9797_M2
ALG_DES_ECB_ISO9797_M2 provides a cipher using DES
in ECB mode.
Input data is padded according to the ISO 9797 method 2 (ISO 7816-4, EMV'96) scheme.public static final byte ALG_DES_ECB_PKCS5
ALG_DES_ECB_PKCS5 provides a cipher using DES
in ECB mode.
Input data is padded according to the PKCS#5 scheme.public static final byte ALG_RSA_ISO14888
ALG_RSA_ISO14888 provides a cipher using RSA.
Input data is padded according to the ISO 14888 scheme.public static final byte ALG_RSA_PKCS1
ALG_RSA_PKCS1 provides a cipher using RSA.
Input data is padded according to the PKCS#1 (v1.5) scheme.
Note:
public static final byte ALG_RSA_ISO9796
ALG_RSA_ISO9796 provides a cipher using RSA.
Input data is padded according to the ISO 9796 (EMV'96) scheme.
Note:
public static final byte MODE_DECRYPT
init() methods to indicate decryption mode.public static final byte MODE_ENCRYPT
init() methods to indicate encryption mode.| Constructor Detail |
protected Cipher()
| Method Detail |
public static final Cipher getInstance(byte algorithm,
boolean externalAccess)
throws CryptoException
Cipher object instance of the selected algorithm.algorithm - the desired Cipher algorithm. See above.externalAccess - if true indicates that the instance will be shared among
multiple applet instances and that the Cipher instance will also be accessed (via a Shareable
interface) when the owner of the Cipher instance is not the currently selected applet.Cipher object instance of the requested algorithm.CryptoException.NO_SUCH_ALGORITHM if the requested algorithm is not supported.
public abstract void init(Key theKey,
byte theMode)
throws CryptoException
Cipher object with the appropriate Key. This method should be used
for algorithms which do not need initialization parameters or use default parameter
values.
Note:
theKey - the key object to use for signing or verifyingtheMode - one of MODE_DECRYPT or MODE_ENCRYPTCryptoException.ILLEGAL_VALUE if theMode option is an undefined value or
if the Key is inconsistent with the Cipher implementation.
public abstract void init(Key theKey,
byte theMode,
byte[] bArray,
short bOff,
short bLen)
throws CryptoException
Cipher object with the appropriate Key and algorithm specific
parameters.
Note:
bArray.
CryptoException.ILLEGAL_VALUE.
theKey - the key object to use for signingtheMode - one of MODE_DECRYPT or MODE_ENCRYPTbArray - byte array containing algorithm specific initialization info.bOff - offset withing bArray where the algorithm specific data begins.bLen - byte length of algorithm specific parameter dataCryptoException.ILLEGAL_VALUE if theMode option is an undefined value
or 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 or
if the Key is inconsistent with the Cipher implementation.
public abstract byte getAlgorithm()
public abstract short doFinal(byte[] inBuff,
short inOffset,
short inLength,
byte[] outBuff,
short outOffset)
throws CryptoException
Cipher object to the state it was in
when previously initialized via a call to init().
That is, the object is reset and available to encrypt or decrypt
(depending on the operation mode that was specified in the call to init()) more data.
The input and output buffer data may overlap.
Notes:
outBuff.
outBuff may be larger
than inLength.
inBuff - the input buffer of data to be encrypted/decrypted.inOffset - the offset into the input buffer at which to begin encryption/decryption.inLength - the byte length to be encrypted/decrypted.outBuff - the output buffer, may be the same as the input bufferoutOffset - the offset into the output buffer where the resulting hash value beginsoutBuffCryptoException.UNINITIALIZED_KEY if key not initialized.
CryptoException.INVALID_INIT if this Cipher object is
not initialized.
CryptoException.ILLEGAL_USE if this Cipher algorithm
does not pad the message and the message is not block aligned or if the input message
length is not supported.
public abstract short update(byte[] inBuff,
short inOffset,
short inLength,
byte[] outBuff,
short outOffset)
throws CryptoException
doFinal() method
is recommended whenever possible.
The input and output buffer data may overlap.
Notes:
outBuff.
outBuff may be larger
than inLength.
outBuff be smaller than
inLength or even 0.
inBuff - the input buffer of data to be encrypted/decrypted.inOffset - the offset into the input buffer at which to begin encryption/decryption.inLength - the byte length to be encrypted/decrypted.outBuff - the output buffer, may be the same as the input bufferoutOffset - the offset into the output buffer where the resulting hash value beginsoutBuffCryptoException.UNINITIALIZED_KEY if key not initialized.
CryptoException.INVALID_INIT if this Cipher object is
not initialized.
CryptoException.ILLEGAL_USE if the input message length is not supported.
|
Submit a bug or feature Java and Java Card are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries. Copyright 1993-1999 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved. |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||