I am writing a client software in QT 4.5 Commercial edition that need to send rsa encrypted data to server.
Steps are these:
1. get public key from server. The server gives (mod,exp) pair and nothing else
2. I need to encrypt data using "basic rsa" using the (mod,exp) and send to the server.

I am doing this to encrypt:

Qt Code:
  1. QString eee("22640209");//exp: got from server
  2.  
  3. QString mmm("95033496681677513042303794296510796923484007896833482880191206334940729008671");//mod:got from server
  4.  
  5. QCA::BigInteger exp11(eee);
  6. QCA::BigInteger mod11(mmm);
  7.  
  8. public_key = new QCA::RSAPublicKey(mod11,exp11,"rsa");
  9.  
  10. QCA::SecureArray data = "27712887867";
  11. QCA::SecureArray sarray = public_key->encrypt(data,QCA::EncryptionAlgorithm::EME_PKCS1v15);
  12.  
  13. QString sss(sarray.toByteArray());
  14. QString rstr = QCA::arrayToHex(sarray.toByteArray());
To copy to clipboard, switch view to plain text mode 
But, the problem is, the result never matches with the expected result (from a working java applicaton for same purpose which uses Bouncy Castle)

The correct output for the message "22640209" should be "7fcbaf7722eed6bf8914a924ac03de7e825d492f10a1487c8 4eb5d94989c5e91"

I am stuck and I have a deadline coming.

Any help is welcome.

Regards
Sarwar Erfan