RSA encryption and decryption through the VBS class in ASP, recommended into the essence

Source: Internet
Author: User
Tags decrypt modulus
Encryption | decryption | Essence in ASP through the VBS class to achieve RSA encryption and decryption, recommended into the essence

This article consists of two documents
Test.asp Test Demo file
Clsrsa.asp to implement RSA encryption and decryption of the VBS class file
Here's the code:

1. test.asp

<%
REM Article title: Implementing RSA Encryption and decryption via the VBS class in ASP
REM Collection and collation: Yanek
REM Contact: aspboy@263.net

%>
<%option explicit%>
<!--#INCLUDE file= "clsrsa.asp"-->
<%

Dim Lngkeye
Dim Lngkeyd
Dim Lngkeyn
Dim strmessage
Dim Objrsa
If Not Request.Form = "" Then

Lngkeye = Request.Form ("Keye")
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>
<P>
You'll need to generate your public/privage Key-pair
Before you can encrypt/decrypt messages.
</P>
<form method= "POST" >
<TABLE>
<TR>
<td>public key</td>
<td><input name= "Keye" value= "<%=server.htmlencode (lngkeye)%>" ></TD>
&LT;TD rowspan= "3" >
<input type= "Submit" name= "Action" value= "Generate Keys" >
</TD>
</TR>
<TR>
<td>private key</td>
&nbs



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.