unit Chilkat.Dsa;

{
  Pascal wrapper for Chilkat Dsa.
  Auto-generated by PascalWrapperGenerator -- do not edit manually.
}

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

interface

uses
  SysUtils,
  Chilkat.Base;

type

  { TDsa wraps CkDsa via the C bridge layer. }
  TDsa = class(TChilkatBase)
  private
    function  GetLastErrorHtml: string;
    function  GetLastErrorText: string;
    function  GetLastErrorXml: string;
    function  GetVersion: string;
    function  GetDebugLogFilePath: string;
    procedure SetDebugLogFilePath(AValue: string);
    function  GetVerboseLogging: Boolean;
    procedure SetVerboseLogging(AValue: Boolean);
    function  GetLastMethodSuccess: Boolean;
    procedure SetLastMethodSuccess(AValue: Boolean);
    function  GetGroupSize: Integer;
    procedure SetGroupSize(AValue: Integer);
    function  GetHash: TBytes;
    procedure SetHash(AValue: TBytes);
    function  GetHexG: string;
    function  GetHexP: string;
    function  GetHexQ: string;
    function  GetHexX: string;
    function  GetHexY: string;
    function  GetSignature: TBytes;
    procedure SetSignature(AValue: TBytes);
    function  GetUncommonOptions: string;
    procedure SetUncommonOptions(AValue: string);
  public
    constructor Create;
    destructor  Destroy; override;

    property LastErrorHtml: string read GetLastErrorHtml;
    property LastErrorText: string read GetLastErrorText;
    property LastErrorXml: string read GetLastErrorXml;
    property Version: string read GetVersion;
    property DebugLogFilePath: string read GetDebugLogFilePath write SetDebugLogFilePath;
    property VerboseLogging: Boolean read GetVerboseLogging write SetVerboseLogging;
    property LastMethodSuccess: Boolean read GetLastMethodSuccess write SetLastMethodSuccess;
    property GroupSize: Integer read GetGroupSize write SetGroupSize;
    property Hash: TBytes read GetHash write SetHash;
    property HexG: string read GetHexG;
    property HexP: string read GetHexP;
    property HexQ: string read GetHexQ;
    property HexX: string read GetHexX;
    property HexY: string read GetHexY;
    property Signature: TBytes read GetSignature write SetSignature;
    property UncommonOptions: string read GetUncommonOptions write SetUncommonOptions;

    function  FromDerFile(const path: string): Boolean;
    function  FromEncryptedPem(const password: string; const pemData: string): Boolean;
    function  FromPem(const pemData: string): Boolean;
    function  FromPublicDerFile(const path: string): Boolean;
    function  FromPublicPem(const pemData: string): Boolean;
    function  FromXml(const xmlKey: string): Boolean;
    function  GenKey(numBits: Integer): Boolean;
    function  GenKeyFromParamsDerFile(const path: string): Boolean;
    function  GenKeyFromParamsPem(const pem: string): Boolean;
    function  GenKeyFromParamsPemFile(const path: string): Boolean;
    function  GetEncodedHash(const encoding: string): string;
    function  GetEncodedSignature(const encoding: string): string;
    function  LoadText(const path: string): string;
    function  SaveText(const strToSave: string; const path: string): Boolean;
    function  SetEncodedHash(const encoding: string; const encodedHash: string): Boolean;
    function  SetEncodedSignature(const encoding: string; const encodedSig: string): Boolean;
    function  SetEncodedSignatureRS(const encoding: string; const encodedR: string; const encodedS: string): Boolean;
    function  SetKeyExplicit(groupSizeInBytes: Integer; const pHex: string; const qHex: string; const gHex: string; const xHex: string): Boolean;
    function  SetPubKeyExplicit(groupSizeInBytes: Integer; const pHex: string; const qHex: string; const gHex: string; const yHex: string): Boolean;
    function  SignHash: Boolean;
    function  ToDerFile(const path: string): Boolean;
    function  ToEncryptedPem(const password: string): string;
    function  ToPem: string;
    function  ToPublicDerFile(const path: string): Boolean;
    function  ToPublicPem: string;
    function  ToXml(bPublicOnly: Boolean): string;
    function  Verify: Boolean;
    function  VerifyKey: Boolean;
    function  GenKey2(keyLenBits: Integer; modLenBits: Integer): Boolean;
    function  GenKeyFromPQG(const pHex: string; const qHex: string; const gHex: string): Boolean;
    function  FromDerBd(bd: TChilkatBase): Boolean;
    function  FromPublicDerBd(bd: TChilkatBase): Boolean;
    function  GenKeyFromParamsDerBd(bd: TChilkatBase): Boolean;
    function  ToDerBd(bd: TChilkatBase): Boolean;
  end;

