unit Chilkat.JavaKeyStore;

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

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

interface

uses
  SysUtils,
  Chilkat.Base;

type

  { TJavaKeyStore wraps CkJavaKeyStore via the C bridge layer. }
  TJavaKeyStore = 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  GetNumPrivateKeys: Integer;
    function  GetNumTrustedCerts: Integer;
    function  GetRequireCompleteChain: Boolean;
    procedure SetRequireCompleteChain(AValue: Boolean);
    function  GetVerifyKeyedDigest: Boolean;
    procedure SetVerifyKeyedDigest(AValue: Boolean);
    function  GetNumSecretKeys: Integer;
  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 NumPrivateKeys: Integer read GetNumPrivateKeys;
    property NumTrustedCerts: Integer read GetNumTrustedCerts;
    property RequireCompleteChain: Boolean read GetRequireCompleteChain write SetRequireCompleteChain;
    property VerifyKeyedDigest: Boolean read GetVerifyKeyedDigest write SetVerifyKeyedDigest;
    property NumSecretKeys: Integer read GetNumSecretKeys;

    function  AddPfx(pfx: TChilkatBase; const alias: string; const password: string): Boolean;
    function  AddPrivateKey(cert: TChilkatBase; const alias: string; const password: string): Boolean;
    function  AddTrustedCert(cert: TChilkatBase; const alias: string): Boolean;
    function  ChangePassword(index: Integer; const oldPassword: string; const newPassword: string): Boolean;
    function  GetPrivateKeyAlias(index: Integer): string;
    function  GetTrustedCertAlias(index: Integer): string;
    function  LoadEncoded(const password: string; const jksEncData: string; const encoding: string): Boolean;
    function  LoadFile(const password: string; const path: string): Boolean;
    function  RemoveEntry(entryType: Integer; index: Integer): Boolean;
    function  SetAlias(entryType: Integer; index: Integer; const alias: string): Boolean;
    function  ToEncodedString(const password: string; const encoding: string): string;
    function  ToFile(const password: string; const path: string): Boolean;
    function  UseCertVault(vault: TChilkatBase): Boolean;
    function  ToJwkSet(const password: string; sbJwkSet: TChilkatBase): Boolean;
    function  GetSecretKeyAlias(index: Integer): string;
    function  GetSecretKey(const password: string; index: Integer; const encoding: string): string;
    function  AddSecretKey(const encodedKeyBytes: string; const encoding: string; const algorithm: string; const alias: string; const password: string): Boolean;
    function  LoadJwkSet(const password: string; jwkSet: TChilkatBase): Boolean;
    function  LoadBd(const password: string; bd: TChilkatBase): Boolean;
    function  TrustedCertAt(index: Integer; cert: TChilkatBase): Boolean;
    function  PrivateKeyAt(const password: string; index: Integer; privKey: TChilkatBase): Boolean;
    function  CertChainAt(index: Integer; certChain: TChilkatBase): Boolean;
    function  CertChainOf(const alias: string; caseSensitive: Boolean; certChain: TChilkatBase): Boolean;
    function  PrivateKeyOf(const password: string; const alias: string; caseSensitive: Boolean; privKey: TChilkatBase): Boolean;
    function  TrustedCertOf(const alias: string; caseSensitive: Boolean; cert: TChilkatBase): Boolean;
    function  ToPemObj(const password: string; pemObj: TChilkatBase): Boolean;
    function  ToPfxObj(const password: string; pfxObj: TChilkatBase): Boolean;
    function  ToBd(const password: string; bd: TChilkatBase): Boolean;
  end;

implementation

uses
  CkDllLoader,
  Chilkat.Utils;

