Error 30007 Private key must be loaded or generat - WeOnlyDo Discussion board

Error 30007 Private key must be loaded or generat (General questions)

by Giovanni Chiappini, Tuesday, October 26, 2004, 16:07 (7331 days ago)

Hi,

im trying this library but not able to working with key generation...
the GenerateKey function work without problem and return me a PrivateKey and PublicKey but when i try to read property such PublicKeyOpenSSH, PublicKeyRSA1 or PublicKeySSH i got the error.
Please, where am i wrong ??

thanks, Jo

ps. with VB sample 4 downloded with trial library i got the same error

Re: Error 30007 Private key must be loaded or gen

by wodSupport, Tuesday, October 26, 2004, 16:10 (7331 days ago) @ Giovanni Chiappini

Jo,

can you paste me some code here please? Basically, if you generate RSA key then you must provide this 'RSA' to PublicKeyXXXX and PrivateKeyXXXX properties. Do you do that?

In order to tell you more, code snippet would help.

Regards,
Kreso

Re: Error 30007 Private key must be loaded or gen

by Giovanni Chiappini, Tuesday, October 26, 2004, 17:14 (7331 days ago) @ wodSupport

Wow,

this is a fast support :)
i extract few rown of code from sample 4:

Private Sub Command1_Click()
Cert.GenerateKey 'RSAkey
Call DisplayPlublic
end sub

Private Sub DisplayPlublic()
On Error Resume Next
Dim a As String

a = Cert.PublicKeyOpenSSH
If Err = 0 Then Text2.Text = a
End Sub

i have understand that, after generation, i can get with function PublicKeyOpenSSH the public key to copy on the server.
The raw versione of public key in returned without error.

thanks again

Re: Error 30007 Private key must be loaded or gen

by wodSupport, Wednesday, October 27, 2004, 14:45 (7331 days ago) @ Giovanni Chiappini

I'm not sure why your code doesn't work. I tried something similar and it does work for me:
[code] Dim cert As New Certificate

On Error Resume Next
cert.LoadKey App.Path & mykey
If Err <> 0 Then
cert.GenerateKey 0 'rsakey
cert.SaveKey App.Path & mykey
End If

MsgBox cert.PublicKeyOpenSSH[/code]

Can you try it out and change to it suits your needs?

Re: Error 30007 Private key must be loaded or gen

by wodSupport, Wednesday, October 27, 2004, 14:59 (7331 days ago) @ wodSupport

Giovanni,

now I'm thinking more. I think [code]Cert.GenerateKey 'RSAkey
[/code] generates error in your code (so certificate isn't created at all) but you don't trap this error. Possible? GenerateKey requires one argument which you didn't specify.

Re: Error 30007 Private key must be loaded or gen

by Giovanni Chiappini, Wednesday, October 27, 2004, 15:29 (7331 days ago) @ wodSupport

Thanks,

i still continue to get the same error.

I have try also SFTP library and with that i am able to show the PublicKeyOpenSSH

Pity in the same application i must connect with both ftp and sftp server but SFTP library work only as sftp client of course.

I will try to reinstall the library FtpDLX.....

by Jo

Re: Error 30007 Private key must be loaded or gen

by wodSupport, Wednesday, October 27, 2004, 15:44 (7330 days ago) @ Giovanni Chiappini

Giovanni,

did try you my code?

Can you ZIP your VB app and send it over? This *must* work!

Re: Error 30007 Private key must be loaded or gen

by Giovanni Chiappini, Wednesday, October 27, 2004, 16:17 (7330 days ago) @ wodSupport

Yes a have tryed your sample. The key is generated without error ( i can display PrivateKey) but try to display PublicKeyOpenSSH (and other public keys) give me the error.
Now i send you the sample by email.

thanks

Re: Error 30007 Private key must be loaded or gen

by wodSupport, Thursday, October 28, 2004, 19:53 (7329 days ago) @ Giovanni Chiappini

Seems to work with fresh wodCertificate.DLL. I am not sure why it failed for you, and I'm not sure how did that 'bad' wodCertificate.DLL end up in installation.

Anyway, I'm glad problem is fixed!