Python Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript



Python Examples

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

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

 

 

 

 

 

 

 

Import Digital Certificate into Windows Registry Certificate Store

Python script to load a .cer file and import the digital certificate into the current-user certificate store.

Download Python Programming Example Scripts

# file: importCert.py

import 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 Ruby application/script without the need to purchase a license.

ccs = chilkat.CkCreateCS()

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

if certStore == None:
	ccs.SaveLastError("lastError.txt")
	print "Failed to open current user certificate store\n"
else:
	cert = 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-2010 Chilkat Software, Inc. All Rights Reserved.