Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#C# WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicPythonRubySQL ServerSwiftUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET WinRTVBScript

Delphi ActiveX Examples

Async
Certificates
Email Object
Encryption
FTP
HTML-to-XML/Text
Gzip
HTTP
IMAP
MHT / HTML Email
PEM
PFX/P12
Java KeyStore (JKS)
POP3
RSA Encryption
MIME
SCP
SMTP
Socket/SSL/TLS
SSH Key
SSH
SFTP
Tar Archive
XML
XMP
Zip

More Examples...
ASN.1
PRNG
Amazon S3
Bounced Email
CSV
Diffie-Hellman
DKIM / DomainKey
NTLM

 

 

 

 

 

 

 

(Delphi ActiveX) Generate RSA Public/Private Key

Delphi ActiveX example code showing how to generate an RSA public/private key.

Chilkat for Delphi Downloads

Chilkat ActiveX DLL for Delphi

Chilkat non-ActiveX DLL for Delphi

* The examples here use the ActiveX DLL.

uses
    Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
    Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Chilkat_v9_5_0_TLB;

...

procedure TForm1.Button1Click(Sender: TObject);
var
rsa: TChilkatRsa;
success: Integer;
publicKey: PWideChar;
privateKey: PWideChar;

begin
rsa := TChilkatRsa.Create(Self);

success := rsa.UnlockComponent('Anything for 30-day trial');
if (success <> 1) then
  begin
    Memo1.Lines.Add(rsa.LastErrorText);
    Exit;
  end;

//  Generate a 1024-bit key.  Chilkat RSA supports
//  key sizes ranging from 512 bits to 4096 bits.
//  Note: Starting in Chilkat v9.5.0.49, RSA key sizes can be up to 8192 bits.
//  It takes a considerable amount of time and processing power to generate
//  an 8192-bit key.
success := rsa.GenerateKey(1024);
if (success <> 1) then
  begin
    Memo1.Lines.Add(rsa.LastErrorText);
    Exit;
  end;

//  Keys are exported in XML format:
publicKey := rsa.ExportPublicKey();
Memo1.Lines.Add(publicKey);

privateKey := rsa.ExportPrivateKey();
Memo1.Lines.Add(privateKey);

end;

 

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