{ ---- C bridge function pointer types ---- }
type
  TCkJavaKeyStore_Create  = function(): Pointer; cdecl;
  TCkJavaKeyStore_Dispose = procedure(handle: Pointer); cdecl;
  TCkJavaKeyStore_get_LastErrorHtml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkJavaKeyStore_get_LastErrorText = function(handle: Pointer): PAnsiChar; cdecl;
  TCkJavaKeyStore_get_LastErrorXml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkJavaKeyStore_get_Version = function(handle: Pointer): PAnsiChar; cdecl;
  TCkJavaKeyStore_get_DebugLogFilePath = function(handle: Pointer): PAnsiChar; cdecl;
  TCkJavaKeyStore_put_DebugLogFilePath = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkJavaKeyStore_get_VerboseLogging = function(handle: Pointer): LongBool; cdecl;
  TCkJavaKeyStore_put_VerboseLogging = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkJavaKeyStore_get_LastMethodSuccess = function(handle: Pointer): LongBool; cdecl;
  TCkJavaKeyStore_put_LastMethodSuccess = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkJavaKeyStore_get_NumPrivateKeys = function(handle: Pointer): Integer; cdecl;
  TCkJavaKeyStore_get_NumTrustedCerts = function(handle: Pointer): Integer; cdecl;
  TCkJavaKeyStore_get_RequireCompleteChain = function(handle: Pointer): LongBool; cdecl;
  TCkJavaKeyStore_put_RequireCompleteChain = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkJavaKeyStore_get_VerifyKeyedDigest = function(handle: Pointer): LongBool; cdecl;
  TCkJavaKeyStore_put_VerifyKeyedDigest = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkJavaKeyStore_get_NumSecretKeys = function(handle: Pointer): Integer; cdecl;
  TCkJavaKeyStore_AddPfx = function(handle: Pointer; pfx: Pointer; alias: PAnsiChar; password: PAnsiChar): LongBool; cdecl;
  TCkJavaKeyStore_AddPrivateKey = function(handle: Pointer; cert: Pointer; alias: PAnsiChar; password: PAnsiChar): LongBool; cdecl;
  TCkJavaKeyStore_AddTrustedCert = function(handle: Pointer; cert: Pointer; alias: PAnsiChar): LongBool; cdecl;
  TCkJavaKeyStore_ChangePassword = function(handle: Pointer; index: Integer; oldPassword: PAnsiChar; newPassword: PAnsiChar): LongBool; cdecl;
  TCkJavaKeyStore_GetPrivateKeyAlias = function(handle: Pointer; index: Integer): PAnsiChar; cdecl;
  TCkJavaKeyStore_GetTrustedCertAlias = function(handle: Pointer; index: Integer): PAnsiChar; cdecl;
  TCkJavaKeyStore_LoadEncoded = function(handle: Pointer; password: PAnsiChar; jksEncData: PAnsiChar; encoding: PAnsiChar): LongBool; cdecl;
  TCkJavaKeyStore_LoadFile = function(handle: Pointer; password: PAnsiChar; path: PAnsiChar): LongBool; cdecl;
  TCkJavaKeyStore_RemoveEntry = function(handle: Pointer; entryType: Integer; index: Integer): LongBool; cdecl;
  TCkJavaKeyStore_SetAlias = function(handle: Pointer; entryType: Integer; index: Integer; alias: PAnsiChar): LongBool; cdecl;
  TCkJavaKeyStore_ToEncodedString = function(handle: Pointer; password: PAnsiChar; encoding: PAnsiChar): PAnsiChar; cdecl;
  TCkJavaKeyStore_ToFile = function(handle: Pointer; password: PAnsiChar; path: PAnsiChar): LongBool; cdecl;
  TCkJavaKeyStore_UseCertVault = function(handle: Pointer; vault: Pointer): LongBool; cdecl;
  TCkJavaKeyStore_ToJwkSet = function(handle: Pointer; password: PAnsiChar; sbJwkSet: Pointer): LongBool; cdecl;
  TCkJavaKeyStore_GetSecretKeyAlias = function(handle: Pointer; index: Integer): PAnsiChar; cdecl;
  TCkJavaKeyStore_GetSecretKey = function(handle: Pointer; password: PAnsiChar; index: Integer; encoding: PAnsiChar): PAnsiChar; cdecl;
  TCkJavaKeyStore_AddSecretKey = function(handle: Pointer; encodedKeyBytes: PAnsiChar; encoding: PAnsiChar; algorithm: PAnsiChar; alias: PAnsiChar; password: PAnsiChar): LongBool; cdecl;
  TCkJavaKeyStore_LoadJwkSet = function(handle: Pointer; password: PAnsiChar; jwkSet: Pointer): LongBool; cdecl;
  TCkJavaKeyStore_LoadBd = function(handle: Pointer; password: PAnsiChar; bd: Pointer): LongBool; cdecl;
  TCkJavaKeyStore_TrustedCertAt = function(handle: Pointer; index: Integer; cert: Pointer): LongBool; cdecl;
  TCkJavaKeyStore_PrivateKeyAt = function(handle: Pointer; password: PAnsiChar; index: Integer; privKey: Pointer): LongBool; cdecl;
  TCkJavaKeyStore_CertChainAt = function(handle: Pointer; index: Integer; certChain: Pointer): LongBool; cdecl;
  TCkJavaKeyStore_CertChainOf = function(handle: Pointer; alias: PAnsiChar; caseSensitive: LongBool; certChain: Pointer): LongBool; cdecl;
  TCkJavaKeyStore_PrivateKeyOf = function(handle: Pointer; password: PAnsiChar; alias: PAnsiChar; caseSensitive: LongBool; privKey: Pointer): LongBool; cdecl;
  TCkJavaKeyStore_TrustedCertOf = function(handle: Pointer; alias: PAnsiChar; caseSensitive: LongBool; cert: Pointer): LongBool; cdecl;
  TCkJavaKeyStore_ToPemObj = function(handle: Pointer; password: PAnsiChar; pemObj: Pointer): LongBool; cdecl;
  TCkJavaKeyStore_ToPfxObj = function(handle: Pointer; password: PAnsiChar; pfxObj: Pointer): LongBool; cdecl;
  TCkJavaKeyStore_ToBd = function(handle: Pointer; password: PAnsiChar; bd: Pointer): LongBool; cdecl;

