Sample code for 30+ languages & platforms
Pascal (Lazarus/Delphi)

Load a Raw Ed25519 Public Key

Demonstrates the Chilkat PublicKey.LoadEd25519 method, which loads a raw Ed25519 public key from a hexadecimal string. The only argument must be exactly 64 hexadecimal characters (32 bytes).

Background: An Ed25519 public key is simply a fixed 32-byte value, so raw hex is a natural way to carry it — no ASN.1 container required. This loader takes those bytes directly, which is useful when a key comes from a system that emits raw values rather than a PEM or JWK. For a standard container, use LoadFromString or one of the DER/PEM loaders instead.

Chilkat Pascal (Lazarus/Delphi) Downloads

Pascal (Lazarus/Delphi)
program ChilkatDemo;

// Demonstrates using the Chilkat Pascal wrapper via the C bridge DLL.
// Builds as a console application under Lazarus (FPC) or Delphi.

{$IFDEF FPC}
  {$MODE DELPHI}
{$ENDIF}
{$APPTYPE CONSOLE}

uses
  {$IFDEF UNIX}
  cthreads,
  {$ENDIF}
  SysUtils,
  CkDllLoader,
  Chilkat.PublicKey;

// ---------------------------------------------------------------------------

procedure RunDemo;
var
  success: Boolean;
  pubKey: TPublicKey;
  pubKeyHex: string;

begin
  success := False;

  //  Demonstrates the PublicKey.LoadEd25519 method, which loads a raw Ed25519 public key from a
  //  hexadecimal string.  The only argument must be exactly 64 hexadecimal characters (32 bytes).

  pubKey := TPublicKey.Create;

  //  The 32-byte Ed25519 public key as 64 hex digits.
  pubKeyHex := 'd75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a';

  success := pubKey.LoadEd25519(pubKeyHex);
  if (success = False) then
    begin
      WriteLn(pubKey.LastErrorText);
      Exit;
    end;

  WriteLn('Loaded an Ed25519 public key.');


  pubKey.Free;

end;

// ---------------------------------------------------------------------------

begin

  try
    RunDemo;
  except
    on E: Exception do
      WriteLn('Unhandled exception: ', E.ClassName, ': ', E.Message);
  end;

  WriteLn;
  {$IFDEF MSWINDOWS}
  WriteLn('Press Enter to exit...');
  ReadLn;
  {$ENDIF}
end.