implementation

uses
  CkDllLoader,
  Chilkat.Utils;

{ ---- C bridge function pointer types ---- }
type
  TCkDsa_Create  = function(): Pointer; cdecl;
  TCkDsa_Dispose = procedure(handle: Pointer); cdecl;
  TCkDsa_get_LastErrorHtml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkDsa_get_LastErrorText = function(handle: Pointer): PAnsiChar; cdecl;
  TCkDsa_get_LastErrorXml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkDsa_get_Version = function(handle: Pointer): PAnsiChar; cdecl;
  TCkDsa_get_DebugLogFilePath = function(handle: Pointer): PAnsiChar; cdecl;
  TCkDsa_put_DebugLogFilePath = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkDsa_get_VerboseLogging = function(handle: Pointer): LongBool; cdecl;
  TCkDsa_put_VerboseLogging = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkDsa_get_LastMethodSuccess = function(handle: Pointer): LongBool; cdecl;
  TCkDsa_put_LastMethodSuccess = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkDsa_get_GroupSize = function(handle: Pointer): Integer; cdecl;
  TCkDsa_put_GroupSize = procedure(handle: Pointer; value: Integer); cdecl;
  TCkDsa_get_Hash = function(handle: Pointer): Pointer; cdecl;
  TCkDsa_put_Hash = procedure(handle: Pointer; value: Pointer); cdecl;
  TCkDsa_get_HexG = function(handle: Pointer): PAnsiChar; cdecl;
  TCkDsa_get_HexP = function(handle: Pointer): PAnsiChar; cdecl;
  TCkDsa_get_HexQ = function(handle: Pointer): PAnsiChar; cdecl;
  TCkDsa_get_HexX = function(handle: Pointer): PAnsiChar; cdecl;
  TCkDsa_get_HexY = function(handle: Pointer): PAnsiChar; cdecl;
  TCkDsa_get_Signature = function(handle: Pointer): Pointer; cdecl;
  TCkDsa_put_Signature = procedure(handle: Pointer; value: Pointer); cdecl;
  TCkDsa_get_UncommonOptions = function(handle: Pointer): PAnsiChar; cdecl;
  TCkDsa_put_UncommonOptions = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkDsa_FromDerFile = function(handle: Pointer; path: PAnsiChar): LongBool; cdecl;
  TCkDsa_FromEncryptedPem = function(handle: Pointer; password: PAnsiChar; pemData: PAnsiChar): LongBool; cdecl;
  TCkDsa_FromPem = function(handle: Pointer; pemData: PAnsiChar): LongBool; cdecl;
  TCkDsa_FromPublicDerFile = function(handle: Pointer; path: PAnsiChar): LongBool; cdecl;
  TCkDsa_FromPublicPem = function(handle: Pointer; pemData: PAnsiChar): LongBool; cdecl;
  TCkDsa_FromXml = function(handle: Pointer; xmlKey: PAnsiChar): LongBool; cdecl;
  TCkDsa_GenKey = function(handle: Pointer; numBits: Integer): LongBool; cdecl;
  TCkDsa_GenKeyFromParamsDerFile = function(handle: Pointer; path: PAnsiChar): LongBool; cdecl;
  TCkDsa_GenKeyFromParamsPem = function(handle: Pointer; pem: PAnsiChar): LongBool; cdecl;
  TCkDsa_GenKeyFromParamsPemFile = function(handle: Pointer; path: PAnsiChar): LongBool; cdecl;
  TCkDsa_GetEncodedHash = function(handle: Pointer; encoding: PAnsiChar): PAnsiChar; cdecl;
  TCkDsa_GetEncodedSignature = function(handle: Pointer; encoding: PAnsiChar): PAnsiChar; cdecl;
  TCkDsa_LoadText = function(handle: Pointer; path: PAnsiChar): PAnsiChar; cdecl;
  TCkDsa_SaveText = function(handle: Pointer; strToSave: PAnsiChar; path: PAnsiChar): LongBool; cdecl;
  TCkDsa_SetEncodedHash = function(handle: Pointer; encoding: PAnsiChar; encodedHash: PAnsiChar): LongBool; cdecl;
  TCkDsa_SetEncodedSignature = function(handle: Pointer; encoding: PAnsiChar; encodedSig: PAnsiChar): LongBool; cdecl;
  TCkDsa_SetEncodedSignatureRS = function(handle: Pointer; encoding: PAnsiChar; encodedR: PAnsiChar; encodedS: PAnsiChar): LongBool; cdecl;
  TCkDsa_SetKeyExplicit = function(handle: Pointer; groupSizeInBytes: Integer; pHex: PAnsiChar; qHex: PAnsiChar; gHex: PAnsiChar; xHex: PAnsiChar): LongBool; cdecl;
  TCkDsa_SetPubKeyExplicit = function(handle: Pointer; groupSizeInBytes: Integer; pHex: PAnsiChar; qHex: PAnsiChar; gHex: PAnsiChar; yHex: PAnsiChar): LongBool; cdecl;
  TCkDsa_SignHash = function(handle: Pointer): LongBool; cdecl;
  TCkDsa_ToDerFile = function(handle: Pointer; path: PAnsiChar): LongBool; cdecl;
  TCkDsa_ToEncryptedPem = function(handle: Pointer; password: PAnsiChar): PAnsiChar; cdecl;
  TCkDsa_ToPem = function(handle: Pointer): PAnsiChar; cdecl;
  TCkDsa_ToPublicDerFile = function(handle: Pointer; path: PAnsiChar): LongBool; cdecl;
  TCkDsa_ToPublicPem = function(handle: Pointer): PAnsiChar; cdecl;
  TCkDsa_ToXml = function(handle: Pointer; bPublicOnly: LongBool): PAnsiChar; cdecl;
  TCkDsa_Verify = function(handle: Pointer): LongBool; cdecl;
  TCkDsa_VerifyKey = function(handle: Pointer): LongBool; cdecl;
  TCkDsa_GenKey2 = function(handle: Pointer; keyLenBits: Integer; modLenBits: Integer): LongBool; cdecl;
  TCkDsa_GenKeyFromPQG = function(handle: Pointer; pHex: PAnsiChar; qHex: PAnsiChar; gHex: PAnsiChar): LongBool; cdecl;
  TCkDsa_FromDerBd = function(handle: Pointer; bd: Pointer): LongBool; cdecl;
  TCkDsa_FromPublicDerBd = function(handle: Pointer; bd: Pointer): LongBool; cdecl;
  TCkDsa_GenKeyFromParamsDerBd = function(handle: Pointer; bd: Pointer): LongBool; cdecl;
  TCkDsa_ToDerBd = function(handle: Pointer; bd: Pointer): LongBool; cdecl;

