XX公司的CA,与平台融合解决方法。。。。。
1,jsp 的编写要求
<script language="javascript" type="text/javascript">
var clientCertID;
var selectedID; //p10数据包的解析项 //获取客户端签名证书
function GetClientCertID(){
clientCertID=CASecurityClient.SOF_GetUserList();
var aaa = clientCertID.split("&&&");
//alert("验证口令-->" + CASecurityClient.SOF_Login(aaa[0],"111111"));
//alert("userINfo-->" + CASecurityClient.SOF_GetUserInfo(aaa[0],1));
document.getElementById("ClientCertID").value=clientCertID;
} //客户端签名
function ClientSign(){
clientCertID=CASecurityClient.SOF_GetUserList();
var certText=CASecurityClient.SOF_ExportUserCert(clientCertID);
document.getElementById("certInfo").value=certText;
// 写死这个数值就可以 0x00000021 -->意思是取整个证书拥有者DN
var selectedValue="0x00000021";
var certTypeText=CASecurityClient.SOF_GetCertInfo(certText,parseInt(selectedValue));
//alert("证书主题项:" + certTypeText);
var part = certTypeText.split(",");
var userId; for ( var i = 0; i < part.length; i++) {
var par = /^\s+/;
var strRes = part[i].replace(par, '');
/* if (strRes.indexOf("OU=ID") == 0) {
//取得OU用户账号
userId = strRes.substr(5, strRes.length);
alert("userid is:" + userId);
} */
if (strRes.indexOf("OU=I") == 0&&strRes.indexOf("OU=ID") != 0) {
//取得OU用户身份证号
userId = strRes.substr(4, strRes.length);
//alert("userid is:" + userId);
} } document.getElementById("ClientCertID").value = userId;
var cipherText=CASecurityClient.SOF_SignDataByP7(clientCertID,userId);
if(cipherText==""){
alert("客户端签名失败!");
return;
}
//ClientSignP7.action = "login.do?type=2&cipherText="+cipherText;
//ClientSignP7.submit();
var certInfo = $("#certInfo").val();
var url = "<%=request.getContextPath()%>"+"/loginCheck.do";
$.ajax({
type: "post",
async:true,
global:false,
url: url,
dataType:"json",
data:{"userId":userId,"type":2,"cipherText":cipherText,"certInfo":certInfo},
success: function(data) {
//BaseUtils.hideWaitMsg();
/* var ret = jQuery.parseJSON(data); */
if(data.flag){
//BaseUtils.showWaitMsg();
console.log(data);
window.location.href="mltreeInfo/forMain_shiji.do"; }else{
alert(data.msg);
}
}
});
}
</script>
前台的接受验证与后台ajax对象相关联,
2,重要之处:
<head></head>与<body></body>之间添加
<OBJECT ID="CASecurityClient"
CLASSID="CLSID:F8119DB1-73CB-49F7-8559-2B5EDD869D2A"
style="LEFT: 0px; WIDTH: 1px; TOP: 0px; HEIGHT: 1px" height="1"
width="1"></OBJECT>
3,LoginController添加:
public RetObj loginCheck(HttpServletRequest request, HttpServletResponse response, String userId,String password,Boolean remember,String validCode,String type,String cipherText,String certInfo) {
System.out.println("-------------------"+cipherText+"=============="+type);
if(cipherText!=""&&cipherText!=null){
try {
cipherText = EscapeUnescape.unescape(cipherText);//获取客户端签名值
//配置SVS服务器地址
//SVSClient svsClient = new SVSClient("60.216.5.244", "9189"); --------测试地址
SVSClient svsClient = new SVSClient("10.1.6.188", "9188");
//验证客户端签名,包括证书、签名值
NetoneSVS sss= svsClient.verifyPKCS7(cipherText);
if(sss.getStatusCode()!=200){
System.out.println("错误码为:"+sss.getStatusCode() + "/n验签名结果:"+sss.getStatusCodeMessage());
return new RetObj(false);
}else{
System.out.println("验签名成功");
}
System.out.println("原文信息为-->"+new Base64decode().decodeBase64(sss.getOrginalBase64()));
获取验证信息,根据自己的封装处理的需要变化
XX公司的CA,与平台融合解决方法。。。。。的更多相关文章
- spark+hadoop+sqoop+hive平台bug解决方法
bug集锦 1. hadoop平台datanode无法启动: 原因: 由于多次hdfs namenode -format导致dfs/data/current/version中的cluserID与当前的 ...
- HTTPConnectionPool(host:XX)Max retries exceeded with url 解决方法
爬虫多次访问同一个网站一段时间后会出现错误 HTTPConnectionPool(host:XX)Max retries exceeded with url '<requests.package ...
- 关于线程间操作无效: 从不是创建控件“xx”的线程访问它,错误解决方法(自定义委托和系统委托Action或Func解决)
这是一个线程不安全的问题.跨线程操作问题. 比如我们需要在线程中改变textbox的文本,textbox的name是txtShowMsg 第一种方法(不推荐使用) 在窗体构造函数中写Control.C ...
- Spring Boot Maven Plugin打包异常及三种解决方法:Unable to find main class
[背景]spring-boot项目,打包成可执行jar,项目内有两个带有main方法的类并且都使用了@SpringBootApplication注解(或者另一种情形:你有两个main方法并且所在类都没 ...
- 关于4A网络安全管控平台控件加载失败的解决方法
最近电脑重装系统后,到公司登录4A管控平台提示"控件加载失败","无效的参数为:Null","点击资源无任何反映"等等问题 别人的电脑用的好 ...
- 关于广州xx公司对驰骋BPM, 流程引擎表单引擎 常见问题解答
关于广州xx公司对驰骋BPM, 流程引擎表单引擎 常见问题解答 @驰骋工作流,ccflow周朋 周总早, ccflow 功能很强大,在体验过程中,以下几个问题需沟通下: 先使用.net 再使用java ...
- 使用AS编译jni文件无法编译出arm64-v8a,x86_64和mips64平台的.so文件的解决方法
我用的插件版本是:classpath 'com.android.tools.build:gradle-experimental:0.4.0',AS集成和使用ndk编译项目参考官方demo:https: ...
- 记录在xx公司被考核的15天及自己的感想
在大学有两件事让我很遗憾. 第一:在2013年7月我和自己的前任女朋友分手,这是两年前的事了,我们谈了七个月. 第二:在2015年4月我被xx公司淘汰了,正如我的前任女朋友是我遇到的最好女孩,这家公司 ...
- mssql server 2005还原数据库bak文件与“备份集中的数据库备份与现有的xx数据库不同”解决方法
mssql server 2005还原数据库bak文件,网站使用虚拟主机建站会经常遇到,一般情况下,主机商有在线的管理程序,但有时候没有的话,就需要本地还原备份sql数据库了.这种情况mssql se ...
随机推荐
- BZOJ5059 前鬼后鬼的守护 【堆扩展】*
BZOJ5059 前鬼后鬼的守护 Description 八云紫的式神八云蓝有一张符卡名为[式神-前鬼后鬼的守护],这张符卡的弹幕为BOSS从两侧向自机发射大玉,大玉后面跟着一些小玉,形成一个&quo ...
- 错误:'class QApplication' has no member named 'setMainwidget'
错误:'class QApplication' has no member named 'setMainwidget' 转自:http://blog.csdn.net/chenqiai0/articl ...
- LeetCode 773. Sliding Puzzle
原题链接在这里:https://leetcode.com/problems/sliding-puzzle/description/ 题目: On a 2x3 board, there are 5 ti ...
- grpc gateway 使用以及docker compose 集成
1. grpc gateway 安装 参考,比较简单,有需要的依赖可以参考相资料 mkdir tmp cd tmp git clone https://github.com/google/protob ...
- <>这个符号表示泛型的意思
<>这个符号表示泛型的意思,泛型不是类而是类的模版 为什么是模版 这就与这个T有关了,如List<T> 这个T只是一个占位符,可以代表任意类型如 List<string& ...
- jstl_core标签库
先导入这个 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 1 & ...
- 嵌入式无法使用QAudioDeviceInfo类
修改: 1.修改pro文件 增加 QT += multimedia 2.修改Makefile文件,LIBS = $(SUBLIBS) -L/opt/qt-4.8.5/lib -lQtMulti ...
- Oracle条件分支查询
Oracle的条件分支查询其实跟java的条件分支语法没啥太大的区别,只不过java多了一个switch关键字而已.看例子: SQL ELSE SUM(t1.TOTALTICKET) END tota ...
- for, while的用法
for循环求1+2+3+4+....+100 # include <stdio.h> int main(void) { int i; //循环中更新的变量i不能定义成浮点型 ; ; i&l ...
- demo 记录 通用方法什么的到这里抄一下
function killerrors() { return true; } window.onerror = killerrors; //检查浏览器类型 function checkBrowser( ...