Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

182
Views
Encrypting in php with Openssl on remote server and decrypting on local

I am encrypting a string on a remote server and saving the result in a .txt file. I generated a pair of public and private keys on my local server, and transferred the public key on the remote one. Summary of logic:

$publicKey = openssl_pkey_get_public(file_get_contents('public_key.pem'));
openssl_public_encrypt($toBeEncrypted, $encrypted, $publicKey);
file_put_contents('result.txt', $encrypted, FILE_APPEND); 

If I do both encryption and decryption on my local server, it works. However, it does not work if I transfer the encrypted file from remote to local server and attempt to decrypt. I assume this is a certificate issue, but I am not sure how to fix it. I don't think I fully understand the steps and components involved between encrypting the file on the remote server and decrypting it locally. Please shed some light of what I am missing.

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!