{ ---- C bridge function pointer variables ---- }
var
  CkDsa_Create:  TCkDsa_Create  = nil;
  CkDsa_Dispose: TCkDsa_Dispose = nil;
  CkDsa_get_LastErrorHtml: TCkDsa_get_LastErrorHtml = nil;
  CkDsa_get_LastErrorText: TCkDsa_get_LastErrorText = nil;
  CkDsa_get_LastErrorXml: TCkDsa_get_LastErrorXml = nil;
  CkDsa_get_Version: TCkDsa_get_Version = nil;
  CkDsa_get_DebugLogFilePath: TCkDsa_get_DebugLogFilePath = nil;
  CkDsa_put_DebugLogFilePath: TCkDsa_put_DebugLogFilePath = nil;
  CkDsa_get_VerboseLogging: TCkDsa_get_VerboseLogging = nil;
  CkDsa_put_VerboseLogging: TCkDsa_put_VerboseLogging = nil;
  CkDsa_get_LastMethodSuccess: TCkDsa_get_LastMethodSuccess = nil;
  CkDsa_put_LastMethodSuccess: TCkDsa_put_LastMethodSuccess = nil;
  CkDsa_get_GroupSize: TCkDsa_get_GroupSize = nil;
  CkDsa_put_GroupSize: TCkDsa_put_GroupSize = nil;
  CkDsa_get_Hash: TCkDsa_get_Hash = nil;
  CkDsa_put_Hash: TCkDsa_put_Hash = nil;
  CkDsa_get_HexG: TCkDsa_get_HexG = nil;
  CkDsa_get_HexP: TCkDsa_get_HexP = nil;
  CkDsa_get_HexQ: TCkDsa_get_HexQ = nil;
  CkDsa_get_HexX: TCkDsa_get_HexX = nil;
  CkDsa_get_HexY: TCkDsa_get_HexY = nil;
  CkDsa_get_Signature: TCkDsa_get_Signature = nil;
  CkDsa_put_Signature: TCkDsa_put_Signature = nil;
  CkDsa_get_UncommonOptions: TCkDsa_get_UncommonOptions = nil;
  CkDsa_put_UncommonOptions: TCkDsa_put_UncommonOptions = nil;
  CkDsa_FromDerFile: TCkDsa_FromDerFile = nil;
  CkDsa_FromEncryptedPem: TCkDsa_FromEncryptedPem = nil;
  CkDsa_FromPem: TCkDsa_FromPem = nil;
  CkDsa_FromPublicDerFile: TCkDsa_FromPublicDerFile = nil;
  CkDsa_FromPublicPem: TCkDsa_FromPublicPem = nil;
  CkDsa_FromXml: TCkDsa_FromXml = nil;
  CkDsa_GenKey: TCkDsa_GenKey = nil;
  CkDsa_GenKeyFromParamsDerFile: TCkDsa_GenKeyFromParamsDerFile = nil;
  CkDsa_GenKeyFromParamsPem: TCkDsa_GenKeyFromParamsPem = nil;
  CkDsa_GenKeyFromParamsPemFile: TCkDsa_GenKeyFromParamsPemFile = nil;
  CkDsa_GetEncodedHash: TCkDsa_GetEncodedHash = nil;
  CkDsa_GetEncodedSignature: TCkDsa_GetEncodedSignature = nil;
  CkDsa_LoadText: TCkDsa_LoadText = nil;
  CkDsa_SaveText: TCkDsa_SaveText = nil;
  CkDsa_SetEncodedHash: TCkDsa_SetEncodedHash = nil;
  CkDsa_SetEncodedSignature: TCkDsa_SetEncodedSignature = nil;
  CkDsa_SetEncodedSignatureRS: TCkDsa_SetEncodedSignatureRS = nil;
  CkDsa_SetKeyExplicit: TCkDsa_SetKeyExplicit = nil;
  CkDsa_SetPubKeyExplicit: TCkDsa_SetPubKeyExplicit = nil;
  CkDsa_SignHash: TCkDsa_SignHash = nil;
  CkDsa_ToDerFile: TCkDsa_ToDerFile = nil;
  CkDsa_ToEncryptedPem: TCkDsa_ToEncryptedPem = nil;
  CkDsa_ToPem: TCkDsa_ToPem = nil;
  CkDsa_ToPublicDerFile: TCkDsa_ToPublicDerFile = nil;
  CkDsa_ToPublicPem: TCkDsa_ToPublicPem = nil;
  CkDsa_ToXml: TCkDsa_ToXml = nil;
  CkDsa_Verify: TCkDsa_Verify = nil;
  CkDsa_VerifyKey: TCkDsa_VerifyKey = nil;
  CkDsa_GenKey2: TCkDsa_GenKey2 = nil;
  CkDsa_GenKeyFromPQG: TCkDsa_GenKeyFromPQG = nil;
  CkDsa_FromDerBd: TCkDsa_FromDerBd = nil;
  CkDsa_FromPublicDerBd: TCkDsa_FromPublicDerBd = nil;
  CkDsa_GenKeyFromParamsDerBd: TCkDsa_GenKeyFromParamsDerBd = nil;
  CkDsa_ToDerBd: TCkDsa_ToDerBd = nil;

