slam / php-p7m-reader
P7M Reader
Fund package maintenance!
Slamdunk
paypal.me/filippotessarotto
Installs: 13 399
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 3
Forks: 1
Open Issues: 3
Requires
- php: ~8.3.0 || ~8.4.0
- ext-openssl: *
- symfony/process: ^7.1.5
Requires (Dev)
- phpstan/phpstan: ^1.12.4
- phpstan/phpstan-phpunit: ^1.4.0
- phpunit/phpunit: ^11.3.6
- slam/php-cs-fixer-extensions: ^3.12.0
- slam/phpstan-extensions: ^6.5.0
README
Installation
composer require slam/php-p7m-reader
Requirements
openssl
binaryext-openssl
Usage
WARNING: the signature is verified, but the validity of the certificate it is not!
$p7mReader = \Slam\P7MReader\P7MReader::decodeFromFile( new \SplFileObject('/path/to/my.xml.p7m'), __DIR__ . '/tmp' // Optional custom temporary directory, defaults to sys_get_temp_dir() ); // OR $p7mReader = \Slam\P7MReader\P7MReader::decodeFromBase64( 'Abc==', // base64 encoded content file __DIR__ . '/tmp' // Optional custom temporary directory, defaults to sys_get_temp_dir() ); var_dump($p7mReader->getP7mFile()); // string: The original P7M file var_dump($p7mReader->getContentFile()); // SplFileObject: The signed content var_dump($p7mReader->getCertFile()); // SplFileObject: The certificate var_dump($p7mReader->getCertData()); // array: Certificate data in openssl_x509_parse output format