Jump to content
saeiddavoody

Decrypt a string with public key using openssl in VCL app

Recommended Posts

Hi, In my VCL application I send a request to server and receive a data that encrypted by php openssl_private_encrypt. Now I want to decrypt it with a public key. I have the public key.

  1. How should I do that?
  2. Is there a third-party component to do that?
  3. what difference between using openssl library to decrypt data with public key and decrypting it using other library or pure RSA?

 

Update: Some components such as TMS CryptographyDelphi-OpenSSL decrypt data with private key not public key using openssl.

 

How should I decrypt the string with public key using openssl?

Edited by saeiddavoody

Share this post


Link to post

You can't. In SSL, public key is used to encrypt and private is to decrypt.

Share this post


Link to post
On 11/13/2024 at 7:05 AM, saeiddavoody said:

How should I decrypt the string with public key using openssl?

It is doable, but you need to understand what/which encryption scheme is used with php side that uses openssl, is it standardized one or not, then replicate that on Delphi application, one thing though the most crucial thing with RSA encryption is padding !, so ..

 

I suggest to go with TMS but before buying have your question to their support Sales/Technical, just make sure to give them full and detailed information unlike your question above, like what php code/library is doing the encryption so someone can identify the scheme/algorithm for you.

 

to get an idea of some of standards look at this page

https://www.cryptosys.net/pki/manpki/pki_rsaschemes.html

yet any code (like php) could be using its own implementation, hence it need to be custom decryption method and of course this include padding.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×