Error openssl_pkcs7_sign()
Publicado por Victor Garcia (1 intervención) el 17/04/2023 21:56:38
Junto con saludar tengo el siguiente error que no he podido solucionar.
Warning: openssl_pkcs7_sign() expects parameter 1 to be a valid path, string given in
parte del codigo.
<?php
$pfx = file_get_contents('004-26042021.pfx');
$password = 'xxxxxx'; // La contraseña utilizada para proteger el archivo PFX
if(openssl_pkcs12_read($pfx, $certs, $password)) {
$private_key = $certs['pkey'];
$certificate = $certs['cert'];
}
$file = file_get_contents('DOCUMENTO-001.pdf');
$signed_file = '';
if(openssl_pkcs7_sign($file, $signed_file, $certificate, $private_key, array(), PKCS7_BINARY)) {
file_put_contents('archivo_firmado.p7s', $signed_file);
}
?>
Warning: openssl_pkcs7_sign() expects parameter 1 to be a valid path, string given in
parte del codigo.
<?php
$pfx = file_get_contents('004-26042021.pfx');
$password = 'xxxxxx'; // La contraseña utilizada para proteger el archivo PFX
if(openssl_pkcs12_read($pfx, $certs, $password)) {
$private_key = $certs['pkey'];
$certificate = $certs['cert'];
}
$file = file_get_contents('DOCUMENTO-001.pdf');
$signed_file = '';
if(openssl_pkcs7_sign($file, $signed_file, $certificate, $private_key, array(), PKCS7_BINARY)) {
file_put_contents('archivo_firmado.p7s', $signed_file);
}
?>
Valora esta pregunta


0