[CryptoAPI] phpseclib vs CryptoAPI

[CryptoAPI] phpseclib vs CryptoAPI

  
Forge Component
(4)
Published on 2015-11-29 by Ricardo Silva
4 votes
Published on 2015-11-29 by Ricardo Silva
I have the following scenery:
  1. i generate a RSA key pair in php using the phpseclib library;
  2. then i use CryptoAPI to encript some text using the public key generated before;
  3. then i try to use php to decrypt the previous encrypted text (using the private key, obviously), but this fails!
I'm fairly new in both php and this crypto stuff so i'm, most likely, doing something wrong. But i can't figure out what. 

Any help would be appreciated
Answering my own question,

in php you have to use 'base64_decode' on the cypher text returned by CryptoAPI. Only after doing this you call the phpseclib decrypt function.
I'm glad to see you were able to get CryptoAPI interacting with php :)

Perhaps you can share the code you're using here so other people who are after the same can also benefit ?
Ricardo Silva wrote:
I'm glad to see you were able to get CryptoAPI interacting with php :)

Perhaps you can share the code you're using here so other people who are after the same can also benefit ?
 Good idea!

Here's a php file with the code. It's a really basic one but i think it's enought to get the idea.