<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: RSA: Encrypting in JavaScript and Decrypting in PHP</title>
	<atom:link href="http://www.sematopia.com/2008/10/rsa-encrypting-in-javascript-and-decrypting-in-php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sematopia.com/2008/10/rsa-encrypting-in-javascript-and-decrypting-in-php/</link>
	<description></description>
	<lastBuildDate>Wed, 08 Feb 2012 14:05:55 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: tarcard</title>
		<link>http://www.sematopia.com/2008/10/rsa-encrypting-in-javascript-and-decrypting-in-php/comment-page-1/#comment-393160</link>
		<dc:creator>tarcard</dc:creator>
		<pubDate>Mon, 18 Jul 2011 21:56:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.sematopia.com/?p=275#comment-393160</guid>
		<description>Got some issues with the PHP libraries, since they are based on PHP4 and im currently using PHP5.2 ... here&#039;s the issue:
&lt;cite&gt;
Strict Standards: Non-static method Crypt_RSA_MathLoader::loadWrapper() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\Crypt\RSA\Key.php on line 159
Strict Standards: Only variables should be assigned by reference in C:\xampp\php\PEAR\Crypt\RSA\Key.php on line 159
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\Crypt\RSA\ErrorHandler.php on line 150
Strict Standards: Non-static method Crypt_RSA_MathLoader::loadWrapper() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\Crypt\RSA.php on line 191
Strict Standards: Non-static method Crypt_RSA_MathLoader::loadWrapper() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\Crypt\RSA\MathLoader.php on line 98
&lt;/cite&gt;

