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

 

 

 

 

 

 

 

Load PFX (PKCS#12) and List Certificates

Loads a PFX file (.pfx, .p12) and iterates over the certificates found within.

Downloads for Windows/Linux and Install Instructions

require 'chilkat'

certStore = Chilkat::CkCertStore.new()

pfxPath = "/Users/chilkat/testData/pfx/chilkat_ssl.pfx"
pfxPassword = "test"
success = certStore.LoadPfxFile(pfxPath,pfxPassword)
if (success != true)
    print certStore.lastErrorText() + "\n";
    exit
end

numCerts = certStore.get_NumCertificates()

print "PFX contains " + numCerts.to_s() + " certificates" + "\n";

if (numCerts == 0)
    exit
end

for i in 0 .. (numCerts - 1)

    # cert is a CkCert
    cert = certStore.GetCertificate(i)
    if (!(cert == nil ))
        print i.to_s() + ": (Common Name) " + cert.subjectCN() + "\n";
        print i.to_s() + ": (Serial Number) " + 
            cert.serialNumber() + "\n";
        print i.to_s() + ": (Distinguished Name) " + 
            cert.subjectDN() + "\n";

    end

end
 

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