Archived Forum Post

Index of archived forum posts


Implementation of TLS connection on Credit Card

Nov 18 '14 at 09:36

I am using Chilkat to verify Verify SSL Server Certificate for credit card merchant warehouse API. I want to use TLS server connection fro credit card. Currently I am using your codebase in application. I want to change it by TLS connection. Could you provide any guidance?

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 Memo1.Lines.Add(socket.LastErrorText); Exit; end;

ssl := 1; maxWaitMillisec := 20000;

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

sslServerHost := ''; sslServerPort := 443;

// Connect to the SSL server: success := socket.Connect(sslServerHost,sslServerPort,ssl,maxWaitMillisec); if (success <> 1) then begin Memo1.Lines.Add(socket.LastErrorText); Exit; 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.Expired;
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));


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