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] 
>> Gesendet: Sonntag, 10. November 2013 21:31
>> An: 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
>> 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
>> 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
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to