1612 lines
35 KiB
JavaScript
1612 lines
35 KiB
JavaScript
/**
|
||
* Description: 通用Ukey的js接口
|
||
* Author: paulhou(houenchao)
|
||
* Version: V1.1
|
||
* Create: 2019/3/22 13:56
|
||
*/
|
||
var initurl = "http://127.0.0.1:8090/do";
|
||
var keyType = 4;
|
||
var ppid = 0;//sm3 hash时默认id
|
||
jQuery.support.cors=true;
|
||
if (isIE()&&isSSL()) {
|
||
initurl = "https://127.0.0.1:433/do";
|
||
//alert(initurl);
|
||
}
|
||
function isSSL() {
|
||
var url = window.location.href;
|
||
if (url.indexOf("https")!=-1) {
|
||
return true;
|
||
}
|
||
return false;
|
||
}
|
||
function isIE() {
|
||
var userAgent = navigator.userAgent;
|
||
//alert(userAgent);
|
||
var isIE = userAgent.indexOf("NET") > -1 && userAgent.indexOf("rv") > -1 ;
|
||
isIE = isIE || (userAgent.indexOf("MSIE") > -1);
|
||
return isIE;
|
||
}
|
||
|
||
var FISECKEY = {
|
||
OpenDevice : function(index, keyType) {
|
||
var handle = 0;
|
||
$.ajax({
|
||
url : initurl,
|
||
type : "post",
|
||
dataType : "json",
|
||
data : {
|
||
order : '01000001',
|
||
index : index
|
||
},
|
||
async : false,
|
||
success : function(data) {
|
||
if (0 == data.rev) {
|
||
handle = data.hdev;
|
||
} else {
|
||
throw new Error("设备打开失败:" + FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
return handle;
|
||
},
|
||
CloseDevice : function(hDev) {
|
||
$.ajax({
|
||
url : initurl,
|
||
type : "post",
|
||
dataType : "json",
|
||
data : {
|
||
order : '01000002',
|
||
hdevice : hDev
|
||
},
|
||
async : false,
|
||
success : function(data) {
|
||
if (0 == data.rev) {
|
||
handle = 0;
|
||
} else {
|
||
throw new Error("设备关闭失败:" + FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
},
|
||
OpenByName : function(devName, keyType, devID) {
|
||
var handle = 0;
|
||
$.ajax({
|
||
url : initurl,
|
||
type : "post",
|
||
dataType : "json",
|
||
data : {
|
||
order : '01000003',
|
||
devName : devName,
|
||
devID : devID
|
||
},
|
||
async : false,
|
||
success : function(data) {
|
||
if (0 == data.rev) {
|
||
handle = data.hdev;
|
||
} else {
|
||
throw new Error("设备打开失败:" + FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
return handle;
|
||
},
|
||
OpenBySerial : function(devSerial, keyType) {
|
||
var handle = 0;
|
||
$.ajax({
|
||
url : initurl,
|
||
type : "post",
|
||
dataType : "json",
|
||
data : {
|
||
order : '01000004',
|
||
devSerial : devSerial
|
||
},
|
||
async : false,
|
||
success : function(data) {
|
||
if (0 == data.rev) {
|
||
handle = data.hdev;
|
||
} else {
|
||
throw new Error("设备打开失败:" + FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
return handle;
|
||
},
|
||
EnumByArray : function() {
|
||
var result = null;
|
||
$.ajax({
|
||
url : initurl,
|
||
type : "post",
|
||
dataType : "json",
|
||
data : {
|
||
order : '01000005'
|
||
},
|
||
async : false,
|
||
success : function(data) {
|
||
if (0 == data.rev) {
|
||
result = data.EnumDeviceNameList;
|
||
} else {
|
||
throw new Error("设备枚举失败:" + FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
return result;
|
||
},
|
||
EnumByName : function() {
|
||
var result = null;
|
||
$.ajax({
|
||
url : initurl,
|
||
type : "post",
|
||
dataType : "json",
|
||
data : {
|
||
order : '01000006'
|
||
},
|
||
async : false,
|
||
success : function(data) {
|
||
if (0 == data.rev) {
|
||
result = data.EnumDeviceNameList;
|
||
} else {
|
||
throw new Error("设备枚举失败:" + FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
return result;
|
||
},
|
||
EnumBySerial : function() {
|
||
var result = null;
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000007'
|
||
},
|
||
async : false,
|
||
success : function(data) {
|
||
if (0 == data.rev) {
|
||
result = data.EnumDeviceSerelList;
|
||
} else {
|
||
throw new Error("设备枚举失败:" + FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
return result;
|
||
},
|
||
GetInfo : function(hDev,flag,inBuf) {
|
||
var result = null;
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000008',
|
||
hdevice: hDev
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 == data.rev) {
|
||
result = data.info;
|
||
return result;
|
||
} else {
|
||
throw new Error("设备信息获取失败:" +FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
},
|
||
SetDevName : function(hDev, devName) {
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000009',
|
||
hdevice:hDev,
|
||
devName:devName
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 != data.rev) {
|
||
throw new Error("设置设备名称失败:"+FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
},
|
||
GetDevName : function(hDev) {
|
||
var result = null;
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000063',
|
||
hdevice:hDev
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 == data.rev) {
|
||
result = data.devname;
|
||
} else {
|
||
throw new Error("获取设备名称失败:"+FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
return result;
|
||
},
|
||
GenRandom : function(hDev, len) {
|
||
var result;
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000010',
|
||
hdevice:hDev,
|
||
len:len
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 == data.rev) {
|
||
result = data.ranData;
|
||
} else {
|
||
throw new Error("生成随机数失败:" +FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
return result;
|
||
},
|
||
|
||
GenRSAKeypair : function(hDev, flag, keyLength, keyNum) {
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000011',
|
||
hdevice:hDev,
|
||
flag:flag,
|
||
keyNum:keyNum,
|
||
keyLen:keyLength
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 != data.rev) {
|
||
throw new Error("RSA密钥对生成失败:"+FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
},
|
||
|
||
DelRSAKeypair : function(hDev, keyNum) {
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000012',
|
||
hdevice:hDev,
|
||
keyNum:keyNum
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 != data.rev) {
|
||
throw new Error("RSA密钥对删除失败:"+FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
},
|
||
|
||
ImportRSAKey : function(hDev, keyNum, keyLength, flag, vRsakey) {
|
||
$.ajax({
|
||
url : initurl,
|
||
type : "post",
|
||
dataType : "json",
|
||
data : {
|
||
order : '01000013',
|
||
hdevice : hDev,
|
||
keyNum : keyNum,
|
||
keyLen : keyLength,
|
||
flag : flag,
|
||
key : vRsakey
|
||
},
|
||
async : false,
|
||
success : function(data) {
|
||
if (0 != data.rev) {
|
||
throw new Error("RSA密钥对导入失败:"
|
||
+ FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
},
|
||
ExportRSAKey : function(hDev, keyNum) {
|
||
var result;
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000014',
|
||
hdevice:hDev,
|
||
keyNum:keyNum
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 == data.rev) {
|
||
result = data.pubkey;
|
||
} else {
|
||
throw new Error("RSA密钥对导出失败:"
|
||
+ FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
return result;
|
||
},
|
||
ExportRSAKeyBase64 : function(hDev, keyNum) {
|
||
var result;
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000058',
|
||
hdevice:hDev,
|
||
keyNum:keyNum
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 == data.rev) {
|
||
result = data.pubkey;
|
||
} else {
|
||
throw new Error("RSA密钥对导出失败:"
|
||
+ FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
return result;
|
||
},
|
||
RSAEncrypt : function(hDev, keyNum, inData) {
|
||
var result;
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000015',
|
||
hdevice:hDev,
|
||
keyNum:keyNum,
|
||
inData:inData
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 == data.rev) {
|
||
result = data.enData;
|
||
} else {
|
||
throw new Error("RSA加密失败:"
|
||
+ FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
return result;
|
||
},
|
||
|
||
RSADecrypt : function(hDev, keyNum, inData) {
|
||
var result;
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000016',
|
||
hdevice:hDev,
|
||
keyNum:keyNum,
|
||
inData:inData
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 == data.rev) {
|
||
result = data.decData;
|
||
} else {
|
||
throw new Error("RSA解密失败:"
|
||
+ FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
return result;
|
||
},
|
||
|
||
RSASignData : function(hDev, keyNum, inData) {
|
||
var result;
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000017',
|
||
hdevice:hDev,
|
||
keyNum:keyNum,
|
||
inData:inData
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 == data.rev) {
|
||
result = data.sigData;
|
||
} else {
|
||
throw new Error("RSA签名失败:"
|
||
+ FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
return result;
|
||
},
|
||
|
||
RSAVerify : function(hDev, keyNum, vHashAlg, inData, vSignData) {
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000018',
|
||
hdevice:hDev,
|
||
keyNum:keyNum,
|
||
alg:vHashAlg,
|
||
inData:inData,
|
||
signData:vSignData
|
||
},
|
||
async : false,
|
||
success : function(data) {
|
||
if (0 != data.rev) {
|
||
throw new Error("RSA验签失败:" + FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
},
|
||
|
||
Hash : function(hDev, vHashAlg, inData) {
|
||
var result;
|
||
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000019',
|
||
hdevice:hDev,
|
||
flag:vHashAlg,
|
||
inData:inData
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 == data.rev) {
|
||
result = data.digest;
|
||
}else {
|
||
throw new Error("哈希运算失败:" + FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
return result;
|
||
},
|
||
|
||
SM3Data : function(hDev, keyNum, inData) {
|
||
var result;
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000020',
|
||
hdevice:hDev,
|
||
keyNum:keyNum,
|
||
inData:inData
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 == data.rev) {
|
||
result = data.digest;
|
||
}else {
|
||
throw new Error("SM3运算失败:" + FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
return result;
|
||
},
|
||
|
||
GenECCKeypair : function(hDev, vAlg, vKeyBits, keyNum) {
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000040',
|
||
hdevice:hDev,
|
||
alg:vAlg,
|
||
keyNum:keyNum,
|
||
keyLen:vKeyBits
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 != data.rev) {
|
||
throw new Error("ECC密钥对生成失败:" + FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
},
|
||
|
||
DelECCKeypair : function(hDev, keyNum) {
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000041',
|
||
hdevice:hDev,
|
||
keyNum:keyNum,
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 != data.rev) {
|
||
throw new Error("ECC密钥对生成失败:" + FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
},
|
||
|
||
ImportECCKeypair : function(hDev, keyNum, keyLength, flag, vStrECCPubkey,
|
||
vStrECCPrikey) {
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000042',
|
||
hdevice:hDev,
|
||
keyNum:keyNum,
|
||
priKey:vStrECCPrikey,
|
||
pubKey:vStrECCPubkey
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 != data.rev) {
|
||
throw new Error("ECC密钥对导入失败:" + FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
},
|
||
|
||
ExportECCKeypair : function(hDev, keyNum) {
|
||
var result;
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000043',
|
||
hdevice:hDev,
|
||
keyNum:keyNum
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 == data.rev) {
|
||
result = data.keyData;
|
||
} else {
|
||
throw new Error("ECC密钥对导出失败:" + FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
return result;
|
||
},
|
||
|
||
ECCEncrypt : function(hDev, alg, keyNum, inData) {
|
||
var result;
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000044',
|
||
hdevice:hDev,
|
||
keyNum:keyNum,
|
||
inData:inData
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 == data.rev) {
|
||
result = data.enData;
|
||
} else {
|
||
throw new Error("ECC加密失败:" + FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
return result;
|
||
},
|
||
|
||
ECCDecrypt : function(hDev, alg, keyNum, inData) {
|
||
var result;
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000045',
|
||
hdevice:hDev,
|
||
keyNum:keyNum,
|
||
inData:inData
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 == data.rev) {
|
||
result = data.decData;
|
||
} else {
|
||
throw new Error("ECC解密失败:" + FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
return result;
|
||
},
|
||
|
||
ECCEncryptDer : function(hDev, alg, keyNum, inData) {
|
||
var result;
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000065',
|
||
hdevice:hDev,
|
||
keyNum:keyNum,
|
||
inData:inData
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 == data.rev) {
|
||
result = data.enDataDer;
|
||
} else {
|
||
throw new Error("ECC加密失败:" + FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
return result;
|
||
},
|
||
|
||
ECCDecryptDer : function(hDev, alg, keyNum, inData) {
|
||
var result;
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000066',
|
||
hdevice:hDev,
|
||
keyNum:keyNum,
|
||
inData:inData
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 == data.rev) {
|
||
result = data.decData;
|
||
} else {
|
||
throw new Error("ECC解密失败:" + FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
return result;
|
||
},
|
||
|
||
ECCSign : function(hDev, alg, keyNum, inData) {
|
||
var result;
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000046',
|
||
hdevice:hDev,
|
||
keyNum:keyNum,
|
||
inData:inData,
|
||
alg:alg
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 == data.rev) {
|
||
result = data.sigData;
|
||
} else {
|
||
throw new Error("ECC签名失败:" + FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
return result;
|
||
},
|
||
|
||
ECCVerify : function(hDev, vAlg, keyNum, inData, vSignData) {
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000047',
|
||
hdevice:hDev,
|
||
keyNum:keyNum,
|
||
alg:vAlg,
|
||
inData:inData,
|
||
signData:vSignData
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 != data.rev) {
|
||
throw new Error("ECC验签失败:" + FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
},
|
||
|
||
ContainerWriteCert : function(hDev, vFlag, vContainerName, vCertData) {
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000061',
|
||
hdevice:hDev,
|
||
cintainer:vContainerName,
|
||
flag:vFlag,
|
||
cert:vCertData
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 != data.rev) {
|
||
throw new Error("证书写入失败:" + FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
},
|
||
|
||
ContainerReadCert : function(hDev, vFlag, vContainerName) {
|
||
var result;
|
||
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000062',
|
||
hdevice:hDev,
|
||
cintainer:vContainerName,
|
||
flag:vFlag
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 == data.rev) {
|
||
result = data.data;
|
||
} else {
|
||
throw new Error("证书读取失败:" + FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
return result;
|
||
},
|
||
|
||
ContainerEnum : function(hDev) {
|
||
var result;
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000052',
|
||
hdevice:hDev
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 == data.rev) {
|
||
result = data.conlist;
|
||
} else {
|
||
throw new Error("证书容器枚举失败:" + FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
return result;
|
||
},
|
||
|
||
ContainerDelete : function(hDev, vContainerName) {
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000051',
|
||
hdevice:hDev,
|
||
cintainer:vContainerName
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 != data.rev) {
|
||
throw new Error("证书容器删除失败:" + FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
},
|
||
|
||
USER_Login : function(hDev, vstrPin) {
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000027',
|
||
hdevice:hDev,
|
||
pin:vstrPin
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 == data.rev) {
|
||
result = data.rev;
|
||
}else{
|
||
var pinErr = "" + data.rev.toString(16);
|
||
if(pinErr.match(/.*\83$/)){
|
||
throw new Error("用户PIN码错误,剩余尝试次数:" + data.count);
|
||
}else{
|
||
throw new Error("用户登录失败," + FISECERR.getErrMsg(data.rev));
|
||
}
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
return 0;
|
||
},
|
||
|
||
USER_Logout : function(hDevice, vuser) {
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000028',
|
||
hdevice:hDevice,
|
||
user:vuser
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 != data.rev) {
|
||
throw new Error("用户登出失败:" + FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
},
|
||
|
||
ADMIN_Login : function(hDev, vstrPin) {
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000064',
|
||
hdevice:hDev,
|
||
pin:vstrPin
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 == data.rev) {
|
||
result = data.rev;
|
||
}else{
|
||
var pinErr = "" + data.rev.toString(16);
|
||
if(pinErr.match(/.*\83$/)){
|
||
throw new Error("管理员PIN码错误,剩余尝试次数:" + data.count);
|
||
}else{
|
||
throw new Error("管理员登录失败," + FISECERR.getErrMsg(data.rev));
|
||
}
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
},
|
||
|
||
ADMIN_Logout : function(hDevice, vuser) {
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000028',
|
||
hdevice:hDevice,
|
||
user:vuser
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 == data.rev) {
|
||
alert("管理员登出成功")
|
||
} else {
|
||
alert("管理员登出失败");
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
},
|
||
|
||
USER_ChangePin : function(hDev, vflag, vstrOldPin, vstrNewPin) {
|
||
//vflag 1修改操作员口令2修改管理员口令3解锁
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000029',
|
||
hdevice:hDev,
|
||
flag:vflag,
|
||
oldPin:vstrOldPin,
|
||
pin:vstrNewPin
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 != data.rev) {
|
||
if (!(1001==data.rev || 1002==data.rev)) {
|
||
throw new Error("修改PIN码失败,剩余重试次数:"+ data.count);
|
||
} else {
|
||
throw new Error("修改PIN码错误:"+FISECERR.getErrMsg(data.rev));
|
||
}
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
},
|
||
|
||
GenKey : function(hDev, vAlg, index) {
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000022',
|
||
hdevice:hDev,
|
||
alg:vAlg,
|
||
keyNum:index
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 != data.rev) {
|
||
throw new Error("对称密钥生成失败:"+FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
},
|
||
|
||
DelKey : function(hDevice, index) {
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000023',
|
||
hdevice:hDevice,
|
||
keyNum:index
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 != data.rev) {
|
||
throw new Error("对称密钥删除失败:"+FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
},
|
||
|
||
ImportKey : function(hDevice, viAlg, vstrKey,index) {
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000021',
|
||
hdevice:hDevice,
|
||
alg:viAlg,
|
||
keyNum:index,
|
||
key:vstrKey
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 != data.rev) {
|
||
throw new Error("对称密钥导入失败:"+FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
},
|
||
|
||
Encrypt : function(hDevice, alg, index, vWorkMode, vstrIn, vstrIv, vstrKey) {
|
||
var result;
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000025',
|
||
hdevice:hDevice,
|
||
alg:alg,
|
||
keyNum:index,
|
||
mode:vWorkMode,
|
||
inData:vstrIn,
|
||
iv:vstrIv,
|
||
inKey:vstrKey
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 == data.rev) {
|
||
result = data.enData;
|
||
} else {
|
||
throw new Error("对称加密失败:"+FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
|
||
return result;
|
||
},
|
||
|
||
Decrypt : function(hDevice, alg, index, vWorkMode, vstrChiper, vstrIv, vstrKey) {
|
||
var result;
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000026',
|
||
hdevice:hDevice,
|
||
alg:alg,
|
||
keyNum:index,
|
||
mode:vWorkMode,
|
||
inData:vstrChiper,
|
||
iv:vstrIv,
|
||
inKey:vstrKey
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 == data.rev) {
|
||
result = data.decData;
|
||
} else {
|
||
throw new Error("对称解密失败:"+FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
|
||
return result;
|
||
},
|
||
|
||
FILE_Init : function(hDevice) {
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000031',
|
||
hdevice:hDevice
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 != data.rev) {
|
||
throw new Error("文件初始化失败:"+FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
|
||
},
|
||
|
||
FILE_CreateDir : function(hDevice, vstrDir, vdwAccCon) {
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000032',
|
||
hdevice:hDevice,
|
||
dir:vstrDir,
|
||
acc:vdwAccCon
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
|
||
if (0 != data.rev) {
|
||
throw new Error("路径创建失败:"+FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
},
|
||
|
||
FILE_CreateFile : function(hDevice, vstrDir, vstrfile, vdwSize, vdwAccCon) {
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000034',
|
||
hdevice:hDevice,
|
||
dir:vstrDir,
|
||
file:vstrfile,
|
||
size:vdwSize,
|
||
acc:vdwAccCon
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 != data.rev) {
|
||
throw new Error("文件创建失败:"+FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
},
|
||
|
||
FILE_DeleteDir : function(hDevice, vstrDir) {
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000033',
|
||
hdevice:hDevice,
|
||
dir:vstrDir
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 != data.rev) {
|
||
throw new Error("路径删除失败:"+FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
},
|
||
|
||
FILE_DeleteFile : function(hDevice, vstrDir, vstrfile) {
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000037',
|
||
hdevice:hDevice,
|
||
dir:vstrDir,
|
||
file:vstrfile
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 != data.rev) {
|
||
throw new Error("文件删除失败:"+FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
},
|
||
|
||
FILE_EnmuDir : function(hDevice, vstrDir) {
|
||
var dirlist = "";
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000038',
|
||
hdevice:hDevice,
|
||
dir:vstrDir
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 == data.rev) {
|
||
dirlist = data.data;
|
||
}else{
|
||
throw new Error("路径枚举失败:"+FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
return dirlist;
|
||
},
|
||
|
||
FILE_EnmuFile : function(hDevice, vstrDir) {
|
||
var dirlist = "";
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000039',
|
||
hdevice:hDevice,
|
||
dir:vstrDir
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 == data.rev) {
|
||
dirlist = data.data;
|
||
}else{
|
||
throw new Error("文件枚举失败:"+FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
return dirlist;
|
||
},
|
||
|
||
FILE_ReadFile : function(hDevice, vstrDir, vstrfile, vdwOffSet, vdwSize) {
|
||
var result;
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000035',
|
||
hdevice:hDevice,
|
||
dir:vstrDir,
|
||
file:vstrfile,
|
||
offset:vdwOffSet,
|
||
size:vdwSize
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 == data.rev) {
|
||
result = data.data;
|
||
} else {
|
||
throw new Error("文件读取失败:" + FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
return result;
|
||
},
|
||
|
||
FILE_WriteFile : function(hDevice, vstrDir, vstrfile, vdwOffSet, vdwSize,
|
||
vstrData) {
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
dataType:"json",
|
||
data : {
|
||
order: '01000036',
|
||
hdevice:hDevice,
|
||
dir:vstrDir,
|
||
file:vstrfile,
|
||
offset:vdwOffSet,
|
||
size:vdwSize,
|
||
input:vstrData
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 != data.rev) {
|
||
throw new Error("文件写入失败:" + FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
},
|
||
|
||
FILE_GetInfo : function(hDevice, vstrDir, vstrfile) {
|
||
var result;
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
data : {
|
||
order: '01000053',
|
||
hdevice: hDevice,
|
||
vstrDir: vstrDir,
|
||
vstrfile: vstrfile
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
if (0 == data.rev) {
|
||
result = data.fileinfo;
|
||
} else {
|
||
throw new Error("文件获取信息失败:" + FISECERR.getErrMsg(data.rev));
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
return result;
|
||
},
|
||
|
||
getSerialAndSubjects : function(hDevice) {
|
||
var result;
|
||
$.ajax({
|
||
url: initurl,
|
||
type : "post",
|
||
data : {
|
||
order: '01000054',
|
||
hdevice:hDevice
|
||
},
|
||
async : false,
|
||
success : function(data){
|
||
result = data.sersublist;
|
||
},
|
||
error : function(XMLHttpRequest, textStatus) {
|
||
throw new Error(XMLHttpRequest.status + ";" + textStatus);
|
||
}
|
||
});
|
||
return result;
|
||
}
|
||
}
|
||
|
||
var FISECERR = {
|
||
getErrMsg : function(errCode) {
|
||
switch(errCode) {
|
||
case 0x001:
|
||
return "fail";
|
||
case 0x002:
|
||
return "part ok";
|
||
case 0x003:
|
||
return "unknown error";
|
||
case 0x005:
|
||
return "error parameter";
|
||
case 0x006:
|
||
return "error right";
|
||
case 0x007:
|
||
return "device busy";
|
||
case 0x008:
|
||
return "operation timeout";
|
||
case 0x009:
|
||
return "no mem";
|
||
case 0x00a:
|
||
return "no resouce";
|
||
case 0x00b:
|
||
return "communication error";
|
||
case 0x00c:
|
||
return "register access error";
|
||
case 0x00d:
|
||
return "stack is overflow";
|
||
case 0x00e:
|
||
return "device is used now";
|
||
case 0x00f:
|
||
return "open session is out of range";
|
||
case 0x010:
|
||
return "dma read error";
|
||
case 0x011:
|
||
return "dma write error";
|
||
case 0x012:
|
||
return "create sync objcect error";
|
||
case 0x013:
|
||
return "get sync objcect error";
|
||
case 0x014:
|
||
return "release sync objcect error";
|
||
case 0x015:
|
||
return "data length error";
|
||
case 0x016:
|
||
return "key length error or not support";
|
||
case 0x017:
|
||
return "dev not close";
|
||
case 0x0a0:
|
||
return "key is not exist";
|
||
case 0x0a1:
|
||
return "no free key handle";
|
||
case 0x0a2:
|
||
return "key handle is out of range";
|
||
case 0x0a3:
|
||
return "alg step err(init/update/final) ";
|
||
case 0x100:
|
||
return "iv length error";
|
||
case 0x180:
|
||
return "ECC not init";
|
||
case 0x181:
|
||
return "ECC pubkey error";
|
||
case 0x182:
|
||
return "ECC prikey error";
|
||
case 0x183:
|
||
return "ECC sign error";
|
||
case 0x184:
|
||
return "ECC verify error";
|
||
case 0x185:
|
||
return "ECC encrypt error";
|
||
case 0x186:
|
||
return "ECC decrypt error";
|
||
case 0x187:
|
||
return "ECC decrypt verify error";
|
||
case 0x188:
|
||
return "ECC agreement error";
|
||
case 0x200:
|
||
return "SM3 user'ID length is out of range";
|
||
case 0x240:
|
||
return "file system is not init";
|
||
case 0x241:
|
||
return "dir nested too deep";
|
||
case 0x242:
|
||
return "dir is not exist";
|
||
case 0x243:
|
||
return "file is not exist";
|
||
case 0x244:
|
||
return "dir has already exist";
|
||
case 0x245:
|
||
return "file has already exist";
|
||
case 0x246:
|
||
return "dir number is out of range";
|
||
case 0x247:
|
||
return "file number is out of range";
|
||
case 0x248:
|
||
return "file space is not enough";
|
||
case 0x249:
|
||
return "file operation is out of range";
|
||
case 0x260:
|
||
return "flash operation is timeout";
|
||
case 0x261:
|
||
return "flash write error";
|
||
case 0x262:
|
||
return "flash read error";
|
||
case 0x263:
|
||
return "flash operation is out of range";
|
||
case 0x264:
|
||
return "eeprom operation is timeout";
|
||
case 0x265:
|
||
return "eeprom write error";
|
||
case 0x266:
|
||
return "eeprom read error";
|
||
case 0x267:
|
||
return "eeprom operation is out of range";
|
||
case 0x280:
|
||
return "user is not exist";
|
||
case 0x281:
|
||
return "user has already exist";
|
||
case 0x282:
|
||
return "user number is out of range";
|
||
case 0x283:
|
||
return "user pin err";
|
||
case 0x284:
|
||
return "backup step err";
|
||
case 0x285:
|
||
return "open user dev err";
|
||
case 0x286:
|
||
return "get user dev info err";
|
||
case 0x287:
|
||
return "write user dev mem err";
|
||
case 0x288:
|
||
return "read user dev mem err";
|
||
case 0x289:
|
||
return "user is not login";
|
||
case 0xF902005:
|
||
return "PIN码长度范围8-16";
|
||
default:
|
||
return "not support";
|
||
}
|
||
}
|
||
}
|