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
2
votes
1 answer

openssl_encrypt VS mcrypt_encrypt

I have to do AES 128 encryption in CBC mode and match it with the same AES encyption in coldfusion. Here is my code in PHP: function pkcs5_pad($text, $blocksize) { $pad = $blocksize - (strlen($text) % $blocksize); return $text .…
oussama kamal
  • 1,027
  • 2
  • 20
  • 44
2
votes
1 answer

How to read a Thumbprint of a Certificate from a path in PHP

I'm having a Certificate and I wish to read the SHA 1 Fingerprint and SHA 256 Fingerprint from a file path.
B.Balamanigandan
  • 4,713
  • 11
  • 68
  • 130
2
votes
1 answer

Convert framework from mcrypt to openssl

I'm working on developing encrypted session handling. The examples I have been provided use mcrypt, and while I know enough to modify the examples to work for my code, I do not know enough to convert Mcrypt to Openssl. private function…
Cyberpower678
  • 159
  • 1
  • 13
2
votes
1 answer

Can certificate store be placed in application.ini instead of php.ini

I am working on Zend-Framework 1.12 and had to make an https request from the application. I did it by the following way: $client = new Zend_Http_Client($url); $client->setAdapter($adaptor); $client->setConfig(array('keepalive' =>…
Ashish Ranjan
  • 12,760
  • 5
  • 27
  • 51
2
votes
2 answers

Openssl Encryption Random Key&IV- Store in DB

I have read a lot about encryption and know a lot of new things have come out since php 7. I am writing two functions (encrypt and decrpyt) to store encrypted data in my db. I understand how openssl function works but I am wondering if I am storing…
user982853
  • 2,470
  • 14
  • 55
  • 82
2
votes
1 answer

What is android equivalent of openssl_public_encrypt in php?

I am a PHP developer(not an android developer). I outsourced the development of an Android app, and for communication between the app and my PHP server, I intend to have asymmetrical encryption(public-private key encryption). At PHP level, I know…
kadamb
  • 1,532
  • 3
  • 29
  • 55
2
votes
1 answer

AES-256-CBC Encryption/Decryption hex string using openssl in php

I'm a noob developer and I'm trying to decrypt some data but when I use OpenSSL in PHP I received no response. Also, when trying to encrypt data OpenSSL add a block of characters. This is the code:
2
votes
1 answer

Convert Mcrypt RC4 to PHP-OpenSSL

I updated a serve from php 5 to php 7 and mcrypt function now is deprecated. I have the following code: $encryptedUserInfo = @mcrypt_encrypt(MCRYPT_ARCFOUR, $sessionKey, $json, MCRYPT_MODE_STREAM); Reading some post in stackoverflow i found this…
TacticJuls
  • 304
  • 1
  • 8
2
votes
1 answer

openssl_encrypt doesn't work and gives no error?

I searched for how to use openssl_encrypt correctly, and found several stackoverflow questions and answers. However, I'm afraid I just can't get it to work. My current code looks like this: $encryption_key = openssl_random_pseudo_bytes(32); $iv =…
Danmoreng
  • 2,367
  • 1
  • 19
  • 32
2
votes
0 answers

Resource id #2 when using openssl_pkey_get_private();

I get a resource(2) of type (OpenSSL key) Resource id #2 error when running the decryption.php file can anyone help? My decryption.php file:
david david
  • 185
  • 2
  • 14
2
votes
3 answers

Encrypting in PHP, decrypting in IOS

I'm trying to figure out how to send encrypted data to my IOS app from a web page. In php I have a page that encrypts a string and then echos it out as a base64 encoded string:
AndyD273
  • 7,177
  • 12
  • 54
  • 92
2
votes
1 answer

Unable to download binary file in PHP

I have to encrypt a file and save it in mysql as a blob, then decrypt it and make it available for download. I save the file in a blob like…
Cr1xus
  • 427
  • 3
  • 20
2
votes
1 answer

openssl extension is missing (Composer installation openSUSE)

After i downloaded the composer installer file from the composer website i tried to install it using command : ~> php installer Output : Some settings on your machine make Composer unable to work properly. Make sure that you fix the issues listed…
Zakaria Guenna
  • 129
  • 1
  • 12
2
votes
2 answers

openssl_pkey_get_public returning false, but key does exist

I'm using a library that uses openssl_pkey_get_public, but it's returning false. It seems that openssl is enabled, and the key exists. Below are the few lines from the library I'm using, btw which I am debugging but cannot modify as it is not my…
Martyn
  • 6,031
  • 12
  • 55
  • 121
2
votes
0 answers

Do I need to hash before using openssl_sign?

The 4th argument of the openssl_sign function is the signing digest algorithm. So, does that mean that the openssl_sign function already does the hashing before signing it? Or should I still hash my data before passing to openssl_sign?
rsc
  • 10,348
  • 5
  • 39
  • 36