title: Javascript RSA decryption using private key
body: <p>Hello I have this script that I set in Javascript :</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
      &lt;html lang="en"&gt;
              &lt;head&gt;
              &lt;script src="jquery-1.7.2.min.js" type="text/javascript"&gt;&lt;/script&gt;
              &lt;script language="JavaScript" type="text/javascript" src="jsbn.js"&gt;&lt;/script&gt;
              &lt;script language="JavaScript" type="text/javascript" src="rsa.js"&gt;&lt;/script&gt;
              &lt;script language="JavaScript"&gt;
  
                  function encryptData(){
                      var pem ="-----BEGIN PUBLIC KEY-----\
                      MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+tii3IwzHa4i142kAB0dRVXoXA2Q8oF48UgMA\
                      AV54+JDED5iVyJK1s7J/xGi4U3+9sRoraE7bS19Nihs5DuYa0gsbKs/5jXOtKiw94fAtMyJTcX0d\
                      SzZhJKcX9vEzI27Hdu1rNFY64Ixz3KjrG1N/pXHtwjE1Ira5XZdTezx0wwIDAQAB\
                      -----END PUBLIC KEY-----";
                      var key = RSA.getPublicKey(pem);
                      var message = "some text to RSA encrypt";
                      var encryptedMessage = RSA.encrypt(message, key);
                      $('#RSAMessageEncrypted').html(encryptedMessage);
                  }
              &lt;/script&gt;
              &lt;/head&gt;
          &lt;body onload=encryptData();&gt;
          &lt;form&gt;
              &lt;strong&gt;RSA encrypted Message :&lt;/strong&gt; &lt;textarea rows="10" cols="100"   id="RSAMessageEncrypted"&gt;&lt;/textarea&gt;&lt;br&gt;
          &lt;/form&gt; 
          &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>My text area is filled with my message encrypted in RSA using the public key above.</p>
  
  <p>The encrypted message is :</p>
  
  <pre><code>oH1JVWIT7MOH4ObCjFlBuFcAUvooSZANMokFy5jApSi8n0ABVc9vwXP2EFl2x5+UColU6s2VAU+RsZPV4ZgZu3+GhN9pDUb1ZMVyYRECDy/7h+mE+UdDZTPwP1TAcBrspL/XM6+q6mJfUWbEKfR/2vyNUhBxpt6QOhVaI29aHfU=
  </code></pre>
  
  <p>My question is as following: How can I decrypt my message using the private key pair that this public key was derived from? Is there any library for decryption?</p>
  
  <p>My private key is :</p>
  
  <pre><code>-----BEGIN RSA PRIVATE KEY-----
  MIICXQIBAAKBgQC+tii3IwzHa4i142kAB0dRVXoXA2Q8oF48UgMAAV54+JDED5iVyJK1s7J/xGi4
  U3+9sRoraE7bS19Nihs5DuYa0gsbKs/5jXOtKiw94fAtMyJTcX0dSzZhJKcX9vEzI27Hdu1rNFY6
  4Ixz3KjrG1N/pXHtwjE1Ira5XZdTezx0wwIDAQABAoGBAJY4Gd4XZ6t1Epxi4oQ5N33jXGXgMAZp
  M5FD8EUCzw1ujWlB96iT8qvZPdLSPMJkUwxyAfELGoI13n3POR46lBhRpYKkTZm1UmEBscdO2B9w
  B7YUM9caJG4TgWBKxD8KLriQANnXZrv9zNGx4Cs0USeQgWuDfgkBF+PvL5AVq+jRAkEA+O0MNvBM
  kGtGCLt/V34jiivGs9HtXKSJY6vI60GYZYB7D3SniYVUsMocC+O3vyqdpMiO/szfLTAWdXB2yl3Q
  VwJBAMQhmQkT57rJ07SS40t1HGonryrmGF3BcHw9sVCijZF/jrbKeL5XmhnbCr9Lhy/InepcSRFI
  Pqzj32w0timLi3UCQCVsliKIXCp2RlA3yDxiNXunezc7v4DnJ9S5VfqwoPXZrCa1th6B0irGKBNN
  iCmQgaTtljoOmRsVGLtNTj68ff8CQGeiLR/b0bUkEeY3OzzS27nH0EoFnNhlbw9m9btauR0pXnp9
  j8FbvoRs9kfQG9WG1tJQAxfLqbpnCdY+IAbhwkUCQQDOIrm78sSuVL+U6f98P2eDSzhKgnepEEVJ
  u5iBs3lT5T+p+Xov6DPLd13Pm7Lyppj8S7pW/1CwkTVwW+U3O2kj
  -----END RSA PRIVATE KEY-----
  </code></pre>