In ASP, RSA encryption and decryption are implemented through the VBS class. It is recommended to enter the essence
This article has two documents composition
test.asp test demonstration file
CLSRSA.ASP implements VBS files for RSA encryption and decryption
The following is the code:
1. test.asp
<%
REM article title: Implement RSA encryption and decryption through the VBS class in ASP
Rem collection and sorting: yanek
Rem contact: [Email Protected]
%>
<%Option Explicit%>
<!-#Include file = clsrsa.asp->
<%
dim lngkeye
dim lngkeyd
dim lngkeyn
dim Strmessage
dim objrsa
if not request.form = then
lngKeye = request.Form (keyee)
lngkeyd = request.form (keyd)
lngkeyn = request.form (keyn)
strmessage = request.form (message)
set objrsa = New CLSRSA
Select Case Request.Form (ACTION)
Case Generate Keys
call objrsa.genkey ()
lngKeye = Objrsa.publickey
lngKeyd = Objrsa.privatekey
lngkeyn = objrsa.modulus
case enCrypt
objrsa.publickey = lngkeye
objrsa.modulus = lngkeyn
Strmessage = Objrsa.encode (Strmessage)
Case Decrypt
objrsa.privatekey = lngkeyd
objrsa.modulus = lngkeyn
Strmessage = Objrsa.Decode (Strmessage)
end select
set objrsa = nothing
end if
%>
<html>
<head>
<Title> RSA CIPHER DEMONSTRATION </Title>
</head>
<body>
<H1> RSA CIPHER DEMONSTRATION </h1>
<p>
You Willst Need to Generate Your Public/Privage Key-Pair-Pair
Before you can encrYPT/Decrypt messages.
</p>
<FORM METHOD = Post>
<Table>
<tr>
<TD> Public Key </td>
<td> <input name = key value = <%= server.htmlencode (lngkeye)%>> </td>
<td rowspan = 3>
<input type = submit name = the action value = generate keys>
</td>
</tr>
<tr>
<TD> Private Key </td>
& nbs