php-openssl

Signing with a private key as a string in php

非 Y 不嫁゛ 提交于 2019-12-25 04:40:43
问题 I have a private key stored as a string (hard coded), and I need to sign a string with that key. I could use openssl, but I don't find in the documentation how to use my private key. I only see how to use pem files, or things related to certificates, whereas my process has nothing to do with certificates or anything of the sort. The private key comes from a Java desktop application and has been generated with the class KeyPairGenerator KeyPairGenerator keyGen = KeyPairGenerator.getInstance(

does OpenSSL support ECDH?

你离开我真会死。 提交于 2019-12-25 01:16:36
问题 openssl_dh_compute_key() makes me think OpenSSL doesn't ECDH. It only talks about DH, not ECDH. Further, the public key is basically just a prime number in base-256 and there are specific instructions on how to remove the -----BEGIN PUBLIC KEY----- part of the public key, as though it's not supported. Plus, technically, strings beginning with -----BEGIN PUBLIC KEY----- are valid base-256 numbers. Assuming ECDH keys are the same as ECDSA keys, then a public key for ECDH consists of the X, Y

Unable to download binary file in PHP

帅比萌擦擦* 提交于 2019-12-24 02:28:05
问题 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 so: $certificate_tmp=$_FILES['certificate']['tmp_name']; $certificate=openssl_encrypt(file_get_contents($certificate_tmp),$ciphers,$password_tmp); $wpdb->insert("my_table",array("certificate"=>$certificate)); Note: I've cut unrelated code, the table is not just certificate, but I don't want this to get confusing. This is the download php page: $password

OSX - Composer - lib-openssl requirements

岁酱吖の 提交于 2019-12-23 16:56:43
问题 Since the last XCode Update to version 7.3.1 i run into problems with composer and openssl on OSX. It worked before update. I try to update packages via composer update. The package "ricardoper/twitteroauth" requires lib-openssl: "*" . The following error is thrown while running composer update: ricardoper/twitteroauth v2.1.5 requires lib-openssl * -> the requested linked library openssl has the wrong version installed or is missing from your system, make sure to have the extension providing

Php composer openssl error

不羁岁月 提交于 2019-12-23 07:41:31
问题 Before asking, i have to say that I have tried every similar question here on stack and elsewhere and failed. I am unable to use composer because of this error: requires ext-openssl * -> the requested PHP extension openssl is missing from your system. I have xampp on ubuntu . What I have tried: I have uncommented ;extension=php_openssl.dll in php.ini (both cli and normal) - did not work Installed openssl through terminal outside of php - did not work Check in phpinfo() if openssl is loaded

openssl_encrypt & AES256

*爱你&永不变心* 提交于 2019-12-23 04:42:04
问题 maybe someone know how do this on PHP echo "TEST" | openssl enc -e -aes-256-cbc -k 123456 -a -md md5 i will try like $iv = openssl_random_pseudo_bytes(16); $data = base64_encode(openssl_encrypt('TEST', 'aes-256-cbc', $password, OPENSSL_RAW_DATA, $iv)); but not success.. 回答1: Interestingly, like the version at https://linux.die.net/man/1/enc , the man page for my local openssl installation lists '-md' (without an argument) as an option for openssl enc - but doesn't seem to explain what its for

What is an openssl iv, and why do I need a key and an iv?

本秂侑毒 提交于 2019-12-22 01:52:14
问题 I am about to use the following script to encrypt and decrypt some data. I am using it because my current encryption does not work on our new server. We are currently using mcrypt so I want to change to openssl. In our database we use aes encryption which uses a 128bit key so I know what a key is, but I do not know what an openssl iv is? And why would I need a key and an iv. The code I am about to use is this, which I found on a website because I don't understand encryption very well.

How to upgrade openssl 0.9.8 to 1.0.2 with mod_ssl in Apache 2.2.9

微笑、不失礼 提交于 2019-12-22 00:35:35
问题 I am asked to recompile mo_ssl with openssl 1.0.2 in SuseSE11SP3. However, I am a newbie to Suse, but know a little bit of linux. OS : Suse SE11SP3 Openssl : 0.9.8j <-which comes with original Suse linux Web Server : Apache httpd 2.2.9 Here is limitation I have. I cannot use zypper or rpm because company security policy does not allow me to do it. It is absurd, this is how it goes here. Another limitation I have is this system is used by other web servers which I don't have permission. I have

Issue decrypting Alexa request signature using openssl_public_decrypt

早过忘川 提交于 2019-12-22 00:00:31
问题 I'm implementing a validator for validating incoming requests from Amazon Alexa. I'm on step 5 and 6 which state: 5) base64-decode the Signature header value on the request to obtain the encrypted signature. 6) Use the public key extracted from the signing certificate to decrypt the encrypted signature to produce the asserted hash value. I've managed to extract the public key from the PEM-encoded X.509 certificate by doing: $publicKey = openssl_pkey_get_public($pem); $keyData = openssl_pkey

How to implement php's openssl_encrypt() method in iOS Objective-C?

那年仲夏 提交于 2019-12-20 07:47:31
问题 I want to implement php's openssl_encrypt() method in iOS Objective-C . Therefore I tried this code: #import <CommonCrypto/CommonHMAC.h> #import <CommonCrypto/CommonCryptor.h> - (void)viewDidLoad { [super viewDidLoad]; NSData *dataIn = [@"123456" dataUsingEncoding:NSISOLatin1StringEncoding]; NSString *key = @"ygXa6pBJOWSAXXX/J6POVTjvJpMIiPAMQiTMjBrcOGw="; NSData *decodedKeyData = [[NSData alloc] initWithBase64EncodedString:key options:0]; uint8_t randomBytes[16]; NSMutableString *ivStr; int