PHPackages                             zbateson/mmp-crypt-smime - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. zbateson/mmp-crypt-smime

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

zbateson/mmp-crypt-smime
========================

S/MIME implementation of zbateson/mmp-crypt using PHP OpenSSL

1.0.0(4mo ago)11.4kBSD-2-ClausePHPPHP &gt;=8.1

Since Feb 13Pushed 4mo agoCompare

[ Source](https://github.com/zbateson/mmp-crypt-smime)[ Packagist](https://packagist.org/packages/zbateson/mmp-crypt-smime)[ RSS](/packages/zbateson-mmp-crypt-smime/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

zbateson/mmp-crypt-smime
========================

[](#zbatesonmmp-crypt-smime)

S/MIME encryption, decryption, signing, and verification for [zbateson/mail-mime-parser](https://github.com/zbateson/mail-mime-parser) using PHP's OpenSSL extension.

[![Total Downloads](https://camo.githubusercontent.com/46f9cb50b3de96d3463aa572a5304918b93cf45479e83318c1a5f3fa3cf471b0/68747470733a2f2f706f7365722e707567782e6f72672f7a62617465736f6e2f6d6d702d63727970742d736d696d652f646f776e6c6f616473)](//packagist.org/packages/zbateson/mmp-crypt-smime)[![Latest Stable Version](https://camo.githubusercontent.com/63fe7327276383455b50ff87445e2740c0721d62b31ac4f8ffc63162f5f471d4/68747470733a2f2f706f7365722e707567782e6f72672f7a62617465736f6e2f6d6d702d63727970742d736d696d652f76)](//packagist.org/packages/zbateson/mmp-crypt-smime)

```
composer require zbateson/mmp-crypt-smime

```

Sponsors
--------

[](#sponsors)

[![SecuMailer](https://camo.githubusercontent.com/74de27677ddf07fa571fcca6558d34be0fa6486bf473de73261461b89b12e8c5/68747470733a2f2f6d61696c2d6d696d652d7061727365722e6f72672f73706f6e736f72732f6c6f676f2d736563756d61696c65722e706e67)](https://secumailer.com)

A huge thank you to [all my sponsors](https://github.com/sponsors/zbateson). &lt;3

If this project's helped you, please consider [sponsoring me](https://github.com/sponsors/zbateson).

Requirements
------------

[](#requirements)

PHP 8.1 or newer with the `openssl` extension, and [zbateson/mail-mime-parser](https://github.com/zbateson/mail-mime-parser) 4.x.

Description
-----------

[](#description)

This package provides an S/MIME implementation of [zbateson/mmp-crypt](https://github.com/zbateson/mmp-crypt) using `openssl_pkcs7_*` functions. It supports:

- Encrypting and decrypting `application/pkcs7-mime` messages
- Signing and verifying detached `application/pkcs7-signature` signatures
- Composing S/MIME messages via the `SMimeMessage` static API (encrypt, sign, sign-then-encrypt)

Usage
-----

[](#usage)

### Composing an encrypted message

[](#composing-an-encrypted-message)

```
use ZBateson\MailMimeParser\Message;
use ZBateson\MmpCryptSmime\SMimeMessage;

$message = Message::from($rawEmail, false);
$cert = file_get_contents('/path/to/recipient-cert.pem');

// Encrypt -- returns a new IMimePart with application/pkcs7-mime content
$encrypted = SMimeMessage::encrypt($message, $cert);

// The outer Subject defaults to "..." to hide the real subject
echo (string) $encrypted;
```

### Composing a signed message

[](#composing-a-signed-message)

```
$cert = file_get_contents('/path/to/signer-cert.pem');
$key = file_get_contents('/path/to/signer-key.pem');

$signed = SMimeMessage::sign($message, $cert, $key);
```

### Sign-then-encrypt

[](#sign-then-encrypt)

```
$result = SMimeMessage::signAndEncrypt(
    $message,
    $signerCert,
    $signerKey,
    $recipientCert,
);
```

### Decrypting a parsed message

[](#decrypting-a-parsed-message)

```
use ZBateson\MmpCryptSmime\SMimeOpenSsl;

// Configure the decryption credentials
$crypt = new SMimeOpenSsl(
    decryptionCredentials: [
        ['cert' => $cert, 'key' => $key],
    ],
);

// Decrypt the content stream from a parsed encrypted part
$decrypted = $crypt->decrypt($encryptedPart->getContentStream());
```

License
-------

[](#license)

BSD licensed - please see [license agreement](https://github.com/zbateson/mmp-crypt-smime/blob/master/LICENSE).

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance74

Regular maintenance activity

Popularity22

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

140d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f2d1f00c58c63c29cc0fcf5972c9add3d468fb126f7191a6a5dfabc1f0af24e4?d=identicon)[zbateson](/maintainers/zbateson)

---

Top Contributors

[![zbateson](https://avatars.githubusercontent.com/u/8356974?v=4)](https://github.com/zbateson "zbateson (1 commits)")

---

Tags

encryptionmimeemailcmspkcs7smimemail-mime-parser

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/zbateson-mmp-crypt-smime/health.svg)

```
[![Health](https://phpackages.com/badges/zbateson-mmp-crypt-smime/health.svg)](https://phpackages.com/packages/zbateson-mmp-crypt-smime)
```

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k543.5M2.6k](/packages/aws-aws-sdk-php)[algolia/algoliasearch-client-php

API powering the features of Algolia.

69735.1M159](/packages/algolia-algoliasearch-client-php)[zbateson/mail-mime-parser

MIME email message parser

54753.3M91](/packages/zbateson-mail-mime-parser)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M738](/packages/sylius-sylius)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)[gotenberg/gotenberg-php

A PHP client for interacting with Gotenberg, a developer-friendly API for converting numerous document formats into PDF files, and more!

3856.2M31](/packages/gotenberg-gotenberg-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