{ ---- C bridge function pointer variables ---- }
var
  CkJavaKeyStore_Create:  TCkJavaKeyStore_Create  = nil;
  CkJavaKeyStore_Dispose: TCkJavaKeyStore_Dispose = nil;
  CkJavaKeyStore_get_LastErrorHtml: TCkJavaKeyStore_get_LastErrorHtml = nil;
  CkJavaKeyStore_get_LastErrorText: TCkJavaKeyStore_get_LastErrorText = nil;
  CkJavaKeyStore_get_LastErrorXml: TCkJavaKeyStore_get_LastErrorXml = nil;
  CkJavaKeyStore_get_Version: TCkJavaKeyStore_get_Version = nil;
  CkJavaKeyStore_get_DebugLogFilePath: TCkJavaKeyStore_get_DebugLogFilePath = nil;
  CkJavaKeyStore_put_DebugLogFilePath: TCkJavaKeyStore_put_DebugLogFilePath = nil;
  CkJavaKeyStore_get_VerboseLogging: TCkJavaKeyStore_get_VerboseLogging = nil;
  CkJavaKeyStore_put_VerboseLogging: TCkJavaKeyStore_put_VerboseLogging = nil;
  CkJavaKeyStore_get_LastMethodSuccess: TCkJavaKeyStore_get_LastMethodSuccess = nil;
  CkJavaKeyStore_put_LastMethodSuccess: TCkJavaKeyStore_put_LastMethodSuccess = nil;
  CkJavaKeyStore_get_NumPrivateKeys: TCkJavaKeyStore_get_NumPrivateKeys = nil;
  CkJavaKeyStore_get_NumTrustedCerts: TCkJavaKeyStore_get_NumTrustedCerts = nil;
  CkJavaKeyStore_get_RequireCompleteChain: TCkJavaKeyStore_get_RequireCompleteChain = nil;
  CkJavaKeyStore_put_RequireCompleteChain: TCkJavaKeyStore_put_RequireCompleteChain = nil;
  CkJavaKeyStore_get_VerifyKeyedDigest: TCkJavaKeyStore_get_VerifyKeyedDigest = nil;
  CkJavaKeyStore_put_VerifyKeyedDigest: TCkJavaKeyStore_put_VerifyKeyedDigest = nil;
  CkJavaKeyStore_get_NumSecretKeys: TCkJavaKeyStore_get_NumSecretKeys = nil;
  CkJavaKeyStore_AddPfx: TCkJavaKeyStore_AddPfx = nil;
  CkJavaKeyStore_AddPrivateKey: TCkJavaKeyStore_AddPrivateKey = nil;
  CkJavaKeyStore_AddTrustedCert: TCkJavaKeyStore_AddTrustedCert = nil;
  CkJavaKeyStore_ChangePassword: TCkJavaKeyStore_ChangePassword = nil;
  CkJavaKeyStore_GetPrivateKeyAlias: TCkJavaKeyStore_GetPrivateKeyAlias = nil;
  CkJavaKeyStore_GetTrustedCertAlias: TCkJavaKeyStore_GetTrustedCertAlias = nil;
  CkJavaKeyStore_LoadEncoded: TCkJavaKeyStore_LoadEncoded = nil;
  CkJavaKeyStore_LoadFile: TCkJavaKeyStore_LoadFile = nil;
  CkJavaKeyStore_RemoveEntry: TCkJavaKeyStore_RemoveEntry = nil;
  CkJavaKeyStore_SetAlias: TCkJavaKeyStore_SetAlias = nil;
  CkJavaKeyStore_ToEncodedString: TCkJavaKeyStore_ToEncodedString = nil;
  CkJavaKeyStore_ToFile: TCkJavaKeyStore_ToFile = nil;
  CkJavaKeyStore_UseCertVault: TCkJavaKeyStore_UseCertVault = nil;
  CkJavaKeyStore_ToJwkSet: TCkJavaKeyStore_ToJwkSet = nil;
  CkJavaKeyStore_GetSecretKeyAlias: TCkJavaKeyStore_GetSecretKeyAlias = nil;
  CkJavaKeyStore_GetSecretKey: TCkJavaKeyStore_GetSecretKey = nil;
  CkJavaKeyStore_AddSecretKey: TCkJavaKeyStore_AddSecretKey = nil;
  CkJavaKeyStore_LoadJwkSet: TCkJavaKeyStore_LoadJwkSet = nil;
  CkJavaKeyStore_LoadBd: TCkJavaKeyStore_LoadBd = nil;
  CkJavaKeyStore_TrustedCertAt: TCkJavaKeyStore_TrustedCertAt = nil;
  CkJavaKeyStore_PrivateKeyAt: TCkJavaKeyStore_PrivateKeyAt = nil;
  CkJavaKeyStore_CertChainAt: TCkJavaKeyStore_CertChainAt = nil;
  CkJavaKeyStore_CertChainOf: TCkJavaKeyStore_CertChainOf = nil;
  CkJavaKeyStore_PrivateKeyOf: TCkJavaKeyStore_PrivateKeyOf = nil;
  CkJavaKeyStore_TrustedCertOf: TCkJavaKeyStore_TrustedCertOf = nil;
  CkJavaKeyStore_ToPemObj: TCkJavaKeyStore_ToPemObj = nil;
  CkJavaKeyStore_ToPfxObj: TCkJavaKeyStore_ToPfxObj = nil;
  CkJavaKeyStore_ToBd: TCkJavaKeyStore_ToBd = nil;

