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

Convert DSA PEM Private Key to DER

Converts a DSA private key from PEM format to DER. The first part of the example will convert an unencrypted PEM to DER, then 2nd part will convert an encrypted PEM to unencrypted DER.

Download Chilkat DSA ActiveX

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

...

procedure TForm1.Button1Click(Sender: TObject);
var
success: Integer;
dsa: TChilkatDsa;
pemPrivateKey: String;

begin


dsa := TChilkatDsa.Create(Self);

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

//  Load a PEM private key.

pemPrivateKey := dsa.LoadText('dsa_priv.pem');
//  Import the unencrypted PEM into the DSA object.
success := dsa.FromPem(pemPrivateKey);
if (success <> 1) then
  begin
    ShowMessage(dsa.LastErrorText);
    Exit;
  end;

//  Write it out as a DER file:
success := dsa.ToDerFile('dsa_priv.der');
if (success <> 1) then
  begin
    ShowMessage(dsa.LastErrorText);
    Exit;
  end;

//  Load an encrypted PEM private key.
pemPrivateKey := dsa.LoadText('dsa_privEncrypted.pem');
//  Import the encrypted PEM into the DSA object.
success := dsa.FromEncryptedPem('myPassword',pemPrivateKey);
if (success <> 1) then
  begin
    ShowMessage(dsa.LastErrorText);
    Exit;
  end;

//  Write it out as an unencrypted DER file:
success := dsa.ToDerFile('dsa_priv2.der');
if (success <> 1) then
  begin
    ShowMessage(dsa.LastErrorText);
    Exit;
  end;

ShowMessage('Finished!');
end;

 

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

Mail Component · .NET Email Component · XML Parser