<%@ Page Language="c#" EnableSessionState=true %><% //here we generate a random number Random randomGenerator = new Random(DateTime.Now.Millisecond); String RandData = ""; for(int i=0; i<19; i++) RandData += Convert.ToChar(randomGenerator.Next(97,122)); Session["Message"] = RandData; %><HTML> <HEAD> <TITLE>Logon - ePass 1000ND SDK Test [ASP.NET]</TITLE> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <STYLE TYPE="text/css"> <!-- @import "test.css"; --> </STYLE> <script language=VBScript> Dim FirstDigest Dim Digest Digest= "01234567890123456"dim bErrsub ShowErr(Msg) bErr = true MsgBox Msg ' Document.Writeln "<FONT COLOR='#FF0000'>" ' Document.Writeln "<P> </P><P> </P><P> </P><P ALIGN='CENTER'><B>ERROR:</B>" ' Document.Writeln "<P> </P><P ALIGN='CENTER'>" ' Document.Writeln Msg ' Document.Writeln " failed, and returns 0x" & hex(Err.number) & ".<br>" ' Document.Writeln "<P> </P><P> </P><P> </P>" ' Document.Writeln "</FONT>" End Subfunction Validate() Digest = "01234567890123456" On Error Resume Next Dim TheForm Set TheForm = Document.forms("ValidForm") If Len(TheForm.UserPIN.Value) < 4 Then MsgBox "PIN empty or user pin length less than 4 or so pin length less than 6!!" Validate = FALSE Exit Function End If bErr = false 'Let detecte whether the ePass 1000ND Safe Active Control loaded. 'If we call any method and the Err.number be set to &H1B6, it 'means the ePass 1000ND Safe Active Control had not be loaded. ePass.GetLibVersion If Err.number = &H1B6 Then ShowErr "Load ePass 1000ND Safe Active Control" Validate = false Exit function Else ePass.OpenDevice 1, ""
If Err then ShowErr "Open first ePass failed." Validate = false ePass.CloseDevice Exit function End if
'ePass.ResetSecurityState 0 dim results results = "01234567890123456" results = ePass.GetStrProperty(7, 0, 0) 'MsgBox results 'ePass.VerifyUserPIN TheForm.Identity.Value, TheForm.UserPIN.Value ePass.VerifyPIN 0, TheForm.UserPIN.Value If Err Then ShowErr "Verify User PIN Failure!!!" Validate = false ePass.CloseDevice Exit function End If If Not bErr Then ePass.ChangeDir &H300, 0, "ASP_DEMO" If Err then ShowErr "Change to demo directory" Validate = false ePass.CloseDevice Exit function End If End If 'Open the first key file. If Not bErr Then ePass.OpenFile 0, 1 If Err Then ShowErr "Open first KEY-file" Validate = false ePass.CloseDevice Exit function End If
End If 'Do HASH-MD5-HMAC compute. If Not bErr Then Digest = ePass.HashToken (1, 2,"<%=Session["Message"].ToString()%>") If Err Then ShowErr "HashToken compute" Validate = false ePass.CloseDevice Exit function End If DigestID.innerHTML = "<input type='hidden' name='Digest' Value='" & Digest & "'>" snID.innerHTML = "<input type='hidden' name='SN_SERAL' Value='" & results & "'>" End If
End If ePass.CloseDevice
End function </script></HEAD> <BODY>
<OBJECT classid=clsid:0272DA76-96FB-449E-8298-178876E0EA89 id=ePass name = ePass STYLE="LEFT: 0px; TOP: 0px" width=0 height=0></OBJECT><H1 ALIGN="center">ePass 1000ND Active Control<BR>Demo Program for ASP.NET</H1> <TABLE WIDTH="600" BORDER="0" ALIGN="center"> <TR> <TD> <P ALIGN="CENTER">Welcome to ePass 1000ND Active Control demonstration program for ASP.NET.</P> <SCRIPT id=clientEventHandlersVBS language=vbscript> <!-- 'Now you had get the result of HASH compute and the random data ' use to HASH compute. You should post these data to server and ' do verify operation. Document.Writeln "<P> </P><P ALIGN='CENTER'>To logon, you must input your PIN.</P>" Document.Writeln "<P> </P><P> </P></TD></TR><TR><TD>" Document.Writeln "<FORM id=ValidForm METHOD='post' ACTION='verify.aspx' onsubmit='return Validate();' language='jscript'>" 'Post the result of HASH compute by ePass can use by server. Document.Writeln "<span id=DigestID></span>" Document.Writeln "<span id=snID></span>" 'Create a table and let user input the user name and password. Document.Writeln "<TABLE WIDTH='250' BORDER='1' ALIGN='center' CELLSPACING='0' BORDERCOLORDARK='#E7EBFF' BORDERCOLORLIGHT='#000000'>" 'Document.Writeln "<TR><TD ALIGN='right'>Identity:</TD><TD>" 'Document.Writeln "<select name='Identity'>" 'Document.Writeln "<option value='0'>User PIN</option>" 'Document.Writeln "<option value='1'>So PIN</option>" 'Document.Writeln "</select>" Document.Writeln "</TD></TR>"
[email protected]
<%@ Page Language="c#" EnableSessionState=true %><%
//here we generate a random number
Random randomGenerator = new Random(DateTime.Now.Millisecond); String RandData = "";
for(int i=0; i<19; i++)
RandData += Convert.ToChar(randomGenerator.Next(97,122));
Session["Message"] = RandData;
%><HTML>
<HEAD>
<TITLE>Logon - ePass 1000ND SDK Test [ASP.NET]</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<STYLE TYPE="text/css">
<!--
@import "test.css";
-->
</STYLE>
<script language=VBScript>
Dim FirstDigest
Dim Digest
Digest= "01234567890123456"dim bErrsub ShowErr(Msg)
bErr = true
MsgBox Msg
' Document.Writeln "<FONT COLOR='#FF0000'>"
' Document.Writeln "<P> </P><P> </P><P> </P><P ALIGN='CENTER'><B>ERROR:</B>"
' Document.Writeln "<P> </P><P ALIGN='CENTER'>"
' Document.Writeln Msg
' Document.Writeln " failed, and returns 0x" & hex(Err.number) & ".<br>"
' Document.Writeln "<P> </P><P> </P><P> </P>"
' Document.Writeln "</FONT>"
End Subfunction Validate()
Digest = "01234567890123456"
On Error Resume Next
Dim TheForm
Set TheForm = Document.forms("ValidForm")
If Len(TheForm.UserPIN.Value) < 4 Then
MsgBox "PIN empty or user pin length less than 4 or so pin length less than 6!!"
Validate = FALSE
Exit Function
End If bErr = false 'Let detecte whether the ePass 1000ND Safe Active Control loaded.
'If we call any method and the Err.number be set to &H1B6, it
'means the ePass 1000ND Safe Active Control had not be loaded.
ePass.GetLibVersion
If Err.number = &H1B6 Then ShowErr "Load ePass 1000ND Safe Active Control"
Validate = false
Exit function
Else
ePass.OpenDevice 1, ""
If Err then
ShowErr "Open first ePass failed."
Validate = false
ePass.CloseDevice
Exit function
End if
'ePass.ResetSecurityState 0
dim results
results = "01234567890123456"
results = ePass.GetStrProperty(7, 0, 0)
'MsgBox results 'ePass.VerifyUserPIN TheForm.Identity.Value, TheForm.UserPIN.Value
ePass.VerifyPIN 0, TheForm.UserPIN.Value If Err Then
ShowErr "Verify User PIN Failure!!!"
Validate = false
ePass.CloseDevice
Exit function
End If
If Not bErr Then
ePass.ChangeDir &H300, 0, "ASP_DEMO"
If Err then
ShowErr "Change to demo directory"
Validate = false
ePass.CloseDevice
Exit function
End If
End If
'Open the first key file.
If Not bErr Then
ePass.OpenFile 0, 1
If Err Then
ShowErr "Open first KEY-file"
Validate = false
ePass.CloseDevice
Exit function
End If
End If 'Do HASH-MD5-HMAC compute.
If Not bErr Then
Digest = ePass.HashToken (1, 2,"<%=Session["Message"].ToString()%>")
If Err Then
ShowErr "HashToken compute"
Validate = false
ePass.CloseDevice
Exit function
End If
DigestID.innerHTML = "<input type='hidden' name='Digest' Value='" & Digest & "'>"
snID.innerHTML = "<input type='hidden' name='SN_SERAL' Value='" & results & "'>"
End If
End If ePass.CloseDevice
End function
</script></HEAD>
<BODY>
<OBJECT classid=clsid:0272DA76-96FB-449E-8298-178876E0EA89 id=ePass name = ePass STYLE="LEFT: 0px; TOP: 0px" width=0 height=0></OBJECT><H1 ALIGN="center">ePass 1000ND Active Control<BR>Demo Program for ASP.NET</H1>
<TABLE WIDTH="600" BORDER="0" ALIGN="center">
<TR>
<TD>
<P ALIGN="CENTER">Welcome to ePass 1000ND Active Control demonstration program for ASP.NET.</P>
<SCRIPT id=clientEventHandlersVBS language=vbscript>
<!--
'Now you had get the result of HASH compute and the random data
' use to HASH compute. You should post these data to server and
' do verify operation.
Document.Writeln "<P> </P><P ALIGN='CENTER'>To logon, you must input your PIN.</P>"
Document.Writeln "<P> </P><P> </P></TD></TR><TR><TD>"
Document.Writeln "<FORM id=ValidForm METHOD='post' ACTION='verify.aspx' onsubmit='return Validate();' language='jscript'>" 'Post the result of HASH compute by ePass can use by server. Document.Writeln "<span id=DigestID></span>"
Document.Writeln "<span id=snID></span>" 'Create a table and let user input the user name and password.
Document.Writeln "<TABLE WIDTH='250' BORDER='1' ALIGN='center' CELLSPACING='0' BORDERCOLORDARK='#E7EBFF' BORDERCOLORLIGHT='#000000'>"
'Document.Writeln "<TR><TD ALIGN='right'>Identity:</TD><TD>"
'Document.Writeln "<select name='Identity'>"
'Document.Writeln "<option value='0'>User PIN</option>"
'Document.Writeln "<option value='1'>So PIN</option>"
'Document.Writeln "</select>"
Document.Writeln "</TD></TR>"
Document.Writeln "<TR><TD ALIGN='right'>User PIN:</TD><TD><INPUT TYPE='password' NAME='UserPIN' CLASS='inputtext'></TD></TR>"
Document.Writeln "</TABLE><P> </P><P ALIGN='center'>"
Document.Writeln "<INPUT TYPE='submit' NAME='Submit' VALUE='Let me in' CLASS='inputbtn'>"
Document.Writeln "<INPUT TYPE='reset' NAME='Reset' VALUE='Re-input' CLASS='inputbtn'></P></FORM>"
-->
</SCRIPT> </TD>
</TR>
</TABLE>
<H2> </H2>
<P> </P>
<P ALIGN="center">Copyright© 2003-2009,Feitian Tech. Co. Ltd.</P>
</BODY>
</HTML>