Delphi Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

Delphi Examples

Bounced Mail
Bz2
Character Encoding
CSV
Digital Certificates
Digital Signatures
DH Key Exchange
DSA
Email
Email Object
FTP
HTML-to-XML
HTTP
IMAP
Encryption
MHT / HTML Email
POP3
RSA
S/MIME
SMTP
Socket
Spider
SFTP
SSH
SSH Key
SSH Tunnel
String
Tar
Upload
XML
XMP
Zip Compression

More Examples...
Byte Array
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate

Unreleased...
Bzip2
LZW
Icon

Type Conversion

 

Article: Understanding COM References in Delphi

Verify SSL Server Certificate

Demonstrates how to connect to an SSL server and verify its SSL certificate.

Download Chilkat Socket ActiveX

uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, StdCtrls,
    CHILKATCERTIFICATELib_TLB,
    CHILKATSOCKETLib_TLB,
    OleCtrls;

...

procedure TForm1.Button1Click(Sender: TObject);
var
socket: TChilkatSocket;
success: Integer;
ssl: Integer;
maxWaitMillisec: Integer;
sslServerHost: String;
sslServerPort: Integer;
cert: CHILKATSOCKETLib_TLB.IChilkatCert;
bExpired: Integer;
bRevoked: Integer;
bSignatureVerified: Integer;
bTrustedRoot: Integer;

begin
socket := TChilkatSocket.Create(Self);

success := socket.UnlockComponent('Anything for 30-day trial');
if (success <> 1) then
  begin
    ShowMessage('Failed to unlock component');

  end;

ssl := 1;
maxWaitMillisec := 20000;

//  The SSL server hostname may be an IP address, a domain name,
//  or "localhost".

sslServerHost := 'www.paypal.com';
sslServerPort := 443;

//  Connect to the SSL server:
success := socket.Connect(sslServerHost,sslServerPort,ssl,maxWaitMillisec);
if (success <> 1) then
  begin
    ShowMessage(socket.LastErrorText);

  end;

cert := socket.GetSslServerCert() As CHILKATSOCKETLib_TLB.IChilkatCert;
if (not (cert = nil )) then
  begin

    Memo1.Lines.Add('Server Certificate:');
    Memo1.Lines.Add('Distinguished Name: ' + cert.SubjectDN);
    Memo1.Lines.Add('Common Name: ' + cert.SubjectCN);
    Memo1.Lines.Add('Issuer Distinguished Name: '
         + cert.IssuerDN);
    Memo1.Lines.Add('Issuer Common Name: ' + cert.IssuerCN);

    bExpired := cert.IsExpired();
    bRevoked := cert.Revoked;
    bSignatureVerified := cert.SignatureVerified;
    bTrustedRoot := cert.TrustedRoot;

    Memo1.Lines.Add('Expired: ' + IntToStr(bExpired));
    Memo1.Lines.Add('Revoked: ' + IntToStr(bRevoked));
    Memo1.Lines.Add('Signature Verified: ' + IntToStr(bSignatureVerified));
    Memo1.Lines.Add('Trusted Root: ' + IntToStr(bTrustedRoot));

  end;

//  Close the connection with the server
//  Wait a max of 20 seconds (20000 millsec)
socket.Close(20000);


end;

 

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

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

Mail Component · .NET Email Component · XML Parser