Keystorage question (isprivate)

Discussion of open issues, suggestions and bugs regarding network security and data protection solution - SecureBridge
Post Reply
snorkel
Posts: 384
Joined: Tue 08 Aug 2006 15:10
Location: Milwaukee WI USA

Keystorage question (isprivate)

Post by snorkel » Mon 09 Feb 2009 20:31

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.

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Tue 10 Feb 2009 08:44

I could not reproduce the problem.
Please make sure that you use the same path in design time and in run time.

snorkel
Posts: 384
Joined: Tue 08 Aug 2006 15:10
Location: Milwaukee WI USA

Post by snorkel » Tue 10 Feb 2009 16:44

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.

snorkel
Posts: 384
Joined: Tue 08 Aug 2006 15:10
Location: Milwaukee WI USA

Post by snorkel » Tue 10 Feb 2009 18:02

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;

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Wed 11 Feb 2009 07:19

Yes, you are right.

Post Reply