Delphi Examples

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

Delphi Examples

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

More Examples...
Amazon S3
Byte Array
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
Bzip2
LZW

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;

 

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

Mail Component · .NET Email Component · XML Parser