constructor TDsa.Create;
begin
  inherited Create;
  FHandle := CkDsa_Create();
end;

destructor TDsa.Destroy;
begin
  if FHandle <> nil then
    CkDsa_Dispose(FHandle);
  FHandle := nil;
  inherited;
end;

function TDsa.GetLastErrorHtml: string;
begin
  Result := CkToStr(CkDsa_get_LastErrorHtml(FHandle));
end;

function TDsa.GetLastErrorText: string;
begin
  Result := CkToStr(CkDsa_get_LastErrorText(FHandle));
end;

function TDsa.GetLastErrorXml: string;
begin
  Result := CkToStr(CkDsa_get_LastErrorXml(FHandle));
end;

function TDsa.GetVersion: string;
begin
  Result := CkToStr(CkDsa_get_Version(FHandle));
end;

function TDsa.GetDebugLogFilePath: string;
begin
  Result := CkToStr(CkDsa_get_DebugLogFilePath(FHandle));
end;

procedure TDsa.SetDebugLogFilePath(AValue: string);
begin
  CkDsa_put_DebugLogFilePath(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TDsa.GetVerboseLogging: Boolean;
begin
  Result := Boolean(CkDsa_get_VerboseLogging(FHandle));
end;

procedure TDsa.SetVerboseLogging(AValue: Boolean);
begin
  CkDsa_put_VerboseLogging(FHandle, LongBool(AValue));
end;

function TDsa.GetLastMethodSuccess: Boolean;
begin
  Result := Boolean(CkDsa_get_LastMethodSuccess(FHandle));
end;

procedure TDsa.SetLastMethodSuccess(AValue: Boolean);
begin
  CkDsa_put_LastMethodSuccess(FHandle, LongBool(AValue));
end;

function TDsa.GetGroupSize: Integer;
begin
  Result := CkDsa_get_GroupSize(FHandle);
end;

procedure TDsa.SetGroupSize(AValue: Integer);
begin
  CkDsa_put_GroupSize(FHandle, AValue);
end;

function TDsa.GetHash: TBytes;
begin
  Result := CkDsa_get_Hash(FHandle);
end;

procedure TDsa.SetHash(AValue: TBytes);
begin
  CkDsa_put_Hash(FHandle, AValue);
end;

function TDsa.GetHexG: string;
begin
  Result := CkToStr(CkDsa_get_HexG(FHandle));
end;

function TDsa.GetHexP: string;
begin
  Result := CkToStr(CkDsa_get_HexP(FHandle));
end;

function TDsa.GetHexQ: string;
begin
  Result := CkToStr(CkDsa_get_HexQ(FHandle));
end;

function TDsa.GetHexX: string;
begin
  Result := CkToStr(CkDsa_get_HexX(FHandle));
end;

function TDsa.GetHexY: string;
begin
  Result := CkToStr(CkDsa_get_HexY(FHandle));
end;

function TDsa.GetSignature: TBytes;
begin
  Result := CkDsa_get_Signature(FHandle);
end;

procedure TDsa.SetSignature(AValue: TBytes);
begin
  CkDsa_put_Signature(FHandle, AValue);
end;

function TDsa.GetUncommonOptions: string;
begin
  Result := CkToStr(CkDsa_get_UncommonOptions(FHandle));
end;

procedure TDsa.SetUncommonOptions(AValue: string);
begin
  CkDsa_put_UncommonOptions(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TDsa.FromDerFile(const path: string): Boolean;
begin
  Result := Boolean(CkDsa_FromDerFile(FHandle, PAnsiChar(StrToCk(path))));
end;

function TDsa.FromEncryptedPem(const password: string; const pemData: string): Boolean;
begin
  Result := Boolean(CkDsa_FromEncryptedPem(FHandle, PAnsiChar(StrToCk(password)), PAnsiChar(StrToCk(pemData))));
end;

function TDsa.FromPem(const pemData: string): Boolean;
begin
  Result := Boolean(CkDsa_FromPem(FHandle, PAnsiChar(StrToCk(pemData))));
end;

function TDsa.FromPublicDerFile(const path: string): Boolean;
begin
  Result := Boolean(CkDsa_FromPublicDerFile(FHandle, PAnsiChar(StrToCk(path))));
end;

function TDsa.FromPublicPem(const pemData: string): Boolean;
begin
  Result := Boolean(CkDsa_FromPublicPem(FHandle, PAnsiChar(StrToCk(pemData))));
end;

function TDsa.FromXml(const xmlKey: string): Boolean;
begin
  Result := Boolean(CkDsa_FromXml(FHandle, PAnsiChar(StrToCk(xmlKey))));
end;

function TDsa.GenKey(numBits: Integer): Boolean;
begin
  Result := Boolean(CkDsa_GenKey(FHandle, numBits));
end;

function TDsa.GenKeyFromParamsDerFile(const path: string): Boolean;
begin
  Result := Boolean(CkDsa_GenKeyFromParamsDerFile(FHandle, PAnsiChar(StrToCk(path))));
end;

function TDsa.GenKeyFromParamsPem(const pem: string): Boolean;
begin
  Result := Boolean(CkDsa_GenKeyFromParamsPem(FHandle, PAnsiChar(StrToCk(pem))));
end;

function TDsa.GenKeyFromParamsPemFile(const path: string): Boolean;
begin
  Result := Boolean(CkDsa_GenKeyFromParamsPemFile(FHandle, PAnsiChar(StrToCk(path))));
end;

function TDsa.GetEncodedHash(const encoding: string): string;
begin
  Result := CkToStr(CkDsa_GetEncodedHash(FHandle, PAnsiChar(StrToCk(encoding))));
end;

function TDsa.GetEncodedSignature(const encoding: string): string;
begin
  Result := CkToStr(CkDsa_GetEncodedSignature(FHandle, PAnsiChar(StrToCk(encoding))));
end;

function TDsa.LoadText(const path: string): string;
begin
  Result := CkToStr(CkDsa_LoadText(FHandle, PAnsiChar(StrToCk(path))));
end;

function TDsa.SaveText(const strToSave: string; const path: string): Boolean;
begin
  Result := Boolean(CkDsa_SaveText(FHandle, PAnsiChar(StrToCk(strToSave)), PAnsiChar(StrToCk(path))));
end;

function TDsa.SetEncodedHash(const encoding: string; const encodedHash: string): Boolean;
begin
  Result := Boolean(CkDsa_SetEncodedHash(FHandle, PAnsiChar(StrToCk(encoding)), PAnsiChar(StrToCk(encodedHash))));
end;

function TDsa.SetEncodedSignature(const encoding: string; const encodedSig: string): Boolean;
begin
  Result := Boolean(CkDsa_SetEncodedSignature(FHandle, PAnsiChar(StrToCk(encoding)), PAnsiChar(StrToCk(encodedSig))));
end;

function TDsa.SetEncodedSignatureRS(const encoding: string; const encodedR: string; const encodedS: string): Boolean;
begin
  Result := Boolean(CkDsa_SetEncodedSignatureRS(FHandle, PAnsiChar(StrToCk(encoding)), PAnsiChar(StrToCk(encodedR)), PAnsiChar(StrToCk(encodedS))));
end;

function TDsa.SetKeyExplicit(groupSizeInBytes: Integer; const pHex: string; const qHex: string; const gHex: string; const xHex: string): Boolean;
begin
  Result := Boolean(CkDsa_SetKeyExplicit(FHandle, groupSizeInBytes, PAnsiChar(StrToCk(pHex)), PAnsiChar(StrToCk(qHex)), PAnsiChar(StrToCk(gHex)), PAnsiChar(StrToCk(xHex))));
end;

function TDsa.SetPubKeyExplicit(groupSizeInBytes: Integer; const pHex: string; const qHex: string; const gHex: string; const yHex: string): Boolean;
begin
  Result := Boolean(CkDsa_SetPubKeyExplicit(FHandle, groupSizeInBytes, PAnsiChar(StrToCk(pHex)), PAnsiChar(StrToCk(qHex)), PAnsiChar(StrToCk(gHex)), PAnsiChar(StrToCk(yHex))));
end;

function TDsa.SignHash: Boolean;
begin
  Result := Boolean(CkDsa_SignHash(FHandle));
end;

function TDsa.ToDerFile(const path: string): Boolean;
begin
  Result := Boolean(CkDsa_ToDerFile(FHandle, PAnsiChar(StrToCk(path))));
end;

function TDsa.ToEncryptedPem(const password: string): string;
begin
  Result := CkToStr(CkDsa_ToEncryptedPem(FHandle, PAnsiChar(StrToCk(password))));
end;

function TDsa.ToPem: string;
begin
  Result := CkToStr(CkDsa_ToPem(FHandle));
end;

function TDsa.ToPublicDerFile(const path: string): Boolean;
begin
  Result := Boolean(CkDsa_ToPublicDerFile(FHandle, PAnsiChar(StrToCk(path))));
end;

function TDsa.ToPublicPem: string;
begin
  Result := CkToStr(CkDsa_ToPublicPem(FHandle));
end;

function TDsa.ToXml(bPublicOnly: Boolean): string;
begin
  Result := CkToStr(CkDsa_ToXml(FHandle, LongBool(bPublicOnly)));
end;

function TDsa.Verify: Boolean;
begin
  Result := Boolean(CkDsa_Verify(FHandle));
end;

function TDsa.VerifyKey: Boolean;
begin
  Result := Boolean(CkDsa_VerifyKey(FHandle));
end;

function TDsa.GenKey2(keyLenBits: Integer; modLenBits: Integer): Boolean;
begin
  Result := Boolean(CkDsa_GenKey2(FHandle, keyLenBits, modLenBits));
end;

function TDsa.GenKeyFromPQG(const pHex: string; const qHex: string; const gHex: string): Boolean;
begin
  Result := Boolean(CkDsa_GenKeyFromPQG(FHandle, PAnsiChar(StrToCk(pHex)), PAnsiChar(StrToCk(qHex)), PAnsiChar(StrToCk(gHex))));
end;

function TDsa.FromDerBd(bd: TChilkatBase): Boolean;
begin
  Result := Boolean(CkDsa_FromDerBd(FHandle, bd.Handle));
end;

function TDsa.FromPublicDerBd(bd: TChilkatBase): Boolean;
begin
  Result := Boolean(CkDsa_FromPublicDerBd(FHandle, bd.Handle));
end;

function TDsa.GenKeyFromParamsDerBd(bd: TChilkatBase): Boolean;
begin
  Result := Boolean(CkDsa_GenKeyFromParamsDerBd(FHandle, bd.Handle));
end;

function TDsa.ToDerBd(bd: TChilkatBase): Boolean;
begin
  Result := Boolean(CkDsa_ToDerBd(FHandle, bd.Handle));
end;

initialization
  Chilkat_GetProcedureAddress(CkDsa_Create,  'CkDsa_Create');
  Chilkat_GetProcedureAddress(CkDsa_Dispose, 'CkDsa_Dispose');
  Chilkat_GetProcedureAddress(CkDsa_get_LastErrorHtml, 'CkDsa_get_LastErrorHtml');
  Chilkat_GetProcedureAddress(CkDsa_get_LastErrorText, 'CkDsa_get_LastErrorText');
  Chilkat_GetProcedureAddress(CkDsa_get_LastErrorXml, 'CkDsa_get_LastErrorXml');
  Chilkat_GetProcedureAddress(CkDsa_get_Version, 'CkDsa_get_Version');
  Chilkat_GetProcedureAddress(CkDsa_get_DebugLogFilePath, 'CkDsa_get_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkDsa_put_DebugLogFilePath, 'CkDsa_put_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkDsa_get_VerboseLogging, 'CkDsa_get_VerboseLogging');
  Chilkat_GetProcedureAddress(CkDsa_put_VerboseLogging, 'CkDsa_put_VerboseLogging');
  Chilkat_GetProcedureAddress(CkDsa_get_LastMethodSuccess, 'CkDsa_get_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkDsa_put_LastMethodSuccess, 'CkDsa_put_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkDsa_get_GroupSize, 'CkDsa_get_GroupSize');
  Chilkat_GetProcedureAddress(CkDsa_put_GroupSize, 'CkDsa_put_GroupSize');
  Chilkat_GetProcedureAddress(CkDsa_get_Hash, 'CkDsa_get_Hash');
  Chilkat_GetProcedureAddress(CkDsa_put_Hash, 'CkDsa_put_Hash');
  Chilkat_GetProcedureAddress(CkDsa_get_HexG, 'CkDsa_get_HexG');
  Chilkat_GetProcedureAddress(CkDsa_get_HexP, 'CkDsa_get_HexP');
  Chilkat_GetProcedureAddress(CkDsa_get_HexQ, 'CkDsa_get_HexQ');
  Chilkat_GetProcedureAddress(CkDsa_get_HexX, 'CkDsa_get_HexX');
  Chilkat_GetProcedureAddress(CkDsa_get_HexY, 'CkDsa_get_HexY');
  Chilkat_GetProcedureAddress(CkDsa_get_Signature, 'CkDsa_get_Signature');
  Chilkat_GetProcedureAddress(CkDsa_put_Signature, 'CkDsa_put_Signature');
  Chilkat_GetProcedureAddress(CkDsa_get_UncommonOptions, 'CkDsa_get_UncommonOptions');
  Chilkat_GetProcedureAddress(CkDsa_put_UncommonOptions, 'CkDsa_put_UncommonOptions');
  Chilkat_GetProcedureAddress(CkDsa_FromDerFile, 'CkDsa_FromDerFile');
  Chilkat_GetProcedureAddress(CkDsa_FromEncryptedPem, 'CkDsa_FromEncryptedPem');
  Chilkat_GetProcedureAddress(CkDsa_FromPem, 'CkDsa_FromPem');
  Chilkat_GetProcedureAddress(CkDsa_FromPublicDerFile, 'CkDsa_FromPublicDerFile');
  Chilkat_GetProcedureAddress(CkDsa_FromPublicPem, 'CkDsa_FromPublicPem');
  Chilkat_GetProcedureAddress(CkDsa_FromXml, 'CkDsa_FromXml');
  Chilkat_GetProcedureAddress(CkDsa_GenKey, 'CkDsa_GenKey');
  Chilkat_GetProcedureAddress(CkDsa_GenKeyFromParamsDerFile, 'CkDsa_GenKeyFromParamsDerFile');
  Chilkat_GetProcedureAddress(CkDsa_GenKeyFromParamsPem, 'CkDsa_GenKeyFromParamsPem');
  Chilkat_GetProcedureAddress(CkDsa_GenKeyFromParamsPemFile, 'CkDsa_GenKeyFromParamsPemFile');
  Chilkat_GetProcedureAddress(CkDsa_GetEncodedHash, 'CkDsa_GetEncodedHash');
  Chilkat_GetProcedureAddress(CkDsa_GetEncodedSignature, 'CkDsa_GetEncodedSignature');
  Chilkat_GetProcedureAddress(CkDsa_LoadText, 'CkDsa_LoadText');
  Chilkat_GetProcedureAddress(CkDsa_SaveText, 'CkDsa_SaveText');
  Chilkat_GetProcedureAddress(CkDsa_SetEncodedHash, 'CkDsa_SetEncodedHash');
  Chilkat_GetProcedureAddress(CkDsa_SetEncodedSignature, 'CkDsa_SetEncodedSignature');
  Chilkat_GetProcedureAddress(CkDsa_SetEncodedSignatureRS, 'CkDsa_SetEncodedSignatureRS');
  Chilkat_GetProcedureAddress(CkDsa_SetKeyExplicit, 'CkDsa_SetKeyExplicit');
  Chilkat_GetProcedureAddress(CkDsa_SetPubKeyExplicit, 'CkDsa_SetPubKeyExplicit');
  Chilkat_GetProcedureAddress(CkDsa_SignHash, 'CkDsa_SignHash');
  Chilkat_GetProcedureAddress(CkDsa_ToDerFile, 'CkDsa_ToDerFile');
  Chilkat_GetProcedureAddress(CkDsa_ToEncryptedPem, 'CkDsa_ToEncryptedPem');
  Chilkat_GetProcedureAddress(CkDsa_ToPem, 'CkDsa_ToPem');
  Chilkat_GetProcedureAddress(CkDsa_ToPublicDerFile, 'CkDsa_ToPublicDerFile');
  Chilkat_GetProcedureAddress(CkDsa_ToPublicPem, 'CkDsa_ToPublicPem');
  Chilkat_GetProcedureAddress(CkDsa_ToXml, 'CkDsa_ToXml');
  Chilkat_GetProcedureAddress(CkDsa_Verify, 'CkDsa_Verify');
  Chilkat_GetProcedureAddress(CkDsa_VerifyKey, 'CkDsa_VerifyKey');
  Chilkat_GetProcedureAddress(CkDsa_GenKey2, 'CkDsa_GenKey2');
  Chilkat_GetProcedureAddress(CkDsa_GenKeyFromPQG, 'CkDsa_GenKeyFromPQG');
  Chilkat_GetProcedureAddress(CkDsa_FromDerBd, 'CkDsa_FromDerBd');
  Chilkat_GetProcedureAddress(CkDsa_FromPublicDerBd, 'CkDsa_FromPublicDerBd');
  Chilkat_GetProcedureAddress(CkDsa_GenKeyFromParamsDerBd, 'CkDsa_GenKeyFromParamsDerBd');
  Chilkat_GetProcedureAddress(CkDsa_ToDerBd, 'CkDsa_ToDerBd');

end.
