Subject: Re: SSH-keygen in iPhone

Re: SSH-keygen in iPhone

From: Peter Stuge <>
Date: Mon, 16 Aug 2010 17:33:49 +0200

Paresh Thakor wrote:
> Does anyone know how can we generate ssh public/private key pair in
> iPhone..?

Since you are not asking about libssh2, why are you asking on the
libssh2 mailing list? This is not related in any way to libssh2.

> I'm trying to implement RSA key generation for iPhone..!

Then it would seem prudent to ask in an iPhone forum about cryptography.

> I've tested lots of code. I've also checked ssh-keygen.c from
> openssl

I know of two open source SSH key generators. One is ssh-keygen.c
from OpenSSH (not openssl, please try to be accurate, it makes
communication more efficient). OpenSSH depends on OpenSSL. If you
don't have OpenSSL in your target environment then this is not a good
choice. The other generator is the PuTTYgen codebase made by the
PuTTY authors, which uses it's own crypto layer, independent of
OpenSSL. If you are using libgcrypt for libssh2 then it would be best
to adapt one of the above implementations to use libgcrypt. This is
more work, but it makes your code smaller since you only need to
include/use one crypto library.

> but not able to find any proper help.

Your definition of "proper help" is just wrong. Both these codebases
can be used to solve your problem. If you do not understand those
programs well enough to isolate the parts which you need to reuse
then you should find someone who does, in order to complete your

> Can someone suggest me which way i should go? Is this iPhone SDK
> dependant, openssl or libssh2 problem?

libssh2 uses keys in the OpenSSH format. How you create those keys
is irrelevant for libssh2. OpenSSL could be used, but of course you
should use whatever is in the target system SDK.

> this is driving me crazzy.

Work on another project. Return to your current project later, when
you have more experience.

Received on 2010-08-16