Problem appears to be that PHP5 doesn&#039;t like all those static calls to functions... Is there any easy way to handle this problem or changing the code in the libraries are the only option?</description>
		<content:encoded><![CDATA[<p>Got some issues with the PHP libraries, since they are based on PHP4 and im currently using PHP5.2 &#8230; here&#8217;s the issue:<br />
<cite><br />
Strict Standards: Non-static method Crypt_RSA_MathLoader::loadWrapper() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\Crypt\RSA\Key.php on line 159<br />
Strict Standards: Only variables should be assigned by reference in C:\xampp\php\PEAR\Crypt\RSA\Key.php on line 159<br />
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\Crypt\RSA\ErrorHandler.php on line 150<br />
Strict Standards: Non-static method Crypt_RSA_MathLoader::loadWrapper() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\Crypt\RSA.php on line 191<br />
Strict Standards: Non-static method Crypt_RSA_MathLoader::loadWrapper() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\Crypt\RSA\MathLoader.php on line 98<br />
</cite></p>
<p>Problem appears to be that PHP5 doesn&#8217;t like all those static calls to functions&#8230; Is there any easy way to handle this problem or changing the code in the libraries are the only option?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: haleema</title>
		<link>http://www.sematopia.com/2008/10/rsa-encrypting-in-javascript-and-decrypting-in-php/comment-page-1/#comment-376746</link>
		<dc:creator>haleema</dc:creator>
		<pubDate>Thu, 07 Apr 2011 04:48:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.sematopia.com/?p=275#comment-376746</guid>
		<description>encrypting in javascript &amp; decrypting in php is working for me.</description>
		<content:encoded><![CDATA[<p>encrypting in javascript &amp; decrypting in php is working for me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: haleema</title>
		<link>http://www.sematopia.com/2008/10/rsa-encrypting-in-javascript-and-decrypting-in-php/comment-page-1/#comment-376745</link>
		<dc:creator>haleema</dc:creator>
		<pubDate>Thu, 07 Apr 2011 04:47:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.sematopia.com/?p=275#comment-376745</guid>
		<description>hey,
i was trying to encrypt in php &amp; decrypt in javascript using the same method. but decryption in javascript is not giving back the proper output ,it is giving some special characters. can anybody pls  tell me how to get bak de string in original format ?</description>
		<content:encoded><![CDATA[<p>hey,<br />
i was trying to encrypt in php &amp; decrypt in javascript using the same method. but decryption in javascript is not giving back the proper output ,it is giving some special characters. can anybody pls  tell me how to get bak de string in original format ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tola Anjorin</title>
		<link>http://www.sematopia.com/2008/10/rsa-encrypting-in-javascript-and-decrypting-in-php/comment-page-1/#comment-334252</link>
		<dc:creator>Tola Anjorin</dc:creator>
		<pubDate>Mon, 07 Feb 2011 11:02:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.sematopia.com/?p=275#comment-334252</guid>
		<description>Please am having trouble decrypting the string in php.


I think my problem is with the 

$m = $math_obj-&gt;int2bin(&quot;11570601966616835094916890432003700913&quot;);   

i think $m is supposed to be a string of binary, however, i get weird characters like y �2h�ߋi�5R� 

please any idea?</description>
		<content:encoded><![CDATA[<p>Please am having trouble decrypting the string in php.</p>
<p>I think my problem is with the </p>
<p>$m = $math_obj-&gt;int2bin(&#8220;11570601966616835094916890432003700913&#8243;);   </p>
<p>i think $m is supposed to be a string of binary, however, i get weird characters like y �2h�ߋi�5R� </p>
<p>please any idea?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zaid Crowe</title>
		<link>http://www.sematopia.com/2008/10/rsa-encrypting-in-javascript-and-decrypting-in-php/comment-page-1/#comment-316084</link>
		<dc:creator>Zaid Crowe</dc:creator>
		<pubDate>Fri, 07 Jan 2011 18:43:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.sematopia.com/?p=275#comment-316084</guid>
		<description>none of the examples above seem to work for strings over 13 chars - and I can&#039;t for the life of me work out why.

Any one have any ideas/explanations?</description>
		<content:encoded><![CDATA[<p>none of the examples above seem to work for strings over 13 chars &#8211; and I can&#8217;t for the life of me work out why.</p>
<p>Any one have any ideas/explanations?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: franck</title>
		<link>http://www.sematopia.com/2008/10/rsa-encrypting-in-javascript-and-decrypting-in-php/comment-page-1/#comment-293739</link>
		<dc:creator>franck</dc:creator>
		<pubDate>Thu, 25 Nov 2010 15:50:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.sematopia.com/?p=275#comment-293739</guid>
		<description>It seems to work well, thanks for this good script. I am going to use it when submitting passwords to authenticate users without SSL. I am truying to change keys each time, but you have done the hardest work.</description>
		<content:encoded><![CDATA[<p>It seems to work well, thanks for this good script. I am going to use it when submitting passwords to authenticate users without SSL. I am truying to change keys each time, but you have done the hardest work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://www.sematopia.com/2008/10/rsa-encrypting-in-javascript-and-decrypting-in-php/comment-page-1/#comment-274615</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Sat, 09 Oct 2010 09:53:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.sematopia.com/?p=275#comment-274615</guid>
		<description>Is it possible to link your javascript to working with this library?
http://phpseclib.sourceforge.net/

Is there a way to specify the key size when generating the public &amp; private keys? 128bit is very insecure for an assymetric algorithm.
http://en.wikipedia.org/wiki/Key_size#Asymmetric_algorithm_key_lengths</description>
		<content:encoded><![CDATA[<p>Is it possible to link your javascript to working with this library?<br />
<a href="http://phpseclib.sourceforge.net/" rel="nofollow">http://phpseclib.sourceforge.net/</a></p>
<p>Is there a way to specify the key size when generating the public &amp; private keys? 128bit is very insecure for an assymetric algorithm.<br />
<a href="http://en.wikipedia.org/wiki/Key_size#Asymmetric_algorithm_key_lengths" rel="nofollow">http://en.wikipedia.org/wiki/Key_size#Asymmetric_algorithm_key_lengths</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fie</title>
		<link>http://www.sematopia.com/2008/10/rsa-encrypting-in-javascript-and-decrypting-in-php/comment-page-1/#comment-225032</link>
		<dc:creator>fie</dc:creator>
		<pubDate>Sat, 01 May 2010 10:06:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.sematopia.com/?p=275#comment-225032</guid>
		<description>php, hex to bin
$bin_str = pack(&quot;H*&quot; , $hex_str);</description>
		<content:encoded><![CDATA[<p>php, hex to bin<br />
$bin_str = pack(&#8220;H*&#8221; , $hex_str);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: elsehair</title>
		<link>http://www.sematopia.com/2008/10/rsa-encrypting-in-javascript-and-decrypting-in-php/comment-page-1/#comment-202997</link>
		<dc:creator>elsehair</dc:creator>
		<pubDate>Mon, 07 Dec 2009 02:48:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.sematopia.com/?p=275#comment-202997</guid>
		<description>Using what essentially amounts to null padding on plaintexts means that the techniques described here are about as secure as ECB mode for block ciphers.  ie. it&#039;s not all that secure.  Personally, I think OAEP padding ought to be used.  PEAR&#039;s long since abandoned Crypt_RSA doesn&#039;t support it but phpseclib&#039;s Crypt_RSA does:

http://phpseclib.sourceforge.net/</description>
		<content:encoded><![CDATA[<p>Using what essentially amounts to null padding on plaintexts means that the techniques described here are about as secure as ECB mode for block ciphers.  ie. it&#8217;s not all that secure.  Personally, I think OAEP padding ought to be used.  PEAR&#8217;s long since abandoned Crypt_RSA doesn&#8217;t support it but phpseclib&#8217;s Crypt_RSA does:</p>
<p><a href="http://phpseclib.sourceforge.net/" rel="nofollow">http://phpseclib.sourceforge.net/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shrui</title>
		<link>http://www.sematopia.com/2008/10/rsa-encrypting-in-javascript-and-decrypting-in-php/comment-page-1/#comment-202522</link>
		<dc:creator>shrui</dc:creator>
		<pubDate>Tue, 01 Dec 2009 20:39:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.sematopia.com/?p=275#comment-202522</guid>
		<description>[code] destroy code....
function generate($key_len = null, $pubexp = null)//add the second parameter $
//...
//original code in KeyPair.php(CRYPT_RSA-1.0.0): line 245~271{
if($pubexp != null&amp;&amp;$this-&gt;_math_obj-&gt;cmpAbs($pubexp,2)&gt;0)
    $e = $this-&gt;_math_obj-&gt;nextPrime($this-&gt;_math_obj-&gt;dec($pubexp));
else{
    while(true){
        $e = $this-&gt;_math_obj-&gt;getRand($q_len, $this-&gt;_random_generator);
        if ($this-&gt;_math_obj-&gt;cmpAbs($e,2)_math_obj-&gt;nextPrime($this-&gt;_math_obj-&gt;dec($e));
        break;
    }
}
do{
    $p = $this-&gt;_math_obj-&gt;getRand($p_len, $this-&gt;_random_generator, true);
    $p = $this-&gt;_math_obj-&gt;nextPrime($p);
    do{
        do{
            $q = $this-&gt;_math_obj-&gt;getRand($q_len, $this-&gt;_random_generator, true);
            $tmp_len = $this-&gt;_math_obj-&gt;bitLen($this-&gt;_math_obj-&gt;mul($p, $q));
            if ($tmp_len  $key_len) $q_len--;
        } while ($tmp_len != $key_len);
        $q = $this-&gt;_math_obj-&gt;nextPrime($q);
        $tmp = $this-&gt;_math_obj-&gt;mul($p, $q);
    } while ($this-&gt;_math_obj-&gt;bitLen($tmp) != $key_len);
    // $n - is shared modulus
    $n = $this-&gt;_math_obj-&gt;mul($p, $q);
    // generate pubexp ($e) and private ($d) keys
    $pq = $this-&gt;_math_obj-&gt;mul($this-&gt;_math_obj-&gt;dec($p), $this-&gt;_math_obj-&gt;dec($q));
}while($this-&gt;_math_obj-&gt;cmpAbs($this-&gt;_math_obj-&gt;mod($pq,$e),0)==0);//mod() is a new method
//original code in KeyPair.php(CRYPT_RSA-1.0.0): line 245~271}</description>
		<content:encoded><![CDATA[<p>[code] destroy code....<br />
function generate($key_len = null, $pubexp = null)//add the second parameter $<br />
//...<br />
//original code in KeyPair.php(CRYPT_RSA-1.0.0): line 245~271{<br />
if($pubexp != null&amp;&amp;$this-&gt;_math_obj-&gt;cmpAbs($pubexp,2)&gt;0)<br />
    $e = $this-&gt;_math_obj-&gt;nextPrime($this-&gt;_math_obj-&gt;dec($pubexp));<br />
else{<br />
    while(true){<br />
        $e = $this-&gt;_math_obj-&gt;getRand($q_len, $this-&gt;_random_generator);<br />
        if ($this-&gt;_math_obj-&gt;cmpAbs($e,2)_math_obj-&gt;nextPrime($this-&gt;_math_obj-&gt;dec($e));<br />
        break;<br />
    }<br />
}<br />
do{<br />
    $p = $this-&gt;_math_obj-&gt;getRand($p_len, $this-&gt;_random_generator, true);<br />
    $p = $this-&gt;_math_obj-&gt;nextPrime($p);<br />
    do{<br />
        do{<br />
            $q = $this-&gt;_math_obj-&gt;getRand($q_len, $this-&gt;_random_generator, true);<br />
            $tmp_len = $this-&gt;_math_obj-&gt;bitLen($this-&gt;_math_obj-&gt;mul($p, $q));<br />
            if ($tmp_len  $key_len) $q_len--;<br />
        } while ($tmp_len != $key_len);<br />
        $q = $this-&gt;_math_obj-&gt;nextPrime($q);<br />
        $tmp = $this-&gt;_math_obj-&gt;mul($p, $q);<br />
    } while ($this-&gt;_math_obj-&gt;bitLen($tmp) != $key_len);<br />
    // $n - is shared modulus<br />
    $n = $this-&gt;_math_obj-&gt;mul($p, $q);<br />
    // generate pubexp ($e) and private ($d) keys<br />
    $pq = $this-&gt;_math_obj-&gt;mul($this-&gt;_math_obj-&gt;dec($p), $this-&gt;_math_obj-&gt;dec($q));<br />
}while($this-&gt;_math_obj-&gt;cmpAbs($this-&gt;_math_obj-&gt;mod($pq,$e),0)==0);//mod() is a new method<br />
//original code in KeyPair.php(CRYPT_RSA-1.0.0): line 245~271}</p>
]]></content:encoded>
	</item>
</channel>
</rss>

