Page 1 of 1
Keystorage question (isprivate)
Posted: Mon 09 Feb 2009 20:31
by snorkel
I want to list all the private keys available for the user to use for authenticaton, so I did this:
for x := 0 to ssh_keystore.Keys.Count - 1 do
begin
akey:=ssh_Keystore.Keys[x];
if akey.IsPrivate then
serverreg.private_key_edit.Items.Add(ssh_Keystore.Keys[x].KeyName);
end;
The .IsPrivate does not seem to be set even though I have several keys that show in the design time editor as being private.
Posted: Tue 10 Feb 2009 08:44
by Dimon
I could not reproduce the problem.
Please make sure that you use the same path in design time and in run time.
Posted: Tue 10 Feb 2009 16:44
by snorkel
Dimon wrote:I could not reproduce the problem.
Please make sure that you use the same path in design time and in run time.
It's using the same path because if I remove the "if akey.IsPrivate then"
I then see all the key names in the combo box.
When I use the design time editor it checks the isprivate box when a private key is selected, so I am not sure what I am doing wrong.
Posted: Tue 10 Feb 2009 18:02
by snorkel
Dimon wrote:I could not reproduce the problem.
Please make sure that you use the same path in design time and in run time.
I got it working, apparently you have to manually set the key ready property to true for example:
for x := 0 to ssh_keystore.Keys.Count - 1 do
begin
akey:= ssh_Keystore.Keys.KeyByName(ssh_Keystore.Keys[x].KeyName);
akey.Ready:=true;
if akey.Ready then
begin
if akey.IsPrivate then
serverreg.private_key_edit.Items.Add(akey.KeyName);
end;
end;
Posted: Wed 11 Feb 2009 07:19
by Dimon
Yes, you are right.