unit Chilkat.XmlCertVault;

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

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

interface

uses
  SysUtils,
  Chilkat.Base;

type

  { TXmlCertVault wraps CkXmlCertVault via the C bridge layer. }
  TXmlCertVault = 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  GetMasterPassword: string;
    procedure SetMasterPassword(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 MasterPassword: string read GetMasterPassword write SetMasterPassword;

    function  AddCert(cert: TChilkatBase): Boolean;
    function  AddCertChain(certChain: TChilkatBase): Boolean;
    function  AddCertEncoded(const encodedBytes: string; const encoding: string): Boolean;
    function  AddCertFile(const path: string): Boolean;
    function  AddCertString(const certData: string): Boolean;
    function  AddPemFile(const path: string; const password: string): Boolean;
    function  AddPfx(pfx: TChilkatBase): Boolean;
    function  AddPfxEncoded(const encodedBytes: string; const encoding: string; const password: string): Boolean;
    function  AddPfxFile(const path: string; const password: string): Boolean;
    function  GetXml: string;
    function  LoadXml(const xml: string): Boolean;
    function  LoadXmlFile(const path: string): Boolean;
    function  SaveXml(const path: string): Boolean;
  end;

implementation

uses
  CkDllLoader,
  Chilkat.Utils;

{ ---- C bridge function pointer types ---- }
type
  TCkXmlCertVault_Create  = function(): Pointer; cdecl;
  TCkXmlCertVault_Dispose = procedure(handle: Pointer); cdecl;
  TCkXmlCertVault_get_LastErrorHtml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkXmlCertVault_get_LastErrorText = function(handle: Pointer): PAnsiChar; cdecl;
  TCkXmlCertVault_get_LastErrorXml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkXmlCertVault_get_Version = function(handle: Pointer): PAnsiChar; cdecl;
  TCkXmlCertVault_get_DebugLogFilePath = function(handle: Pointer): PAnsiChar; cdecl;
  TCkXmlCertVault_put_DebugLogFilePath = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkXmlCertVault_get_VerboseLogging = function(handle: Pointer): LongBool; cdecl;
  TCkXmlCertVault_put_VerboseLogging = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkXmlCertVault_get_LastMethodSuccess = function(handle: Pointer): LongBool; cdecl;
  TCkXmlCertVault_put_LastMethodSuccess = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkXmlCertVault_get_MasterPassword = function(handle: Pointer): PAnsiChar; cdecl;
  TCkXmlCertVault_put_MasterPassword = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkXmlCertVault_AddCert = function(handle: Pointer; cert: Pointer): LongBool; cdecl;
  TCkXmlCertVault_AddCertChain = function(handle: Pointer; certChain: Pointer): LongBool; cdecl;
  TCkXmlCertVault_AddCertEncoded = function(handle: Pointer; encodedBytes: PAnsiChar; encoding: PAnsiChar): LongBool; cdecl;
  TCkXmlCertVault_AddCertFile = function(handle: Pointer; path: PAnsiChar): LongBool; cdecl;
  TCkXmlCertVault_AddCertString = function(handle: Pointer; certData: PAnsiChar): LongBool; cdecl;
  TCkXmlCertVault_AddPemFile = function(handle: Pointer; path: PAnsiChar; password: PAnsiChar): LongBool; cdecl;
  TCkXmlCertVault_AddPfx = function(handle: Pointer; pfx: Pointer): LongBool; cdecl;
  TCkXmlCertVault_AddPfxEncoded = function(handle: Pointer; encodedBytes: PAnsiChar; encoding: PAnsiChar; password: PAnsiChar): LongBool; cdecl;
  TCkXmlCertVault_AddPfxFile = function(handle: Pointer; path: PAnsiChar; password: PAnsiChar): LongBool; cdecl;
  TCkXmlCertVault_GetXml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkXmlCertVault_LoadXml = function(handle: Pointer; xml: PAnsiChar): LongBool; cdecl;
  TCkXmlCertVault_LoadXmlFile = function(handle: Pointer; path: PAnsiChar): LongBool; cdecl;
  TCkXmlCertVault_SaveXml = function(handle: Pointer; path: PAnsiChar): LongBool; cdecl;

{ ---- C bridge function pointer variables ---- }
var
  CkXmlCertVault_Create:  TCkXmlCertVault_Create  = nil;
  CkXmlCertVault_Dispose: TCkXmlCertVault_Dispose = nil;
  CkXmlCertVault_get_LastErrorHtml: TCkXmlCertVault_get_LastErrorHtml = nil;
  CkXmlCertVault_get_LastErrorText: TCkXmlCertVault_get_LastErrorText = nil;
  CkXmlCertVault_get_LastErrorXml: TCkXmlCertVault_get_LastErrorXml = nil;
  CkXmlCertVault_get_Version: TCkXmlCertVault_get_Version = nil;
  CkXmlCertVault_get_DebugLogFilePath: TCkXmlCertVault_get_DebugLogFilePath = nil;
  CkXmlCertVault_put_DebugLogFilePath: TCkXmlCertVault_put_DebugLogFilePath = nil;
  CkXmlCertVault_get_VerboseLogging: TCkXmlCertVault_get_VerboseLogging = nil;
  CkXmlCertVault_put_VerboseLogging: TCkXmlCertVault_put_VerboseLogging = nil;
  CkXmlCertVault_get_LastMethodSuccess: TCkXmlCertVault_get_LastMethodSuccess = nil;
  CkXmlCertVault_put_LastMethodSuccess: TCkXmlCertVault_put_LastMethodSuccess = nil;
  CkXmlCertVault_get_MasterPassword: TCkXmlCertVault_get_MasterPassword = nil;
  CkXmlCertVault_put_MasterPassword: TCkXmlCertVault_put_MasterPassword = nil;
  CkXmlCertVault_AddCert: TCkXmlCertVault_AddCert = nil;
  CkXmlCertVault_AddCertChain: TCkXmlCertVault_AddCertChain = nil;
  CkXmlCertVault_AddCertEncoded: TCkXmlCertVault_AddCertEncoded = nil;
  CkXmlCertVault_AddCertFile: TCkXmlCertVault_AddCertFile = nil;
  CkXmlCertVault_AddCertString: TCkXmlCertVault_AddCertString = nil;
  CkXmlCertVault_AddPemFile: TCkXmlCertVault_AddPemFile = nil;
  CkXmlCertVault_AddPfx: TCkXmlCertVault_AddPfx = nil;
  CkXmlCertVault_AddPfxEncoded: TCkXmlCertVault_AddPfxEncoded = nil;
  CkXmlCertVault_AddPfxFile: TCkXmlCertVault_AddPfxFile = nil;
  CkXmlCertVault_GetXml: TCkXmlCertVault_GetXml = nil;
  CkXmlCertVault_LoadXml: TCkXmlCertVault_LoadXml = nil;
  CkXmlCertVault_LoadXmlFile: TCkXmlCertVault_LoadXmlFile = nil;
  CkXmlCertVault_SaveXml: TCkXmlCertVault_SaveXml = nil;

constructor TXmlCertVault.Create;
begin
  inherited Create;
  FHandle := CkXmlCertVault_Create();
end;

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

function TXmlCertVault.GetLastErrorHtml: string;
begin
  Result := CkToStr(CkXmlCertVault_get_LastErrorHtml(FHandle));
end;

function TXmlCertVault.GetLastErrorText: string;
begin
  Result := CkToStr(CkXmlCertVault_get_LastErrorText(FHandle));
end;

function TXmlCertVault.GetLastErrorXml: string;
begin
  Result := CkToStr(CkXmlCertVault_get_LastErrorXml(FHandle));
end;

function TXmlCertVault.GetVersion: string;
begin
  Result := CkToStr(CkXmlCertVault_get_Version(FHandle));
end;

function TXmlCertVault.GetDebugLogFilePath: string;
begin
  Result := CkToStr(CkXmlCertVault_get_DebugLogFilePath(FHandle));
end;

procedure TXmlCertVault.SetDebugLogFilePath(AValue: string);
begin
  CkXmlCertVault_put_DebugLogFilePath(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TXmlCertVault.GetVerboseLogging: Boolean;
begin
  Result := Boolean(CkXmlCertVault_get_VerboseLogging(FHandle));
end;

procedure TXmlCertVault.SetVerboseLogging(AValue: Boolean);
begin
  CkXmlCertVault_put_VerboseLogging(FHandle, LongBool(AValue));
end;

function TXmlCertVault.GetLastMethodSuccess: Boolean;
begin
  Result := Boolean(CkXmlCertVault_get_LastMethodSuccess(FHandle));
end;

procedure TXmlCertVault.SetLastMethodSuccess(AValue: Boolean);
begin
  CkXmlCertVault_put_LastMethodSuccess(FHandle, LongBool(AValue));
end;

function TXmlCertVault.GetMasterPassword: string;
begin
  Result := CkToStr(CkXmlCertVault_get_MasterPassword(FHandle));
end;

procedure TXmlCertVault.SetMasterPassword(AValue: string);
begin
  CkXmlCertVault_put_MasterPassword(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TXmlCertVault.AddCert(cert: TChilkatBase): Boolean;
begin
  Result := Boolean(CkXmlCertVault_AddCert(FHandle, cert.Handle));
end;

function TXmlCertVault.AddCertChain(certChain: TChilkatBase): Boolean;
begin
  Result := Boolean(CkXmlCertVault_AddCertChain(FHandle, certChain.Handle));
end;

function TXmlCertVault.AddCertEncoded(const encodedBytes: string; const encoding: string): Boolean;
begin
  Result := Boolean(CkXmlCertVault_AddCertEncoded(FHandle, PAnsiChar(StrToCk(encodedBytes)), PAnsiChar(StrToCk(encoding))));
end;

function TXmlCertVault.AddCertFile(const path: string): Boolean;
begin
  Result := Boolean(CkXmlCertVault_AddCertFile(FHandle, PAnsiChar(StrToCk(path))));
end;

function TXmlCertVault.AddCertString(const certData: string): Boolean;
begin
  Result := Boolean(CkXmlCertVault_AddCertString(FHandle, PAnsiChar(StrToCk(certData))));
end;

function TXmlCertVault.AddPemFile(const path: string; const password: string): Boolean;
begin
  Result := Boolean(CkXmlCertVault_AddPemFile(FHandle, PAnsiChar(StrToCk(path)), PAnsiChar(StrToCk(password))));
end;

function TXmlCertVault.AddPfx(pfx: TChilkatBase): Boolean;
begin
  Result := Boolean(CkXmlCertVault_AddPfx(FHandle, pfx.Handle));
end;

function TXmlCertVault.AddPfxEncoded(const encodedBytes: string; const encoding: string; const password: string): Boolean;
begin
  Result := Boolean(CkXmlCertVault_AddPfxEncoded(FHandle, PAnsiChar(StrToCk(encodedBytes)), PAnsiChar(StrToCk(encoding)), PAnsiChar(StrToCk(password))));
end;

function TXmlCertVault.AddPfxFile(const path: string; const password: string): Boolean;
begin
  Result := Boolean(CkXmlCertVault_AddPfxFile(FHandle, PAnsiChar(StrToCk(path)), PAnsiChar(StrToCk(password))));
end;

function TXmlCertVault.GetXml: string;
begin
  Result := CkToStr(CkXmlCertVault_GetXml(FHandle));
end;

function TXmlCertVault.LoadXml(const xml: string): Boolean;
begin
  Result := Boolean(CkXmlCertVault_LoadXml(FHandle, PAnsiChar(StrToCk(xml))));
end;

function TXmlCertVault.LoadXmlFile(const path: string): Boolean;
begin
  Result := Boolean(CkXmlCertVault_LoadXmlFile(FHandle, PAnsiChar(StrToCk(path))));
end;

function TXmlCertVault.SaveXml(const path: string): Boolean;
begin
  Result := Boolean(CkXmlCertVault_SaveXml(FHandle, PAnsiChar(StrToCk(path))));
end;

initialization
  Chilkat_GetProcedureAddress(CkXmlCertVault_Create,  'CkXmlCertVault_Create');
  Chilkat_GetProcedureAddress(CkXmlCertVault_Dispose, 'CkXmlCertVault_Dispose');
  Chilkat_GetProcedureAddress(CkXmlCertVault_get_LastErrorHtml, 'CkXmlCertVault_get_LastErrorHtml');
  Chilkat_GetProcedureAddress(CkXmlCertVault_get_LastErrorText, 'CkXmlCertVault_get_LastErrorText');
  Chilkat_GetProcedureAddress(CkXmlCertVault_get_LastErrorXml, 'CkXmlCertVault_get_LastErrorXml');
  Chilkat_GetProcedureAddress(CkXmlCertVault_get_Version, 'CkXmlCertVault_get_Version');
  Chilkat_GetProcedureAddress(CkXmlCertVault_get_DebugLogFilePath, 'CkXmlCertVault_get_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkXmlCertVault_put_DebugLogFilePath, 'CkXmlCertVault_put_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkXmlCertVault_get_VerboseLogging, 'CkXmlCertVault_get_VerboseLogging');
  Chilkat_GetProcedureAddress(CkXmlCertVault_put_VerboseLogging, 'CkXmlCertVault_put_VerboseLogging');
  Chilkat_GetProcedureAddress(CkXmlCertVault_get_LastMethodSuccess, 'CkXmlCertVault_get_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkXmlCertVault_put_LastMethodSuccess, 'CkXmlCertVault_put_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkXmlCertVault_get_MasterPassword, 'CkXmlCertVault_get_MasterPassword');
  Chilkat_GetProcedureAddress(CkXmlCertVault_put_MasterPassword, 'CkXmlCertVault_put_MasterPassword');
  Chilkat_GetProcedureAddress(CkXmlCertVault_AddCert, 'CkXmlCertVault_AddCert');
  Chilkat_GetProcedureAddress(CkXmlCertVault_AddCertChain, 'CkXmlCertVault_AddCertChain');
  Chilkat_GetProcedureAddress(CkXmlCertVault_AddCertEncoded, 'CkXmlCertVault_AddCertEncoded');
  Chilkat_GetProcedureAddress(CkXmlCertVault_AddCertFile, 'CkXmlCertVault_AddCertFile');
  Chilkat_GetProcedureAddress(CkXmlCertVault_AddCertString, 'CkXmlCertVault_AddCertString');
  Chilkat_GetProcedureAddress(CkXmlCertVault_AddPemFile, 'CkXmlCertVault_AddPemFile');
  Chilkat_GetProcedureAddress(CkXmlCertVault_AddPfx, 'CkXmlCertVault_AddPfx');
  Chilkat_GetProcedureAddress(CkXmlCertVault_AddPfxEncoded, 'CkXmlCertVault_AddPfxEncoded');
  Chilkat_GetProcedureAddress(CkXmlCertVault_AddPfxFile, 'CkXmlCertVault_AddPfxFile');
  Chilkat_GetProcedureAddress(CkXmlCertVault_GetXml, 'CkXmlCertVault_GetXml');
  Chilkat_GetProcedureAddress(CkXmlCertVault_LoadXml, 'CkXmlCertVault_LoadXml');
  Chilkat_GetProcedureAddress(CkXmlCertVault_LoadXmlFile, 'CkXmlCertVault_LoadXmlFile');
  Chilkat_GetProcedureAddress(CkXmlCertVault_SaveXml, 'CkXmlCertVault_SaveXml');

end.
