云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > 数字证书在WEB应用中登录

数字证书在WEB应用中登录

  • 62 次阅读
  • 3 次下载
  • 2025/7/3 14:32:53

var certs= mystore.Certificates; //myca sign certs // varmycacerts= certs;

varmycacerts= new ActiveXObject(\ for(i=1;i<=certs.Count;i++) {

//check issuer

var issuer=certs.Item(i).IssuerName; if(issuer.indexOf(\//not myca continue; //check key usage

varku=certs.Item(i).KeyUsage();

if(!ku.IsDigitalSignatureEnabled) //not sign cert continue; //add

mycerts.Add(certs.Item(i)); }

if(mycerts.Count==0) {

if(window.confirm(\没有找到MYCA签发的证书,/r/n请插入相应的Ekey再按确定\

returnSelectMySignCert(); else

return null; }

//select cert

varcertsel= mycerts.Select(\选择证书\请选择证书:\ if(certsel==null)return null; var cert= certsel.Item(1); // cert.Display(); return cert; }

functionSignText(strtext)

{

//select cert

varmysigncert= SelectMySignCert(); if(mysigncert==null)return null; //signed data

var signer = new ActiveXObject(\ signer.Certificate = mysigncert;

varsigneddata = new ActiveXObject(\ varutils = new ActiveXObject(\ signeddata.Content = utils.BinaryStringToByteArray(strtext); returnsigneddata.Sign(signer,false,CAPICOM_ENCODE_BASE64); } /*

var signature= SignText(\WScript.Echo(signature); */

登录页面(login.aspx)

<%@ Page Language=\ <%

Random rnd = new Random(); byte[] buff = new byte[18]; rnd.NextBytes(buff);

string challenge = Convert.ToBase64String(buff); Session[\%>

登录页面

{

var signature= SignText(\ if(signature==null)return; form1.passport.value= signature;

form1.submit(); }

http://download.microsoft.com/download/E/1/8/E18ED994-8005-4377-A7D7-0A8E13025B94/capicom.cab #version=2,0,0,3\

classid=\

3.2.2服务端

JDK1.5中自带的JCE并不支持PKCS#7,.net framework是支持的。

登录判断逻辑(verify.aspx)

<%@ Page Language=\

<%@ Import Namespace=\

<%@ Import Namespace=\ <%

string challenge = (string)Session[\ Session[\ if(challenge==null){

Response.Write(\没有随机数\

return; }

string p = Request.Form[\

byte[] cmsDer = Convert.FromBase64String(p); SignedCmscms = new SignedCms(); try{

cms.Decode(cmsDer); cms.CheckSignature(true); }catch(Exception e){

Response.Write(e.Message); return; }

string challenge2 = Encoding.Default.GetString(cms.ContentInfo.Content); if (challenge.Equals(challenge2)) {

Response.Write(\随机数不匹配
\// Response.Write(challenge + \ return; }

Response.Write(\登录成功\ return; %>

3数字证书与现有用户帐户的绑定

用户用数字证书登录后。WEB应用提供一个帐户绑定页面,页面提示用户输入原用户名和口令。后台再验证用户提交的用户名和口令,通过验证后,把该用户/口令对应的用户ID和用户的登录证书摘要写入到一个数据库表。流程:

以后用户使用该证书登录时,可以从数据库表查询到该证书对应的用户ID,系统给以该用户ID登录。

搜索更多关于: 数字证书在WEB应用中登录 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

var certs= mystore.Certificates; //myca sign certs // varmycacerts= certs; varmycacerts= new ActiveXObject(\ for(i=1;i<=certs.Count;i++) { //check issuer var issuer=certs.Item(i).IssuerName; if(issuer.indexOf(\//not myca continue; //check key usage var

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com