A few pointers:
try to see if the jsch example
http://www.jcraft.com/jsch/examples/UserAuthPubKey.java
works for you with this key (on a linux machine of course).
If it does, then this is an android problem - Maybe you should add the
bouncycastle library to your project -- see my application:
https://code.google.com/p/ssh-persistent-tunnel/source/browse/src/org/ayal/SPT/Main.java#91
and the README
https://code.google.com/p/ssh-persistent-tunnel/source/browse/README.build
If it doesn't work on linux, then this is key problem ....
On Mon, Nov 11, 2013 at 9:52 PM, Gerry Reno <gr...@verizon.net> wrote:
> Hi Shai,
>
> Ok, here is one of my key sets that fail:
>
> -----BEGIN PRIVATE KEY-----
> MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBALjYkwBTqhl5P8E
> NLB5jOUeIybMI2DL7bmQ1wTpWC8KCBaeCQmgqB/dUS23qYPJuaiuRnqofC7vsqr
> xdA3ci7Y+DivcXhxeq3mI6oJqrsr0zCRuqpS1nSas9etXFY88odSA3N1z45Fybs
> X1aQl84Q/DD2XDxwA5g3tnPH1Fhqxz7AgMBAAECgYEAhn3t11sIdKhn3sr6wtFn
> J8k7GGzjAZU3aOpDwXJB9DAudQat0qRiT26hw0O5biswTKsTSqx0GTPFtm/myZQ
> 8S+aYqj4r5B+PqkN6WQa7GaHSkksaYMJugEioo9L+Bv0Xfw7jgLcM5IGLpYdk5X
> 6v4PEIPYywtyh2Xfs9IGcjHUECQQDiUZZ9x7lrBRaVmK1n84712BgQraoK6i5Uo
> mpu1nPsSPE7eGl0kLzP7wCZWkEDUjOVA4aW4CSM4RY/6jcKujuDAkEA0RaVdMGy
> U2nU+uIxa2jvraHG8qdeyPl9bfDP3PlSEfCiI7JThEDsD551LZlCEmJVOBA6Feg
> /E4xXxOujzD0HKQJAd745RLWOyiv4BhCw9wYrxrGeEf0AsiOzfb4tWBWJYiQ51o
> BgM3d9HvtSstDJAyvT9OzXoi5XyF4zen++vaNJZwJBAJW7KoRWQbHiVBbl7KYSm
> 7En7STQHtylbeFRVknUcaVPQY12osBPDb2RqDBjVCF+MbDYTgBqNOF221O1u7MC
> 8SECQHNH2382GUgOATtd9/Cp7SZg0WvW5tsBjFHRgIu0L0Q2OzE9mJCH2TBwzOj
> 2wcgkEsvyeP1BxtKC0tS6vniUoAw=
> -----END PRIVATE KEY-----
>
> ssh-rsa
>
> AAAAB3NzaC1yc2EAAAADAQABAAAAgQC42JMAU6oZeT/BDSweYzlHiMmzCNgy+25kNcE6VgvCggWngkJoKgf3VEtt6mDybmorkZ6qHwu77Kq8XQN3Iu2Pg4r3F4cXqt5iOqCaq7K9MwkbqqUtZ0mrPXrVxWPPKHUgNzdc+ORcm7F9WkJfOEPww9lw8cAOYN7Zzx9RYasc+w==
> phonekey
>
>
>
> On 11/11/2013 02:39 PM, Shai Ayal wrote:
> > Maybe you can send us sample of the private key -- not this one, just
> generate another one in the same way, see that
> > it still doesn't work, and send the keys to the list -- it would help a
> lot
> >
> >
> > On Mon, Nov 11, 2013 at 9:08 PM, Gerry Reno <gr...@verizon.net <mailto:
> gr...@verizon.net>> wrote:
> >
> > Some further information.
> >
> > I changed everything over to read both keyfiles into byte arrays
> privatekey and publickey.
> >
> > and then call addIdentity( name, privatekey, publickey, passphrase);
> // I just passed (byte[])null for passphrase
> > since
> > there is none
> >
> > and still I get same error: invalid privatekey: [B@41a9d1e0
> >
> > When I dump the arrays to the Log as strings the keys are correct.
> >
> >
> > On 11/11/2013 10:23 AM, Gerry Reno wrote:
> > > Hi Volker,
> > >
> > > Thanks for the reply.
> > >
> > > I should have mentioned that I already had both public and
> private keys in the same folder on the Android
> > device.
> > > The keys have the same prefix only difference is that .pub is
> added for public key. Eg: id_rsa and id_rsa.pub.
> > >
> > > I had read about needing the public key in the folder when I
> checked the method.
> > >
> > > The perms on both files are rw-rw-r-- when I upload the keys.
> And without a rooted phone I have no way to
> > change
> > > those permissions. Could this be a factor?
> > >
> > > If so, I guess I could read the file into a String and call
> one of the alternate methods although I'd really
> > prefer
> > > to just use the simpler method. Any way to get that working?
> > >
> > >
> > > On 11/11/2013 03:18 AM, Jung, Volker wrote:
> > >> Hello Gerry,
> > >>
> > >> when using the addIdentity-Method taking only the
> private-key-path, the public key is expected to be in the
> > same folder as the private key, having the same name as the private
> key with an additional suffix ".pub". (See
> > KeyPair.load(JSch, String, String)). You might want to use one of
> the other addIdentity-Methods provided by the
> > JSch-class to be independent of that default behavior.
> > >>
> > >>
> > >> -----Ursprüngliche Nachricht-----
> > >> Von: Gerry Reno [mailto:gr...@verizon.net <mailto:
> gr...@verizon.net>]
> > >> Gesendet: Sonntag, 10. November 2013 21:31
> > >> An: jsch-users@lists.sourceforge.net <mailto:
> jsch-users@lists.sourceforge.net>
> > >> Betreff: [JSch-users] addIdentity: on android getting invalid
> privatekey: [B@428ff138 with known good RSA key
> > >>
> > >> Using JSch 1.50
> > >>
> > >> I'm trying to get publickey auth working on arm android.
> > >>
> > >> I have password auth working fine already.
> > >>
> > >> So I added addIdentity( keypath ) but it always errors even with
> known good RSA key.
> > >>
> > >> I tested the key both on the phone using ConnectBot and on two
> linux machines using openssh.
> > >>
> > >> The key works fine from all three.
> > >>
> > >> When I use the addIdentity method and pass the key path I'm
> always getting an error, invalid privatekey:
> > [B@428ff138
> > >>
> > >> Is there something else I need to add besides addIdentity to make
> this work?
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> ------------------------------------------------------------------------------
> > >> November Webinars for C, C++, Fortran Developers Accelerate
> application performance with scalable programming
> > models. Explore techniques for threading, error checking, porting,
> and tuning. Get the most from the latest Intel
> > processors and coprocessors. See abstracts and register
> >
> http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
> > >> _______________________________________________
> > >> JSch-users mailing list
> > >> JSch-users@lists.sourceforge.net <mailto:
> JSch-users@lists.sourceforge.net>
> > >> https://lists.sourceforge.net/lists/listinfo/jsch-users
> > >>
> > >>
> ------------------------------------------------------------------------------
> > >> November Webinars for C, C++, Fortran Developers
> > >> Accelerate application performance with scalable programming
> models. Explore
> > >> techniques for threading, error checking, porting, and tuning.
> Get the most
> > >> from the latest Intel processors and coprocessors. See abstracts
> and register
> > >>
> http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
> > >> _______________________________________________
> > >> JSch-users mailing list
> > >> JSch-users@lists.sourceforge.net <mailto:
> JSch-users@lists.sourceforge.net>
> > >> https://lists.sourceforge.net/lists/listinfo/jsch-users
> > >>
> >
> >
> >
> >
> ------------------------------------------------------------------------------
> > November Webinars for C, C++, Fortran Developers
> > Accelerate application performance with scalable programming models.
> Explore
> > techniques for threading, error checking, porting, and tuning. Get
> the most
> > from the latest Intel processors and coprocessors. See abstracts and
> register
> >
> http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
> > _______________________________________________
> > JSch-users mailing list
> > JSch-users@lists.sourceforge.net <mailto:
> JSch-users@lists.sourceforge.net>
> > https://lists.sourceforge.net/lists/listinfo/jsch-users
> >
> >
> >
> >
> > --
> > SPT <https://market.android.com/details?id=org.ayal.SPT> - persistent
> SSH tunnels for android.
>
>
>
>
> ------------------------------------------------------------------------------
> November Webinars for C, C++, Fortran Developers
> Accelerate application performance with scalable programming models.
> Explore
> techniques for threading, error checking, porting, and tuning. Get the most
> from the latest Intel processors and coprocessors. See abstracts and
> register
> http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
> _______________________________________________
> JSch-users mailing list
> JSch-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jsch-users
>
--
SPT <https://market.android.com/details?id=org.ayal.SPT> - persistent SSH
tunnels for android.
------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
JSch-users mailing list
JSch-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jsch-users