https://github.com/slamdunk/php-p7m-reader
https://github.com/slamdunk/php-p7m-reader
openssl p7m php pkcs7
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/slamdunk/php-p7m-reader
- Owner: Slamdunk
- License: mit
- Created: 2019-10-04T10:41:02.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2025-08-09T12:28:43.000Z (11 months ago)
- Last Synced: 2025-08-09T14:29:52.112Z (11 months ago)
- Topics: openssl, p7m, php, pkcs7
- Language: PHP
- Size: 219 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Slam P7M Reader
[](https://packagist.org/packages/slam/php-p7m-reader)
[](https://packagist.org/packages/slam/php-p7m-reader)
[](https://github.com/Slamdunk/php-p7m-reader/actions)
[](https://codecov.io/gh/Slamdunk/php-p7m-reader)
## Installation
`composer require slam/php-p7m-reader`
## Requirements
1. `openssl` binary
1. `ext-openssl`
## Usage
*WARNING*: the signature is verified, but the validity of the certificate it is not!
```php
$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
```