Perl Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

Perl Examples

Quick Start
Perl Unicode
Perl Byte Array
Perl Certs
Perl Email
Perl Encryption
Perl FTP
HTML-to-XML
Perl HTTP
Perl IMAP
Perl MHT
Perl MIME
Perl RSA
Perl S/MIME
Perl Signatures
Perl Socket
Perl Spider
Perl Tar
Perl Upload
Perl XML
Perl XMP
Perl Zip

More Examples...
String
Email Object
POP3
SMTP
RSS
Atom
Self-Extractor

Unreleased...
Service
PPMD
Deflate
Bzip2
LZW
Bz2
DH Key Exchange
DSA
Icon

 

 

 

 

 

 

 

Import Certificate into Windows Cert Store

Chilkat Module for Perl 5.8.*

Chilkat Module for Perl 5.10.*

Perl script to import a .cer file into a Windows registry certificate store.

# file: importCert.pl

use chilkat;

# Import a certificate from a .cer file to the current-user certificate store.
# The Current User cert store is located in the Windows registry and is specific
# to the logged-on user of the calling process.  .cer files do not contain private
# keys.  Therefore, certificates imported in this way can only be used for
# verifying signatures or encrypting data. (Not for creating signatures or
# decrypting data.)

# The CkCert, CkCertStore, and CkCreateCS are free utility classes that can be 
# used in any Perl application/script without the need to purchase a license.

$ccs = new chilkat::CkCreateCS();

# Open the current-user certificate store in read/write mode.
$ccs->put_ReadOnly(false);
$certStore = $ccs->OpenCurrentUserStore();

if ($certStore == null)
{
	$ccs->SaveLastError("lastError.txt");
	print "Failed to open current user certificate store\n";
}
else
{
	$cert = new chilkat::CkCert();
	$success = $cert->LoadFromFile("tagtooga.cer");
	if ($success)
	{
		$success = $certStore->AddCertificate($cert);
		if ($success)
		{
			print "Added certificate to certificate store!\n";
		}
		else
		{
			$certStore->SaveLastError("lastError.txt");
			print "Failed to add certificate to cert store\n";
		}
	}
	else
	{
		$cert->SaveLastError("lastError.txt");
		print "Failed to load .cer file\n";
	}
}





 

Need a specific example? Send a request to support@chilkatsoft.com

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