Ruby Examples

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

Ruby
Examples

Quick Start
Unicode
Byte Array
Bz2
Certificates
CSV
Email
Encryption
FTP
HTML Conversion
HTTP
IMAP
MHT
MIME
POP3
RSA
S/MIME
Signatures
SFTP
SMTP
Socket / SSL
Spider
SSH
SSH Key
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
Bzip2
DH Key Exchange
DSA
LZW

 

 

 

 

 

 

 

Import Certificate to Windows Registry Store

Downloads for Windows/Linux and Install Instructions

Imports a digital certificate from a .cer file into the Windows current-user certificate store.

# file: importCert.rb

require 'rubygems'
require '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.new()

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

if certStore == nil
	ccs.SaveLastError("lastError.xml")
	print "Failed to open current user certificate store\n"
else
	cert = Chilkat::CkCert.new()
	success = cert.LoadFromFile("example.cer")
	if success
		success = certStore.AddCertificate(cert)
		if success
			print "Added certificate to certificate store!\n"
		else
			certStore.SaveLastError("lastError.xml")
			print "Failed to add certificate to cert store\n"
		end
	else
		cert.SaveLastError("lastError.xml")
		print "Failed to load .cer file\n"
	end	
end






 

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