php-openssl

PHP RSA key creation

柔情痞子 提交于 2019-12-01 03:14:32
问题 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 detailed info on in what format the keys are created. The latest documentation at http://php.net/manual/en/function.openssl-pkey-export.php just states, that it is "in PEM format", but it does not say whether it is in PKCS#1 or PKCS#8 Additionally,

Cryptographically secure unique id

别说谁变了你拦得住时间么 提交于 2019-11-29 17:22:22
问题 I want to generate cryptographically secure unique uuids using php. uniqid() provides unique but not secure ids and openssl_random_pseudo_bytes() provides secure but not unique ids. Is the combination of the two(following code) a proper approach or is there a better solution? uniqid(bin2hex(openssl_random_pseudo_bytes(10)), true); 回答1: I want to generate cryptographically secure unique uuids using php. Okay, that's easily done. uniqid() provides unique but not secure ids and openssl_random

SSL3_GET_SERVER_CERTIFICATE certificate verify failed on Windows 10 Pro with IIS

不问归期 提交于 2019-11-29 16:26:46
When trying to send emails through smtp.google.com via PHPMailer on PHP hosted by IIS on Windows 10, I get this error message: Connection failed. Error #2: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages error:14090086 SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed The key part of that error I'm sure is certificate verify failed . I'm running OpenSSL and it's enabled and linked to my php. Here is some info output by my local PHP instance: OpenSSL support => enabled OpenSSL Library Version => OpenSSL 1.0.1p 9 Jul 2015 OpenSSL Header

Warning while installing Composer on a Mac

僤鯓⒐⒋嵵緔 提交于 2019-11-28 14:16:19
My Mac has OpenSSL version 1.0.1t, but when I tried to install Composer, I got an error : Some settings on your machine may cause stability issues with Composer. If you encounter issues, try to change the following: The OpenSSL library (0.9.8zc) used by PHP does not support TLSv1.2 or TLSv1.1. If possible you should upgrade OpenSSL to version 1.0.1 or above. How can I resolve this possible stability issue? The version of the OpenSSL binary that you have installed doesn't matter, the important detail is the version that PHP was compiled with. It sounds like you are using the version of PHP

Encrypting (large) files in PHP with openSSL

夙愿已清 提交于 2019-11-28 12:34:09
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 (which unfortunately can't be set higher), how would I go about achieving this? You could use CBC encryption using Mcrypt and then encrypt a segment of data at a time. Make sure that the segment is x times the block size of the used cipher (e.g. 16 bytes for AES). Encrypt the segment and take the last block of the generated ciphertext and use it as

SSL3_GET_SERVER_CERTIFICATE certificate verify failed on Windows 10 Pro with IIS

て烟熏妆下的殇ゞ 提交于 2019-11-28 10:26:33
问题 When trying to send emails through smtp.google.com via PHPMailer on PHP hosted by IIS on Windows 10, I get this error message: Connection failed. Error #2: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages error:14090086 SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed The key part of that error I'm sure is certificate verify failed . I'm running OpenSSL and it's enabled and linked to my php. Here is some info output by my local PHP

How to encrypt plaintext with AES-256 CBC in PHP using OpenSSL?

ε祈祈猫儿з 提交于 2019-11-28 09:31:05
I am trying to encrypt sensitive user data like personal messages in my php powered website before entering into the database. I have researched a bit on the internet and I have found the few important things to remember: Never use mcrypt, it's abandonware. AES is based on the Rijndael algorithm and has been unbroken till now. AES has also been recommended by NSA and used in US Government data encryption, but since the NSA is recommending it, there's a chance they might sneak upon my user data easily. Blowfish has been unbroken as well, but slow and less popular. So, I decided I will give it a

Supplied key param cannot be coerced into a private key with Google APIs

荒凉一梦 提交于 2019-11-27 15:35:53
I'm trying to test this example that I found here so that I can do a direct upload on the client side without having the user login using Google Cloud Storage. All of the constants expressed have their correct values, and the path is correct and does not have an empty contents. The error I'm getting: openssl_sign(): supplied key param cannot be coerced into a private key My function implemented is: public static function storageURL( $id, $method = 'GET', $duration = 10 ) { $key = file_get_contents(self::KEY_FILE); $pkey = openssl_get_privatekey($key, 'notasecret'); $expires = time( ) +

Warning while installing Composer on a Mac

╄→尐↘猪︶ㄣ 提交于 2019-11-27 08:24:33
问题 My Mac has OpenSSL version 1.0.1t, but when I tried to install Composer, I got an error: Some settings on your machine may cause stability issues with Composer. If you encounter issues, try to change the following: The OpenSSL library (0.9.8zc) used by PHP does not support TLSv1.2 or TLSv1.1. If possible you should upgrade OpenSSL to version 1.0.1 or above. How can I resolve this possible stability issue? 回答1: The version of the OpenSSL binary that you have installed doesn't matter, the

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

為{幸葍}努か 提交于 2019-11-27 07:14:59
问题 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', $MY_SECRET_KEY,OPENSSL_RAW_DATA|OPENSSL_ZERO_PADDING,$MY_IV); Not working: openssl_encrypt ("my baba is over the ocean", 'AES-256-CBC', $MY_SECRET_KEY,OPENSSL_RAW_DATA|OPENSSL_ZERO_PADDING,$MY_IV); I solve this currently by self padding: $pad = 32 -