php-openssl

unable to verify openssl signature in php compare to nodejs

二次信任 提交于 2020-06-29 03:45:07
问题 I am able to verify the signature by using Nodejs crypto.createVerify whereas PHP: openssl_verify always return false. Nodejs: Getting correct result const encryptKey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; const crypto = require('crypto'); var data = Buffer.from(JSON.stringify(vd), "utf-8"); var password = Buffer.from(encryptKey, "utf-8"); var hashPassword = crypto.createHash('sha256').update(password).digest(); var data ='oubWLpvUHAX5Z/9fmiCx8PGTqDl0

Convert encrypt and decrypt C# function to PHP function

 ̄綄美尐妖づ 提交于 2020-06-24 08:33:21
问题 I would like to convert C# function to PHP function. Here is link to Function in C# : https://stackoverflow.com/a/19441805/3581428 public static string Encrypt(string clearText) { string EncryptionKey = "MAKV2SPBNI99212"; byte[] clearBytes = Encoding.Unicode.GetBytes(clearText); using (Aes encryptor = Aes.Create()) { Rfc2898DeriveBytes pdb = new Rfc2898DeriveBytes(EncryptionKey, new byte[] { 0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d, 0x65, 0x64, 0x76, 0x65, 0x64, 0x65, 0x76 }); encryptor.Key = pdb

Call to undefined function openssl_decrypt

吃可爱长大的小学妹 提交于 2020-05-27 05:27:18
问题 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 mypath/usuario_webservice.php on line 11 After some research the common reasons would be entering the wrong name for the function or the openssl extension not being installed on my web server. It turns out that it is installed as I checked with the support. So,

how to fix SSL certificate verification failure

夙愿已清 提交于 2020-02-04 09:50:56
问题 I use PHPMailer, along with Apache and PHP, locally. When I test my SSL config and my cacerts I get default_cert_file = C:\Program Files\Common Files\SSL/cert.pem default_cert_file_env = SSL_CERT_FILE default_cert_dir = C:\Program Files\Common Files\SSL/certs default_cert_dir_env = SSL_CERT_DIR default_private_dir = C:\Program Files\Common Files\SSL/private default_default_cert_area = C:\Program Files\Common Files\SSL ini_cafile = ini_capath = and then, I do var_dump(fsockopen("smtp.gmail.com

Decrypting using openssl des-ede from the command-line with zero padding and raw data

筅森魡賤 提交于 2020-01-17 05:53:04
问题 I am trying to recreate some openssl php code in the command-line. I have been able to get the following php code to work: $key = 'aaaaaaaabbbbbbbbccccccccdddddddd'; $key = pack('H*',$key); $data = 'b5057bbc04b842a96144a0f617f2820e'; $data = pack('H*',$data); $result = openssl_decrypt($data,'des-ede', $key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING); The Command I'm Working on (Ubuntu) openssl des-ede -in encrypted-data.txt -out decrypted-data.txt -d -K aaaaaaaabbbbbbbbccccccccdddddddd -nopad

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

你说的曾经没有我的故事 提交于 2020-01-15 01:07:43
问题 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 function for encryption function encrypt($text, $pw, $base64 = true) { $method = 'aes-256-cbc'; $iv_len = openssl_cipher_iv_length($method); $iv = openssl_random_pseudo_bytes($iv_len); $pw = substr(md5($pw),0,32); $cipher = openssl_encrypt ($text ,

How to encrypt data in php using Public/Private keys?

核能气质少年 提交于 2020-01-11 15:30:53
问题 I have a small string of some data (less than 1kb) that I would like to have user agents pass to other sites when they are sent from my site. In order for the other sites to verify that I was the one that created the string I though of two options. The server pings me back to confirm (like paypal, openid, etc..) I use public/private keys to prove I sent the message (like PGP, DKIM, etc..) I don't want to setup HMAC because that would mean I have to use custom keys for each site which would be

MCrypt rijndael-128 to OpenSSL aes-128-ecb conversion

為{幸葍}努か 提交于 2020-01-08 21:39:50
问题 Since Mcrypt is deprecated, I want to use OpenSSL instead in my code since we already using php 7.0.17 in our server and there's no tell when they upgrade it. Some third party API (hosted on PHP 5.x probably and using mcrypt ), is taking encrypted data. They've provided methods which they are using to encrypt/decrypt strings. Here are they $secret = 'a0a7e7997b6d5fcd55f4b5c32611b87c' ; public function encrypt128($str) { $block = mcrypt_get_block_size("rijndael_128", "ecb"); $pad = $block -

OpenSSL [des-ede3-cbc] Decryption php

六月ゝ 毕业季﹏ 提交于 2020-01-05 07:04:21
问题 i had to receive some data encrypted with 3DES with shared keys. I'm using php7 and openssl_decrypt function, but I'm not able to recreate the result of the example of the documentation sent to me. The OpenSSL command that create the data sent to me is the following: openssl enc -des-ede3-cbc -base64 -K 17839778773fadde0066e4578710928988398877bb123789 -iv 00000000 -in D:/in.txt Example: string_encoded: 123456 data_to_decrypt: Ja79hWTRfBE= I tried to decode "Ja79hWTRfBE=" with an online tool

PDO and openssl_public_decrypt failing

非 Y 不嫁゛ 提交于 2020-01-05 04:04:21
问题 I am trying to decrypt and update password into a mysql database table. while doing it is giving me a weird error. PHP Warning: PDO::exec(): SSL operation failed with code 1. OpenSSL Error messages: error:0906D06C:PEM routines:PEM_read_bio:no start line in .../vendor/robmorgan/phinx/src/Phinx/Db/Adapter/PdoAdapter.php on line 306 PHP Warning: PDO::exec(): MySQL server has gone away in .../vendor/robmorgan/phinx/src/Phinx/Db/Adapter/PdoAdapter.php on line 306 PHP Warning: PDO::exec(): Error