ASP Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

ASP Examples

ASP String
ASP Byte Array
Bounced Mail
Bz2
Character Encoding
CSV
Digital Certificates
Digital Signatures
Email
FTP
HTML Conversion
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...
Amazon S3
Email Object
DKIM / DomainKey
NTLM
DH Key Exchange
DSA
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
Bzip2
LZW

 

 

 

 

 

 

AES Encrypt a File to a Base64 String

Download Chilkat Crypt ActiveX

Loads a file into memory and encrypts using 256-bit AES encryption and returns the result as a base64 string (i.e. the binary encrypted data is encoded to base-64).

<html>
<body>
<%
set crypt = CreateObject("Chilkat.Crypt2")
unlocked = crypt.UnlockComponent("Anything for 30-day trial")

' Use Chilkat Crypt's ReadFile method to load the entire contents
' of a file into a Variant (containing a byte array).
gifImageData = crypt.ReadFile(Server.MapPath("images/orval.gif"))

' Our secret key (in this example) is a 32-byte (256-bit) key
' already encoded in Base64.  We need to decode it to get the binary
' secret key:
crypt.CryptAlgorithm = "none"
crypt.EncodingMode = "base64"

keyStr = "dIDJu7fzCnwVpOX9yfXsPg=="
binaryKey = crypt.DecryptBytesEnc(keyStr)

' Now encrypt the GIF image data.
' We want 256-bit AES encryption.  (Why 256-bit?  Because our secret
' key is 256-bits long.  The length of the secret key must match the
' KeyLength
crypt.KeyLength = 256
crypt.SecretKey = binaryKey
crypt.CryptAlgorithm = "AES"
' We want the output to be a string containing the base64-encoding of the
' encrypted data.
crypt.EncodingMode = "base64"

' EncryptBytesEnc accepts bytes (a Variant) and returns an encoded string.
encryptedDataStr = crypt.EncryptBytesEnc(gifImageData)

Response.Write "<p>Base64: " + encryptedDataStr + "</p>"

%>
</body>
</html>
 

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