grafix4d Posted April 13 Share Posted April 13 Hi all, I have php-7.4.4-Win32-vc15-x86, installed and want to use openssl_pkcs7_encrypt in order to encrypt a stream. I prepare all input, checked all are ok, and after calling openssl_pkcs7_encrypt, if (!openssl_pkcs7_encrypt($messageData, $encryptedMessage, $filestream, [])) { // Check OpenSSL errors while ($error = openssl_error_string()) { echo "OpenSSL error: $error\n"; } } else { echo 'Encryption successful'; } I get error message: OpenSSL error: error:02001002:system library:fopen:No such file or directory OpenSSL error: error:2006D080:BIO routines:BIO_new_file:no such file Please note that the cert file is read using: $certfilepath = "C:/Users/user1/testfolder/test.cer"; $filestream = file_get_contents($certfilepath); I think something has to do with openssl environment, because everything else seems fine. Please help. Quote Link to comment https://forums.phpfreaks.com/topic/319839-openssl_pkcs7_encrypt-problem/ Share on other sites More sharing options...
requinix Posted April 14 Share Posted April 14 You want to encrypt a stream using functionality that encrypts files? That doesn't sound right... "No such file or directory" sounds relevant. Does the $messageData file exist, and is it readable by PHP? Does the $encryptedMessage file exist, or at least its parent directory, and is it writable by PHP? Quote Link to comment https://forums.phpfreaks.com/topic/319839-openssl_pkcs7_encrypt-problem/#findComment-1621184 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.