Sample code for 30+ languages & platforms
Delphi DLL

SSH Key Fingerprint

See more SSH Key Examples

Generates a fingerprint for an SSH key.

Chilkat Delphi DLL Downloads

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

...

procedure TForm1.Button1Click(Sender: TObject);
var
success: Boolean;
key: HCkSshKey;
keyStr: PWideChar;
fingerprint: PWideChar;

begin
success := False;

key := CkSshKey_Create();

// Load an SSH key from an encrypted OpenSSH-formatted private key:
CkSshKey_putPassword(key,'secret');

// First load the PEM into a string:
keyStr := CkSshKey__loadText(key,'privkey_openssh_encrypted.pem');

// Import into the SSH key object:
success := CkSshKey_FromOpenSshPrivateKey(key,keyStr);
if (success <> True) then
  begin
    Memo1.Lines.Add(CkSshKey__lastErrorText(key));
    Exit;
  end;

// Generate the fingerprint:

fingerprint := CkSshKey__genFingerprint(key);

Memo1.Lines.Add(fingerprint);

// A sample fingerpring looks like this:
// ssh-dss 2048 d0:5f:f7:d6:49:60:7b:50:19:f4:41:59:d4:1f:61:7

CkSshKey_Dispose(key);

end;