![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
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_9_5_0.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_9_5_0.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-2026 Chilkat Software, Inc. All Rights Reserved.