Perl Examples

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

Perl Examples

Quick Start
Unicode
Byte Array
Bz2
Certificates
CSV
Email
Encryption
FTP
HTML Conversion
HTTP
IMAP
MHT
MIME
POP3
RSA
S/MIME
Signatures
SMTP
Socket / SSL
Spider
SFTP
SSH Key
SSH
SSH Tunnel
Tar
HTTP Upload
XML
XMP
Zip

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

 

 

 

 

 

 

 

AES Encryption in CBC Mode, w/ Initialization Vector, PKCS5 Padding

 Chilkat Perl Module Downloads for Windows, Linux, and MAC OS X

Demonstrates encrypting a string in Perl using AES encryption and encoding the resultant binary encrypted data in a base64 string.

Download Perl Programming Example Scripts

# file: aesEncrypt.pl

use chilkat;

# Perl AES Encryption Example Script
$crypt = new chilkat::CkCrypt2();
$crypt->UnlockComponent("anything for 30-day trial");
    
$crypt->put_CryptAlgorithm("aes");
# Use cipher block chaining (CBC) mode
$crypt->put_CipherMode("cbc");
# Use 128-bit encryption
$crypt->put_KeyLength(128);
# Set the initialization vector.
$crypt->SetEncodedIV("000102030405060708090A0B0C0D0E0F","hex");
# Set the secret key.
$crypt->SetEncodedKey("000102030405060708090A0B0C0D0E0F","hex");
# Encoding the encrypted bytes in base64
$crypt->put_EncodingMode("base64");
# Use the default padding scheme (PKCS5 Padding)
$crypt->put_PaddingScheme(0);

$encryptedStr = new chilkat::CkString();
$crypt->EncryptStringENC("Hello World!",$encryptedStr);

# Output is: qiq+IFhcjTkEIkZyf31V/g==
print "Encrypted: " . $encryptedStr->getString() . "\n";

$decryptedStr = new chilkat::CkString();
$crypt->DecryptStringENC($encryptedStr->getString(),$decryptedStr);

print "Decrypted: " . $decryptedStr->getString() . "\n";






 

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