ASP Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

ASP Examples

ASP String
ASP Byte Array
Bounced Mail
Bz2
Character Encoding
CSV
Digital Certificates
Digital Signatures
Email
FTP
HTML-to-XML
HTTP
IMAP
Encryption
MHT / HTML Email
POP3
RSA
S/MIME
SMTP
Socket
Spider
SSH
SSH Tunnel
SSH Key
SFTP
Tar
ASP Upload
XML
XMP
Zip Compression

More Examples...
Email Object
DKIM / DomainKey
NTLM
DH Key Exchange
DSA
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
Bzip2
LZW

 

 

 

 

 

 

AES Encryption / Decryption in ASP

Download ASP Project Files and Source Code

Use 256-bit AES encryption to encrypt a string and then either Base64 encode it, Hex encode it (hexidecimalize), or encode to quoted-printable. Reverse the operation to get the original string back.

<%@ LANGUAGE="VBSCRIPT" %>
<HTML>
<HEAD>
<TITLE>AES Interop Example</TITLE>
</HEAD>
<BODY bgcolor="#FFFFFF">
<%
	' Create the Chilkat object.
	set aes = Server.CreateObject("AesInterop.AesInterop")

  ' Get a 30-day trial unlock code
  aes.UnlockComponent "unlockCode"

	' The password must be the same for decryption.
	aes.PassPhrase = "MySecretPassword"

	' Use 256-bit encryption
	aes.KeyLength = 256

	' Data to encrypt
	myData = "Chilkat Software, Inc."
%>

<h2><font color="#330099">1. AES Encrypt a String: &quot;Chilkat Software, Inc.&quot;</font></h2>
<h3>AES Encrypted and then Base64 Encoded:</h3>
<%
	strBase64 = aes.EncodeToBase64(aes.Encrypt(myData)) 
	Response.write strBase64
%>
<br><br>
<h3>AES Encrypted and then Hex-Encoded:</h3>
<%
	strHex = aes.EncodeToHex(aes.Encrypt(myData)) 
	Response.write strHex
%>
<br><br>
<h3>AES Encrypted and then Converted to Quoted-Printable:</h3>
<%
	strQP = aes.EncodeToQP(aes.Encrypt(myData)) 
	Response.write strQP
%>
<br><br>
<h2><font color="#330099">2. Decrypt Each String</font></h2>
<h3>Decode from Base64 and AES Decrypt:</h3>
<%
	str = aes.Decrypt(aes.DecodeFromBase64(strBase64))
	Response.write str
%>
<h3>Hex-Decode and then AES Decrypt:</h3>
<%
	str = aes.Decrypt(aes.DecodeFromHex(strHex))
	Response.write str
%>
<h3>QP-Decode and then AES Decrypt:</h3>
<%
	str = aes.Decrypt(aes.DecodeFromQP(strQP))
	Response.write str
%>

</BODY>
</HTML>


Relevant keywords:

        ASP Tutorial, ASP Script, ASP Application, ASP Software, ASP Code, ASP 
        Programming, ASP Component, Free ASP Script, ASP Email, ASP Help, ASP 
        Example, ASP Source Code, ASP Developer, ASP Mail, ASP XML, ASP Sample
 

Need a specific example? Send a request to support@chilkatsoft.com

© 2000-2010 Chilkat Software, Inc. All Rights Reserved.