本帖最后由 hadwin_Y4Wm5 于 2016-5-11 19:30 编辑
您好,示例中参数为1个,请问参数为两个是否同样适用?
[JavaScript] 纯文本查看 复制代码 function filterAndSign(oriToSign, certs) {
var arrayCerts = filterCerts("CN=JD.COM End User CA, OU=JD.COM Security Center, O=JD.COM", 0, "");
var signCert;
var type = 0;
var arrayCN = new Array();
arrayCN = certs.split(",");
if (typeof arrayCerts[0] != "undefined") {
for (var i = 0; i < arrayCerts.length; i++) {
if (typeof arrayCN[0] != "undefined") {
for (var j = 0; j < arrayCN.length; j++) {
if ((type != 1) && equalsIgnoreCase(arrayCerts[i].SerialNumber, arrayCN[j])) {
signCert = arrayCerts[i];
type = 1;
break;
}
}
} else {
return "";
}
}
} else {
return "";
}
if(typeof signCert != "undefined") {
var signedData = signMessage(oriToSign,signCert);
return [signCert.SerialNumber,signedData];
} else {
return "";
}
}
|