Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
|
|
ASP Encrypt AES String Encryption / Decryption Functions
Functions for string-to-string AES encryption / decryption in ASP. <html>
<body>
<%
function encryptString(passwordStr, toBeEncryptedStr)
Set crypt = Server.CreateObject("Chilkat.Crypt2")
crypt.UnlockComponent "Anything for 30-day trial"
crypt.CryptAlgorithm = "aes"
crypt.CipherMode = "cbc"
crypt.KeyLength = 128
crypt.SecretKey = crypt.GenerateSecretKey(passwordStr)
crypt.EncodingMode = "base64"
encryptString = crypt.EncryptStringENC(toBeEncryptedStr)
end function
function decryptString(passwordStr, toBeDecryptedStr)
Set crypt = Server.CreateObject("Chilkat.Crypt2")
crypt.UnlockComponent "Anything for 30-day trial"
crypt.CryptAlgorithm = "aes"
crypt.CipherMode = "cbc"
crypt.KeyLength = 128
crypt.SecretKey = crypt.GenerateSecretKey(passwordStr)
crypt.EncodingMode = "base64"
decryptString = crypt.DecryptStringENC(toBeDecryptedStr)
end function
Response.Write "<p>Encrypt: Hello World!</p>"
encryptedStr = encryptString("secret","Hello World!")
Response.Write "<p>Encrypted: " & Server.HtmlEncode(encryptedStr) & "</p>"
Response.Write "<p>Decrypted: " & Server.HtmlEncode(decryptString("secret",encryptedStr)) & "</p>"
%>
</body>
</html>
|
© 2000-2012 Chilkat Software, Inc. All Rights Reserved.