Questions tagged [php-openssl]

Using this extension, PHP can use some OpenSSL functions to do direct encryption. This tag should not be used for questions about encrypting traffic(HTTPS)

The OpenSSL extension for PHP uses the functions of (OpenSSL) for generation and verification of signatures and for doing full encryption and decryption of data. This module does not support the full suite of OpenSSL functions, but does offer access to actively maintained encryption libraries as opposed to deprecated libraries like .

For hashing (one-way encryption) check out

405 questions
6
votes
1 answer

How do I make openssl_encrypt pad the input to the required block size?

My code works if I manually pad my string to the length of 32. My question is: Is there a way to make the openSSL pad the data, or do I always have to do it for it? Working: openssl_encrypt ("my baba is over the ocean1111111", 'AES-256-CBC',…
Itay Moav -Malimovka
  • 52,579
  • 61
  • 190
  • 278
6
votes
1 answer

PHP RSA key creation

I have an issue with creating/using RSA keys created and used in PHP. Problem is, that the (public AND private) keys should be exchanged between different servers (e.g. when a user account is moved). Now, the openssl-lib of PHP does not provide any…
Xenonite
  • 1,823
  • 4
  • 26
  • 39
6
votes
4 answers

Call to undefined function openssl_decrypt

When I try to make a request with POST to a script that has this line: $decrypted_data = openssl_decrypt($encrypted_data, 'AES-256-CBC', $key); I get the following error: Fatal error: Call to undefined function openssl_decrypt() in…
CJ_COIMBRA
  • 319
  • 1
  • 3
  • 13
5
votes
1 answer

php7.2-openssl Alpine Docker install error

I'm building a Docker image with Alpine, php7.2-fpm and Composer. The problem happens while trying to install Composer, which uses https to download the installer via php. I added the repository to be able to install php7.2 (which is used to install…
5
votes
1 answer

How to decrypt a string with OpenSSL which was previously encrypted with mcrypt?

Since mcrypt was deprecated in PHP 7.1 and I have a lot of data encrypted/decrypted with mcrypt in existing project, how to migrate my PHP code from mcrypt to OpenSSL? I have the following code to encrypt: $encoded =…
Alexander Pravdin
  • 4,982
  • 3
  • 27
  • 30
5
votes
2 answers

MYSQLi and ssl connection to db server

I have some odd problem with establishing ssl connection using php. I have web and database server. On both I have generated certificates through openssl. They are exactly the same. So I'm trying to connect from webserver using mysql command: mysql…
LukeJ
  • 179
  • 5
  • 19
5
votes
4 answers

Encrypting (large) files in PHP with openSSL

I'm trying to encrypt (big) files in PHP using AES and have looked into using Mcrypt and OpenSSL, the problem is all solutions I have found so far only encrypt strings, and the files I'm trying to encrypt would trigger the max memory limit for PHP…
Sander
  • 53
  • 1
  • 3
5
votes
3 answers

Composer -- > error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

I can connect to SSL sites, installed composer through command line through HTTPS. Checked the OPENSSL version SSL Version => OpenSSL/1.0.1j . So where is the problem? Thoughts? Here is the raw output. [kunaaljain@localhost php]$…
Ignited
  • 771
  • 3
  • 7
  • 21
5
votes
2 answers

Get openssl certificate expiration date

I've parsed openssl certificate by openssl_x509_parse() function and got an array as a result. Now I need to get the expiration time of that certificate. In parsed array I have validTo_time_t element which contains a valid unix timestamp. But how to…
ozahorulia
  • 9,798
  • 8
  • 48
  • 72
5
votes
1 answer

AES encrypt in PHP with OpenSSL / decrypt in Node.js

I'm working on a symmetric encryption with OpenSSL using PHP and Nodejs. PHP uses the OpenSSL library, and Node.js decryption is based on the implemented crypto. The problem is that the decrypted text in Node.js is only partially correct. PHP…
HenningCash
  • 2,030
  • 18
  • 17
4
votes
1 answer

Delphi 7 - DCPCrypt - TDCP_rijndael - DecryptString - How to make it work?

I'm encrypting text in PHP (openssl_encrypt / 'aes-256-cbc') and then trying to decrypt it in Delphi 7 (DCPCrypt / TDCP_rijndael). The PHP script file is saved with ANSI encoding, in the hope that the string transmitted (its a REST API web service)…
Steve F
  • 1,527
  • 1
  • 29
  • 55
4
votes
1 answer

PHP Converting mcrypt to openssl

I know 3DES and MD5 are insecure. I will work on replacing them once I have it working again, I have a mobile app that is using 3DES with an MD5 of a key as a SECRET KEY to talk to a PHP Application. Now this code worked perfectly on PHP 5.3 (this…
Barkermn01
  • 6,781
  • 33
  • 83
4
votes
2 answers

Encrypt text in PHP and decrypt in Python

I am using following code snippet to encrypt a text in PHP7: $plaintext = "message to be encrypted"; $cipher = "aes-256-cbc"; $ivlen = openssl_cipher_iv_length($cipher); $iv = "0123456789012345"; $key = "akshayakshayaksh"; $ciphertext =…
Akshay Lokur
  • 6,680
  • 13
  • 43
  • 62
4
votes
1 answer

Translate Windows RC4 CryptDeriveKey to PHP for openssl

This is the second component of the legacy system translation we’ve been trying to do. We have managed to match exactly the initial binary password/key that Windows ::CryptHashData generates. That password/key is passed to ::CryptDeriveKey where it…
Cosworth66
  • 597
  • 5
  • 14
4
votes
2 answers

PHP Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher

I need to implement openSSL in my application, because we had to change the version from 5.6 to version 7.2 I would like to understand how to solve this problem. Any doubts that arise about my environment, or how I am using the application, just ask…
Jonatas Rodrigues
  • 57
  • 1
  • 2
  • 12
1 2
3
26 27