|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectandroid.device.SEManager
public class SEManager
The SEManager class is used to initialize and control the security processor hardware
To control the security processor hardware with this class, use the following steps:
open()
.
deleteKey(int , int , byte[] , byte[] )
.
downloadKey(int , int , int , byte[] , int ,byte[] , byte[] )
.
encryptData(int , int , int , byte[] ,int , int , byte[] , int ,byte[] , byte[] )
.
close()
to close the security processor.
For more information about the smart card reader, read the samples folder below PinPad.
Nested Class Summary | |
---|---|
static interface |
SEManager.PedInputListener
|
Field Summary | |
---|---|
static int |
ECRC16_DATA
data crc16 error |
static int |
EENCRYPTKEYS_NOTDOWLOAD
keys encrypt keys not download |
static int |
EHEAD_CMD
command head (CB) error |
static int |
EKEYS_DOWNLOAD
keys download |
static int |
EKEYS_EXISTS
keys exists or cant't be overwrite |
static int |
EKEYS_NOTDOWNLOAD
keys not download |
static int |
EKEYS_OUTOFSPACE
keys out of space |
static int |
EKEYS_RDORINIT
keys not ready or init |
static int |
EKEYSNO_NOTFOUND
keys number not found |
static int |
EKEYSNO_OVERRANGE
keys number out of range |
static int |
ELENGTH_CMD
command length error |
static int |
EMSG_FORMAT
message format error |
static int |
EMSG_MAC
message mac error |
static int |
ENOTSUP_ALGORITHM
unsupported algorithm |
static int |
ENOTSUP_CMD
unsupported command |
static int |
ENOTSUP_FORMAT
unsupported format |
static int |
ENOTSUP_KEYSLENGTH
unsupported keys length |
static int |
ENOTSUP_MODE
unsupported mode |
static int |
ENOTSUP_PINBLOCK_FORMAT
unsupported pinblock format |
static int |
ENOTSUP_SEPUSE
keys unsupported specified use |
static int |
EPINBLOCK_CHAR
pinblock char error |
static int |
ERESERVED_0X1D
Reserved |
static int |
ESEPARATOR_CMD
command separator error |
static int |
ESEPARATORLEN_CMD
command separator length error |
static int |
EUSER_PINBLOCK_LENGTH
user pinblock length error |
static int |
EUSER_PINBLOCK_VALUE
user pinblock value error |
static int |
EUSERNAME_LENGTH
username length error |
static int |
EUSERNAME_VALUE
username value error |
static int |
S_OK
command execute Success |
Constructor Summary | |
---|---|
SEManager()
|
Method Summary | |
---|---|
int |
clearKey(byte[] ResponseData,
byte[] ResLen)
clearKey:Clear All Keys. |
int |
close()
close security processor |
int |
decryptData(int KeyUsage,
int KeyNo,
int Algorithm,
byte[] StartValue,
int StartValueLen,
int PaddingChar,
byte[] DecryptData,
int DecryptDataLen,
byte[] ResponseData,
byte[] ResLen)
decryptData: Decryption Data |
int |
deleteKey(int KeyUsage,
int KeyNo,
byte[] ResponseData,
byte[] ResLen)
deleteKey:Delete Keys. |
int |
downloadKey(int KeyUsage,
int KeyNo,
int ParentKeyNo,
byte[] KeyData,
int KeyDataLen,
byte[] ResponseData,
byte[] ResLen)
loadKey:Download Keys in security processor RAM. |
int |
enableSuspend(int enable,
byte[] ResponseData,
byte[] ResLen)
Enable the security processor timeout before automatic suspension. |
int |
encryptData(int KeyUsage,
int KeyNo,
int Algorithm,
byte[] StartValue,
int StartValueLen,
int PaddingChar,
byte[] EncryptData,
int EncryptDataLen,
byte[] ResponseData,
byte[] ResLen)
encryptData: Encryption Data. |
int |
generateRandomData(byte[] ResponseData,
byte[] ResLen)
Generate a 8 bytes random number. |
int |
getFirmwareVersion(byte[] ResponseData,
byte[] ResLen)
get security processor firmware version. |
int |
getPinBlock(int KeyUsage,
int PINKeyNo,
byte[] CustomerData,
int CustomerDataLen,
java.lang.String message,
long timeOut,
SEManager.PedInputListener listener)
Get the pin block. |
int |
getPinBlockEx(android.os.Bundle bundle,
SEManager.PedInputListener listener)
Get the pin block. |
int |
getPinBlockEx(int KeyUsage,
int PINKeyNo,
byte[] CustomerData,
int CustomerDataLen,
java.lang.String message,
long timeOut,
java.lang.String supportPinLen,
SEManager.PedInputListener listener)
Get the pin block. |
int |
getStatus(byte[] ResponseData,
byte[] ResLen)
get security processor hardware status |
int |
open()
open security processor |
int |
setSuspendTimeout(int timeout,
byte[] ResponseData,
byte[] ResLen)
This function allows to set the security processor timeout before automatic suspension. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int S_OK
public static final int ENOTSUP_CMD
public static final int ELENGTH_CMD
public static final int ESEPARATOR_CMD
public static final int ESEPARATORLEN_CMD
public static final int EHEAD_CMD
public static final int ECRC16_DATA
public static final int EMSG_MAC
public static final int EMSG_FORMAT
public static final int ENOTSUP_ALGORITHM
public static final int ENOTSUP_FORMAT
public static final int ENOTSUP_MODE
public static final int EKEYS_RDORINIT
public static final int EKEYSNO_NOTFOUND
public static final int EKEYSNO_OVERRANGE
public static final int EKEYS_DOWNLOAD
public static final int EKEYS_NOTDOWNLOAD
public static final int EKEYS_OUTOFSPACE
public static final int EKEYS_EXISTS
public static final int EENCRYPTKEYS_NOTDOWLOAD
public static final int ENOTSUP_SEPUSE
public static final int ENOTSUP_KEYSLENGTH
public static final int ERESERVED_0X1D
public static final int ENOTSUP_PINBLOCK_FORMAT
public static final int EUSERNAME_LENGTH
public static final int EUSERNAME_VALUE
public static final int EUSER_PINBLOCK_LENGTH
public static final int EUSER_PINBLOCK_VALUE
public static final int EPINBLOCK_CHAR
Constructor Detail |
---|
public SEManager()
Method Detail |
---|
public int open()
public int close()
public int getFirmwareVersion(byte[] ResponseData, byte[] ResLen)
ResponseData
- output data, processor response data ResLen
- output data, processor response data length public int getStatus(byte[] ResponseData, byte[] ResLen)
ResponseData
- output data, 5Bytes device status:
Byte[0] – maxium storage num of keys we support(The sum of all keys)
Byte[1] – used for mag strip info encryption(TDK)
Byte[2] – used for counting PIN keys
Byte[3] – num of MAC keys
Byte[4] – num of Master keys
#:
all num of keys is not greater than the sum of all keys(Byte[0]).ResLen
- output data, length of ResponseData, 5Bytes. public int clearKey(byte[] ResponseData, byte[] ResLen)
ResponseData
- output data, processor response data, this function
return data is NULL. ResLen
- output data, processor response data length, this function
return data length is 0. public int downloadKey(int KeyUsage, int KeyNo, int ParentKeyNo, byte[] KeyData, int KeyDataLen, byte[] ResponseData, byte[] ResLen)
KeyUsage
- input data, Key Usage:
0x01 - used for Mag strip info encryption(TDK)
0x02 - used for PIN encryption
0x03 - used for MAC calculation
0x04 - Parent(Master) key
0x05 - Reserved
0x06 - Reserved
0x07 – used for message transportation encryption KeyNo
- input data, Key number, 0 - 20.ParentKeyNo
- input data, Parent Key Number. when DownloadKey is used to
load parent key, this parameter can be ignore. Parent(Master) Key have
no parent key. KeyData
- input data, key data, this parameter have 8 bytes, 16 bytes or
24 bytes(3DES) KeyDataLen
- input data, Key Data length ResponseData
- output data, security processor response data, output KCV (with
clear key encryption 8 0x00 return value, get first 4 bytes) ResLen
- output data, security processor response data length public int deleteKey(int KeyUsage, int KeyNo, byte[] ResponseData, byte[] ResLen)
KeyUsage
- input data, Key Usage
0x01 - used for Mag strip info encryption(TDK)
0x02 - used for PIN encryption
0x03 - used for MAC calculation
0x04 - Parent(Master) key
0x05 - Reserved
0x06 - Reserved
0x07 – used for message transportation encryption KeyNo
- input data, Key index, 0 - 20.ResponseData
- output data, security processor response data, this function
return data is NULL. ResLen
- output data, security processor response data length, this function
return data length is 0. public int encryptData(int KeyUsage, int KeyNo, int Algorithm, byte[] StartValue, int StartValueLen, int PaddingChar, byte[] EncryptData, int EncryptDataLen, byte[] ResponseData, byte[] ResLen)
KeyUsage
- input data, Key Usage
0x01 - used for Mag strip info encryption(TDK)
0x02 - used for PIN encryption
0x03 - used for MAC calculation
0x04 - Parent(Master) key
0x05 - Reserved
0x06 - Reserved
0x07 – used for message transportation encryption KeyNo
- input data, Key index, 0 - 20.Algorithm
- input data, Algorithm define: 0x01(ECB) 0x02(CBC).StartValue
- input data, initialization vector, this value is
NULL(Algorithm = 0x01) or 8 bytes (Algorithm = 0x02).StartValueLen
- input data, initialization vector length.PaddingChar
- input data, padding character, value is 0x0 ~ 0xF.EncryptData
- input data, encryption data, length is 0 - 128 bytes. EncryptDataLen
- input data, encryption data length ResponseData
- output data, encrypted data return form security processor. ResLen
- output data, security processor response data length public int decryptData(int KeyUsage, int KeyNo, int Algorithm, byte[] StartValue, int StartValueLen, int PaddingChar, byte[] DecryptData, int DecryptDataLen, byte[] ResponseData, byte[] ResLen)
KeyUsage
- input data, Key Usage
0x01 - used for Mag strip info encryption(TDK)
0x02 - used for PIN encryption
0x03 - used for MAC calculation
0x04 - Parent(Master) key
0x05 - Reserved
0x06 - Reserved
0x07 – used for message transportation encryption KeyNo
- input data, Key index: 0 - 20.Algorithm
- input data, Algorithm define: 0x01(ECB) 0x02(CBC).StartValue
- input data, initialization vector, this value is
NULL(Algorithm = 0x01) or 8 bytes (Algorithm = 0x02).StartValueLen
- input data, initialization vector length.PaddingChar
- input data, padding character, value is 0x0 ~ 0xF.DecryptData
- input data, dencryption data, 0~128Bytes.DecryptDataLen
- input data, dencryption data length.ResponseData
- output data, dencrypted data returned from security processor ResLen
- output data, security processor response data length public int getPinBlock(int KeyUsage, int PINKeyNo, byte[] CustomerData, int CustomerDataLen, java.lang.String message, long timeOut, SEManager.PedInputListener listener)
KeyUsage
- input data, Key Usage
0x01 - used for Mag strip info encryption(TDK)
0x02 - used for PIN encryption
0x03 - used for MAC calculation
0x04 - Parent(Master) key
0x05 - Reserved
0x06 - Reserved
0x07 – used for message transportation encryptionPINKeyNo
- input data, Key index: 0 - 20.CustomerData
- input data, ASCII format Customer account, 0 - 24Bytes.CustomerDataLen
- input data, the length of CustomerDatamessage
- timeOut
- set the input key timeoutlistener
- The PedInputListener
that will be called when
a input key event is fired.public int getPinBlockEx(int KeyUsage, int PINKeyNo, byte[] CustomerData, int CustomerDataLen, java.lang.String message, long timeOut, java.lang.String supportPinLen, SEManager.PedInputListener listener)
KeyUsage
- input data, Key Usage
0x01 - used for Mag strip info encryption(TDK)
0x02 - used for PIN encryption
0x03 - used for MAC calculation
0x04 - Parent(Master) key
0x05 - Reserved
0x06 - Reserved
0x07 – used for message transportation encryptionPINKeyNo
- input data, Key index: 0 - 20.CustomerData
- input data, ASCII format Customer account, 0 - 24Bytes.CustomerDataLen
- input data, the length of CustomerDatamessage
- timeOut
- set the input key timeoutsupportPinLen
- set the input key support length, default format: "0,4,6,8,10,12"listener
- The PedInputListener
that will be called when
a input key event is fired.public int getPinBlockEx(android.os.Bundle bundle, SEManager.PedInputListener listener)
bundle
- is a Bundle obejctlistener
- The PedInputListener
that will be called when
a input key event is fired.public int generateRandomData(byte[] ResponseData, byte[] ResLen)
ResponseData
- output data, to store the generated 8 bytes random number ResLen
- bytes indicating the length of response data public int enableSuspend(int enable, byte[] ResponseData, byte[] ResLen)
enable
- indicates to enable or to disable the security processor suspend.ResponseData
- output data, security processor response data ResLen
- output data, security processor response data length public int setSuspendTimeout(int timeout, byte[] ResponseData, byte[] ResLen)
timeout
- The value of the timeout (in seconds) or 0 for infinite.ResponseData
- output data, security processor response data ResLen
- output data, security processor response data length
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |