Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
Export All Certificates to .cer FilesDemonstrates how to export all certificates from a registry-based certificate store to .cer files where each filename is the serial number. uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, CHILKATCERTIFICATELib_TLB, OleCtrls; ... procedure TForm1.Button1Click(Sender: TObject); var ccs: TChilkatCreateCS; cs: CHILKATCERTIFICATELib_TLB.IChilkatCertStore; cert: IChilkatCert; numCerts: Integer; i: Integer; filename: String; begin ccs := TChilkatCreateCS.Create(Self); ccs.ReadOnly := 1; // Open the current-user certificate store: cs := ccs.OpenCurrentUserStore(); if (not (cs = nil )) then begin numCerts := cs.NumCertificates; // Print the distinguished name of each certificate for i := 0 to numCerts - 1 do begin cert := cs.GetCertificate(i) As IChilkatCert; filename := 'certs/' + cert.SerialNumber + '.cer'; cert.ExportCertDerFile(filename); end; end else begin ShowMessage(ccs.LastErrorText); end; end; |
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.