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

Load PEM Public/Private Key into RSA Object

Demonstrates how to load a PEM key into the Chilkat RSA object.

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
rsa: TChilkatRsa;
success: Integer;
publicKeyPem: String;
pubkey: CHILKATCERTIFICATELib_TLB.IPublicKey;
publicKeyXml: String;
privateKeyPem: String;
privkey: CHILKATCERTIFICATELib_TLB.IPrivateKey;
privateKeyXml: String;

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;

//  First demonstrate importing a PEM public key:
publicKeyPem := 'PEM public-key data goes here';
pubkey := TpublicKey.Create(Self).ControlInterface;

success := pubkey.LoadOpenSslPem(publicKeyPem);
if (success <> 1) then
  begin
    Memo1.Lines.Add(pubkey.LastErrorText);
    Exit;
  end;

publicKeyXml := pubkey.GetXml();

success := rsa.ImportPublicKey(publicKeyXml);
if (success <> 1) then
  begin
    Memo1.Lines.Add(rsa.LastErrorText);
    Exit;
  end;

//  Demonstrate importing a PEM private key:
privateKeyPem := 'PEM private-key data goes here';
privkey := TprivateKey.Create(Self).ControlInterface;

//  If the private key PEM is protected with a password, then
//  call LoadEncryptedPem.  Otherwise call LoadPem.
success := privkey.LoadPem(privateKeyPem);
if (success <> 1) then
  begin
    Memo1.Lines.Add(privkey.LastErrorText);
    Exit;
  end;

privateKeyXml := privkey.GetXml();
success := rsa.ImportPrivateKey(privateKeyXml);
if (success <> 1) then
  begin
    Memo1.Lines.Add(rsa.LastErrorText);
    Exit;
  end;

ShowMessage('OK!');

end;

 

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

Mail Component · .NET Email Component · XML Parser