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 Java Signature

Demonstrates how to verify a digital signature produced by Java.
The Java code that produces a digital signature that can be verified with
this Chilkat example is found at: http://www.cknotes.com/?p=283

Download 32-bit Chilkat RSA ActiveX (.msi)

Download All 32-bit Chilkat ActiveX Components (.zip)

Download All 64-bit Chilkat ActiveX Components (.zip)

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

...

procedure TForm1.Button1Click(Sender: TObject);
var
pubKey: CHILKATCERTIFICATELib_TLB.IPublicKey;
success: Integer;
pkeyXml: String;
rsa: TChilkatRsa;
strData: String;
base64Sig: String;

begin

pubKey := TpublicKey.Create(Self).ControlInterface;

//  Load an RSA public key from an ASN.1 DER file
success := pubKey.LoadRsaDerFile('pubKey.der');

if (success <> 1) then
  begin
    Memo1.Lines.Add(pubKey.LastErrorText);
    Exit;
  end;

//  Get the public key in XML format:
pkeyXml := pubKey.GetXml();

rsa := TChilkatRsa.Create(Self);

//  Any string argument automatically begins the 30-day trial.
success := rsa.UnlockComponent('30-day trial');
if (success <> 1) then
  begin
    Memo1.Lines.Add(rsa.LastErrorText);
    Exit;
  end;

//  Import the public key into the RSA component:
success := rsa.ImportPublicKey(pkeyXml);
if (success <> 1) then
  begin
    Memo1.Lines.Add(rsa.LastErrorText);
    Exit;
  end;

rsa.EncodingMode := 'base64';

strData := 'The quick brown fox jumps over the lazy dog';

//  IMPORTANT:  This Base64 signature will have to be updated
//  with the digital signature produced by the Java code at:
//  http://www.cknotes.com/?p=283
base64Sig := 'VGV5A+bodHBpBwwJZdf17Bv+lkBTm/gteOf8iCgEEfNzBosZLaAB8X55BIZIkE2zKRXoMcJT+iCxsj+1hnlwJeKZ+Gya58lrHw6NWm2N0O/KyfnuEzADOM86X0xrkgdFT6SYpbZ9dWPC59NiHeEdVyjOXNJ3fBpUSQ5/5pvVWm0=';

//  Verify the signature produced by the Java code at:
//  http://www.cknotes.com/?p=283
//  The VerifyStringENC method hashes the input data and verifies
//  the hash against the signature.
success := rsa.VerifyStringENC(strData,'sha-1',base64Sig);
//  Is the signature verified?
if (success = 1) then
  begin
    Memo1.Lines.Add('Signature Verified!');
  end
else
  begin
    Memo1.Lines.Add('Signature not verified!');
  end;

end;

 

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

Mail Component · .NET Email Component · XML Parser