[Bug] Error in RSA Load PublicKey in XML Format

Get help with using the PHP Secure Communications Library.

Moderator: Nuxius

Forum rules
The purpose of this forum is to provide support for phpseclib, a pure PHP SSH / SFTP / RSA library.

Posts by new users are held in a moderation queue and are not publicly visible until the post is approved.

[Bug] Error in RSA Load PublicKey in XML Format

Postby j796160836us » Fri Sep 06, 2013 6:10 am

I posted an issues in github
https://github.com/phpseclib/phpseclib/issues/148

----------

Finally, I Found a workaround on web.
viewtopic.php?f=46&t=168524

Because the XML format of the PrivateKey contains PublicKey


I use a simply string replace made publicKey to privateKey format
Code: Select all
$public = str_replace('</RSAKeyValue>', '<P></P><Q></Q><DP></DP><DQ></DQ><InverseQ></InverseQ><D></D></RSAKeyValue>', $public);


Made publicKey
Code: Select all
<RSAKeyValue>
 <Modulus>AKoYq6Q7UN7vOFmPr4fSq2NORXHBMKm8p7h4JnQU+quLRxvYll9cn8OBhIXq9SnCYkbzBVBkqN4ZyMM4vlSWy66wWdwLNYFDtEo1RJ6yZBExIaRVvX/eP6yRnpS1b7m7T2Uc2yPq1DnWzVI+sIGR51s1/ROnQZswkPJHh71PThln</Modulus>
  <Exponent>AQAB</Exponent>
</RSAKeyValue>


To a patched publicKey :)
Code: Select all
<RSAKeyValue>
 <Modulus>AKoYq6Q7UN7vOFmPr4fSq2NORXHBMKm8p7h4JnQU+quLRxvYll9cn8OBhIXq9SnCYkbzBVBkqN4ZyMM4vlSWy66wWdwLNYFDtEo1RJ6yZBExIaRVvX/eP6yRnpS1b7m7T2Uc2yPq1DnWzVI+sIGR51s1/ROnQZswkPJHh71PThln</Modulus>
  <Exponent>AQAB</Exponent>
  <P></P>
  <Q></Q>
  <DP></DP>
  <DQ></DQ>
  <InverseQ></InverseQ>
  <D></D>
</RSAKeyValue>



then load key with privateKey format and explicitely said load publicKey.

Code: Select all
$rsa->loadKey($public, CRYPT_RSA_PRIVATE_FORMAT_XML);
$rsa->loadKey($rsa->getPublicKey());
j796160836us
Traveler
 
Posts: 2
Joined: Fri Sep 06, 2013 4:40 am

Re: [Bug] Error in RSA Load PublicKey in XML Format

Postby TerraFrost » Fri Sep 06, 2013 8:23 pm

I replied to your github.com post.

Basically, long story short, I'm pretty sure this issue is fixed in the latest Git version.
TerraFrost
Legendary Guard
 
Posts: 12357
Joined: Wed Dec 04, 2002 6:37 am


Return to phpseclib support

Who is online

Users browsing this forum: No registered users and 1 guest

cron