title: RSA encryption and decryption
body: <p>im doing an assignment for school and we have to use rsa to crypt and sending data (for example password) to the server for user authentication i'm using php class for thet
  phpseclib, a pure PHP RSA implementation ! </p>
  
  <p>i can encrypt text</p>
  
  <pre><code>&lt;?php
  include('Math/BigInteger.php');
  include('Crypt/Hash.php');
  include('Crypt/RSA.php');
  ini_set('max_execution_time', 0);
  
  $rsa = new Crypt_RSA();
  extract($rsa-&gt;createKey());
  
  $plaintext = 'terrafrost';
  
  $rsa-&gt;loadKey($privatekey);
  $ciphertext = $rsa-&gt;encrypt($plaintext);
  
  
  echo"&lt;form action=\"dec.php\" method=\"post\"&gt;&lt;input name=\"ciphertext\" type=\"text\"  value=\"".$ciphertext."\"/&gt;";
  
  echo"&lt;input name=\"publickey\" type=\"text\"  value=\"".$publickey."\"/&gt;";
  echo"&lt;input type=\"submit\" name=\"button\" id=\"button\" value=\"Submit\" /&gt;&lt;/form&gt;";
  
  
  ?&gt;
  </code></pre>
  
  <p>but when i send the encrypted code to another page and try to decrypt it i get a errors </p>
  
  <blockquote>
    <p>Warning: unpack() [function.unpack]:
    Type N: not enough input, need 4, have
    3 in C:\wamp\www\RSA\Crypt\RSA.php on
    line 972</p>
    
    <p>Warning: extract() expects parameter 1
    to be array, boolean given in
    C:\wamp\www\RSA\Crypt\RSA.php on line
    972</p>
    
    <p>Notice: Undefined variable: length in
    C:\wamp\www\RSA\Crypt\RSA.php on line
    973</p>
    
    <p>Warning: unpack() [function.unpack]:
    Type N: not enough input, need 4, have
    0 in C:\wamp\www\RSA\Crypt\RSA.php on
    line 974</p>
    
    <p>Warning: extract() expects parameter 1
    to be array, boolean given in
    C:\wamp\www\RSA\Crypt\RSA.php on line
    974</p>
    
    <p>Notice: Undefined variable: length in
    C:\wamp\www\RSA\Crypt\RSA.php on line
    975</p>
  </blockquote>
  
  <p>here is my decryption page :</p>
  
  <pre><code>    &lt;?php
      include('Math/BigInteger.php');
      include('Crypt/Hash.php');
      include('Crypt/RSA.php');
      ini_set('max_execution_time', 0);
  
      $rsa = new Crypt_RSA();
  
      $publickey=$_POST['publickey'];
      $ciphertext = $_POST['ciphertext'];
  
      $rsa-&gt;loadKey($publickey);
      echo $rsa-&gt;decrypt($ciphertext);
  
  ?&gt;
  </code></pre>
  
  <p>am i missing something ?</p>