constructor TJavaKeyStore.Create;
begin
  inherited Create;
  FHandle := CkJavaKeyStore_Create();
end;

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

function TJavaKeyStore.GetLastErrorHtml: string;
begin
  Result := CkToStr(CkJavaKeyStore_get_LastErrorHtml(FHandle));
end;

function TJavaKeyStore.GetLastErrorText: string;
begin
  Result := CkToStr(CkJavaKeyStore_get_LastErrorText(FHandle));
end;

function TJavaKeyStore.GetLastErrorXml: string;
begin
  Result := CkToStr(CkJavaKeyStore_get_LastErrorXml(FHandle));
end;

function TJavaKeyStore.GetVersion: string;
begin
  Result := CkToStr(CkJavaKeyStore_get_Version(FHandle));
end;

function TJavaKeyStore.GetDebugLogFilePath: string;
begin
  Result := CkToStr(CkJavaKeyStore_get_DebugLogFilePath(FHandle));
end;

procedure TJavaKeyStore.SetDebugLogFilePath(AValue: string);
begin
  CkJavaKeyStore_put_DebugLogFilePath(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TJavaKeyStore.GetVerboseLogging: Boolean;
begin
  Result := Boolean(CkJavaKeyStore_get_VerboseLogging(FHandle));
end;

procedure TJavaKeyStore.SetVerboseLogging(AValue: Boolean);
begin
  CkJavaKeyStore_put_VerboseLogging(FHandle, LongBool(AValue));
end;

function TJavaKeyStore.GetLastMethodSuccess: Boolean;
begin
  Result := Boolean(CkJavaKeyStore_get_LastMethodSuccess(FHandle));
end;

procedure TJavaKeyStore.SetLastMethodSuccess(AValue: Boolean);
begin
  CkJavaKeyStore_put_LastMethodSuccess(FHandle, LongBool(AValue));
end;

function TJavaKeyStore.GetNumPrivateKeys: Integer;
begin
  Result := CkJavaKeyStore_get_NumPrivateKeys(FHandle);
end;

function TJavaKeyStore.GetNumTrustedCerts: Integer;
begin
  Result := CkJavaKeyStore_get_NumTrustedCerts(FHandle);
end;

function TJavaKeyStore.GetRequireCompleteChain: Boolean;
begin
  Result := Boolean(CkJavaKeyStore_get_RequireCompleteChain(FHandle));
end;

procedure TJavaKeyStore.SetRequireCompleteChain(AValue: Boolean);
begin
  CkJavaKeyStore_put_RequireCompleteChain(FHandle, LongBool(AValue));
end;

function TJavaKeyStore.GetVerifyKeyedDigest: Boolean;
begin
  Result := Boolean(CkJavaKeyStore_get_VerifyKeyedDigest(FHandle));
end;

procedure TJavaKeyStore.SetVerifyKeyedDigest(AValue: Boolean);
begin
  CkJavaKeyStore_put_VerifyKeyedDigest(FHandle, LongBool(AValue));
end;

function TJavaKeyStore.GetNumSecretKeys: Integer;
begin
  Result := CkJavaKeyStore_get_NumSecretKeys(FHandle);
end;

function TJavaKeyStore.AddPfx(pfx: TChilkatBase; const alias: string; const password: string): Boolean;
begin
  Result := Boolean(CkJavaKeyStore_AddPfx(FHandle, pfx.Handle, PAnsiChar(StrToCk(alias)), PAnsiChar(StrToCk(password))));
end;

function TJavaKeyStore.AddPrivateKey(cert: TChilkatBase; const alias: string; const password: string): Boolean;
begin
  Result := Boolean(CkJavaKeyStore_AddPrivateKey(FHandle, cert.Handle, PAnsiChar(StrToCk(alias)), PAnsiChar(StrToCk(password))));
end;

function TJavaKeyStore.AddTrustedCert(cert: TChilkatBase; const alias: string): Boolean;
begin
  Result := Boolean(CkJavaKeyStore_AddTrustedCert(FHandle, cert.Handle, PAnsiChar(StrToCk(alias))));
end;

function TJavaKeyStore.ChangePassword(index: Integer; const oldPassword: string; const newPassword: string): Boolean;
begin
  Result := Boolean(CkJavaKeyStore_ChangePassword(FHandle, index, PAnsiChar(StrToCk(oldPassword)), PAnsiChar(StrToCk(newPassword))));
end;

function TJavaKeyStore.GetPrivateKeyAlias(index: Integer): string;
begin
  Result := CkToStr(CkJavaKeyStore_GetPrivateKeyAlias(FHandle, index));
end;

function TJavaKeyStore.GetTrustedCertAlias(index: Integer): string;
begin
  Result := CkToStr(CkJavaKeyStore_GetTrustedCertAlias(FHandle, index));
end;

function TJavaKeyStore.LoadEncoded(const password: string; const jksEncData: string; const encoding: string): Boolean;
begin
  Result := Boolean(CkJavaKeyStore_LoadEncoded(FHandle, PAnsiChar(StrToCk(password)), PAnsiChar(StrToCk(jksEncData)), PAnsiChar(StrToCk(encoding))));
end;

function TJavaKeyStore.LoadFile(const password: string; const path: string): Boolean;
begin
  Result := Boolean(CkJavaKeyStore_LoadFile(FHandle, PAnsiChar(StrToCk(password)), PAnsiChar(StrToCk(path))));
end;

function TJavaKeyStore.RemoveEntry(entryType: Integer; index: Integer): Boolean;
begin
  Result := Boolean(CkJavaKeyStore_RemoveEntry(FHandle, entryType, index));
end;

function TJavaKeyStore.SetAlias(entryType: Integer; index: Integer; const alias: string): Boolean;
begin
  Result := Boolean(CkJavaKeyStore_SetAlias(FHandle, entryType, index, PAnsiChar(StrToCk(alias))));
end;

function TJavaKeyStore.ToEncodedString(const password: string; const encoding: string): string;
begin
  Result := CkToStr(CkJavaKeyStore_ToEncodedString(FHandle, PAnsiChar(StrToCk(password)), PAnsiChar(StrToCk(encoding))));
end;

function TJavaKeyStore.ToFile(const password: string; const path: string): Boolean;
begin
  Result := Boolean(CkJavaKeyStore_ToFile(FHandle, PAnsiChar(StrToCk(password)), PAnsiChar(StrToCk(path))));
end;

function TJavaKeyStore.UseCertVault(vault: TChilkatBase): Boolean;
begin
  Result := Boolean(CkJavaKeyStore_UseCertVault(FHandle, vault.Handle));
end;

function TJavaKeyStore.ToJwkSet(const password: string; sbJwkSet: TChilkatBase): Boolean;
begin
  Result := Boolean(CkJavaKeyStore_ToJwkSet(FHandle, PAnsiChar(StrToCk(password)), sbJwkSet.Handle));
end;

function TJavaKeyStore.GetSecretKeyAlias(index: Integer): string;
begin
  Result := CkToStr(CkJavaKeyStore_GetSecretKeyAlias(FHandle, index));
end;

function TJavaKeyStore.GetSecretKey(const password: string; index: Integer; const encoding: string): string;
begin
  Result := CkToStr(CkJavaKeyStore_GetSecretKey(FHandle, PAnsiChar(StrToCk(password)), index, PAnsiChar(StrToCk(encoding))));
end;

function TJavaKeyStore.AddSecretKey(const encodedKeyBytes: string; const encoding: string; const algorithm: string; const alias: string; const password: string): Boolean;
begin
  Result := Boolean(CkJavaKeyStore_AddSecretKey(FHandle, PAnsiChar(StrToCk(encodedKeyBytes)), PAnsiChar(StrToCk(encoding)), PAnsiChar(StrToCk(algorithm)), PAnsiChar(StrToCk(alias)), PAnsiChar(StrToCk(password))));
end;

function TJavaKeyStore.LoadJwkSet(const password: string; jwkSet: TChilkatBase): Boolean;
begin
  Result := Boolean(CkJavaKeyStore_LoadJwkSet(FHandle, PAnsiChar(StrToCk(password)), jwkSet.Handle));
end;

function TJavaKeyStore.LoadBd(const password: string; bd: TChilkatBase): Boolean;
begin
  Result := Boolean(CkJavaKeyStore_LoadBd(FHandle, PAnsiChar(StrToCk(password)), bd.Handle));
end;

function TJavaKeyStore.TrustedCertAt(index: Integer; cert: TChilkatBase): Boolean;
begin
  Result := Boolean(CkJavaKeyStore_TrustedCertAt(FHandle, index, cert.Handle));
end;

function TJavaKeyStore.PrivateKeyAt(const password: string; index: Integer; privKey: TChilkatBase): Boolean;
begin
  Result := Boolean(CkJavaKeyStore_PrivateKeyAt(FHandle, PAnsiChar(StrToCk(password)), index, privKey.Handle));
end;

function TJavaKeyStore.CertChainAt(index: Integer; certChain: TChilkatBase): Boolean;
begin
  Result := Boolean(CkJavaKeyStore_CertChainAt(FHandle, index, certChain.Handle));
end;

function TJavaKeyStore.CertChainOf(const alias: string; caseSensitive: Boolean; certChain: TChilkatBase): Boolean;
begin
  Result := Boolean(CkJavaKeyStore_CertChainOf(FHandle, PAnsiChar(StrToCk(alias)), LongBool(caseSensitive), certChain.Handle));
end;

function TJavaKeyStore.PrivateKeyOf(const password: string; const alias: string; caseSensitive: Boolean; privKey: TChilkatBase): Boolean;
begin
  Result := Boolean(CkJavaKeyStore_PrivateKeyOf(FHandle, PAnsiChar(StrToCk(password)), PAnsiChar(StrToCk(alias)), LongBool(caseSensitive), privKey.Handle));
end;

function TJavaKeyStore.TrustedCertOf(const alias: string; caseSensitive: Boolean; cert: TChilkatBase): Boolean;
begin
  Result := Boolean(CkJavaKeyStore_TrustedCertOf(FHandle, PAnsiChar(StrToCk(alias)), LongBool(caseSensitive), cert.Handle));
end;

function TJavaKeyStore.ToPemObj(const password: string; pemObj: TChilkatBase): Boolean;
begin
  Result := Boolean(CkJavaKeyStore_ToPemObj(FHandle, PAnsiChar(StrToCk(password)), pemObj.Handle));
end;

function TJavaKeyStore.ToPfxObj(const password: string; pfxObj: TChilkatBase): Boolean;
begin
  Result := Boolean(CkJavaKeyStore_ToPfxObj(FHandle, PAnsiChar(StrToCk(password)), pfxObj.Handle));
end;

function TJavaKeyStore.ToBd(const password: string; bd: TChilkatBase): Boolean;
begin
  Result := Boolean(CkJavaKeyStore_ToBd(FHandle, PAnsiChar(StrToCk(password)), bd.Handle));
end;

initialization
  Chilkat_GetProcedureAddress(CkJavaKeyStore_Create,  'CkJavaKeyStore_Create');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_Dispose, 'CkJavaKeyStore_Dispose');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_get_LastErrorHtml, 'CkJavaKeyStore_get_LastErrorHtml');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_get_LastErrorText, 'CkJavaKeyStore_get_LastErrorText');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_get_LastErrorXml, 'CkJavaKeyStore_get_LastErrorXml');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_get_Version, 'CkJavaKeyStore_get_Version');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_get_DebugLogFilePath, 'CkJavaKeyStore_get_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_put_DebugLogFilePath, 'CkJavaKeyStore_put_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_get_VerboseLogging, 'CkJavaKeyStore_get_VerboseLogging');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_put_VerboseLogging, 'CkJavaKeyStore_put_VerboseLogging');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_get_LastMethodSuccess, 'CkJavaKeyStore_get_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_put_LastMethodSuccess, 'CkJavaKeyStore_put_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_get_NumPrivateKeys, 'CkJavaKeyStore_get_NumPrivateKeys');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_get_NumTrustedCerts, 'CkJavaKeyStore_get_NumTrustedCerts');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_get_RequireCompleteChain, 'CkJavaKeyStore_get_RequireCompleteChain');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_put_RequireCompleteChain, 'CkJavaKeyStore_put_RequireCompleteChain');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_get_VerifyKeyedDigest, 'CkJavaKeyStore_get_VerifyKeyedDigest');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_put_VerifyKeyedDigest, 'CkJavaKeyStore_put_VerifyKeyedDigest');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_get_NumSecretKeys, 'CkJavaKeyStore_get_NumSecretKeys');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_AddPfx, 'CkJavaKeyStore_AddPfx');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_AddPrivateKey, 'CkJavaKeyStore_AddPrivateKey');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_AddTrustedCert, 'CkJavaKeyStore_AddTrustedCert');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_ChangePassword, 'CkJavaKeyStore_ChangePassword');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_GetPrivateKeyAlias, 'CkJavaKeyStore_GetPrivateKeyAlias');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_GetTrustedCertAlias, 'CkJavaKeyStore_GetTrustedCertAlias');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_LoadEncoded, 'CkJavaKeyStore_LoadEncoded');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_LoadFile, 'CkJavaKeyStore_LoadFile');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_RemoveEntry, 'CkJavaKeyStore_RemoveEntry');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_SetAlias, 'CkJavaKeyStore_SetAlias');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_ToEncodedString, 'CkJavaKeyStore_ToEncodedString');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_ToFile, 'CkJavaKeyStore_ToFile');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_UseCertVault, 'CkJavaKeyStore_UseCertVault');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_ToJwkSet, 'CkJavaKeyStore_ToJwkSet');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_GetSecretKeyAlias, 'CkJavaKeyStore_GetSecretKeyAlias');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_GetSecretKey, 'CkJavaKeyStore_GetSecretKey');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_AddSecretKey, 'CkJavaKeyStore_AddSecretKey');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_LoadJwkSet, 'CkJavaKeyStore_LoadJwkSet');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_LoadBd, 'CkJavaKeyStore_LoadBd');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_TrustedCertAt, 'CkJavaKeyStore_TrustedCertAt');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_PrivateKeyAt, 'CkJavaKeyStore_PrivateKeyAt');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_CertChainAt, 'CkJavaKeyStore_CertChainAt');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_CertChainOf, 'CkJavaKeyStore_CertChainOf');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_PrivateKeyOf, 'CkJavaKeyStore_PrivateKeyOf');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_TrustedCertOf, 'CkJavaKeyStore_TrustedCertOf');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_ToPemObj, 'CkJavaKeyStore_ToPemObj');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_ToPfxObj, 'CkJavaKeyStore_ToPfxObj');
  Chilkat_GetProcedureAddress(CkJavaKeyStore_ToBd, 'CkJavaKeyStore_ToBd');

end.
