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

 

 

 

 

 

 

 

Create S/MIME Detached Signature with PFX

How to use a PFX to create a signed S/MIME message.

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

use chilkat();


$mime = new chilkat::CkMime();

$success = $mime->UnlockComponent("Anything for 30-day trial");
if ($success == 0) {
    print "Failed to unlock component" . "\n";
    exit;
}

$mime->AddHeaderField("Subject","This is a test");
$mime->AddHeaderField("Abc","123");

$mime->SetBodyFromPlainText("This is the body");

$certStore = new chilkat::CkCertStore();

$password = "myPassword";
$success = $certStore->LoadPfxFile("chilkat.pfx",$password);
if ($success == 0) {
    print $certStore->lastErrorText() . "\n";
    exit;
}

$cert = $certStore->FindCertBySubjectCN("Chilkat Software, Inc.");
if ($cert eq null ) {
    print "Failed to find certificate!" . "\n";
    exit;
}

#  Display the full distinguished name of the cert.
print $cert->subjectDN() . "\r\n";

$success = $mime->AddDetachedSignature($cert);
if ($success == 0) {
    print $mime->lastErrorText() . "\n";
    exit;
}

print $mime->getMime() . "\r\n";


 

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