PHPackages                             maymeow/php-encrypt - 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. [Security](/categories/security)
4. /
5. maymeow/php-encrypt

AbandonedArchivedProject[Security](/categories/security)

maymeow/php-encrypt
===================

Extendable Certificate Authority scirpt made with PHP

v2021.2.1(5y ago)779[1 issues](https://github.com/MayMeow/php-encrypt/issues)[17 PRs](https://github.com/MayMeow/php-encrypt/pulls)MITPHPPHP 7.4.\*

Since May 22Pushed 3y ago1 watchersCompare

[ Source](https://github.com/MayMeow/php-encrypt)[ Packagist](https://packagist.org/packages/maymeow/php-encrypt)[ Fund](https://www.buymeacoffee.com/maymeow)[ GitHub Sponsors](https://github.com/maymeow)[ RSS](/packages/maymeow-php-encrypt/feed)WikiDiscussions master Synced yesterday

READMEChangelog (7)Dependencies (2)Versions (42)Used By (0)

If you like this package, please note that it is no longer in active development and please check [PHP-Cryphography](https://github.com/MayMeow/php-cryptography) package.

PHP Encrypt
===========

[](#php-encrypt)

This is readonly Mirror however you can still conttibute if you have email. For more infomation scroll down to **Contributing**.

Library for signing certificates with selfsigned CA

[![](https://github.com/maymeow/php-encrypt/workflows/PHP%20Composer/badge.svg)](https://github.com/maymeow/php-encrypt/workflows/PHP%20Composer/badge.svg)[![Maintainability](https://camo.githubusercontent.com/b2c6593df560d04e17d7c790676436ae454aafc63dd5b8d418e36b53463c125d/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f36623338396633626461336634326464343637612f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/MayMeow/php-encrypt/maintainability)

Installation
------------

[](#installation)

Install with docker:

```
composer require maymeow/php-encrypt
```

And intialize it withhin your script

```
$cf = new \MayMeow\Factory\CertificateFactory(new \MayMeow\Model\EncryptConfiguration());
```

### Alternative you can download from my private server

[](#alternative-you-can-download-from-my-private-server)

add to your composer.json files to repositories section

```
{"type":"composer","url":"https://git.cloud.hsoww.net/api/v4/group/121/-/packages/composer/packages.json"}
```

Usage \[WIP\]
-------------

[](#usage-wip)

### Path Configuring

[](#path-configuring)

To set diferent path for cert templates (cnf files) use:

```
// dont forget to use trailing slash
$cf = new \MayMeow\Factory\CertificateFactory(new \MayMeow\Model\EncryptConfiguration(), '/path/to/templates/folder/');
```

To chanage folder to change path to your configuration file

```
// use full path to your configuration file include name of this file
$cf = new \MayMeow\Factory\CertificateFactory(new \MayMeow\Model\EncryptConfiguration('/path/to/templates/folder/my_config_file.yml'));
```

### Certificate Signing - \[DEPRECATED\]

[](#certificate-signing---deprecated)

1. Create Selfsigned CA

```
use MayMeow\Writers\FileWriter;

$cf->domainName()
    ->setOrganizationName('Hogwarts School of Witchcraft and Wizardry')
    ->setCountryName('SK')
    ->setCommonName('Hogwarts School of Witchcraft and Wizardry Root CA');

$cf->setType('ca')
    ->setName('Hogwarts')
    ->sign()
    ->writeTo(FileWriter::class);
```

2. Create Intermediate CAs. This type of CA you will use for signing users and servers certificates.

```
use MayMeow\Writers\FileWriter;
use MayMeow\Loaders\FileLoader;

$cf->domainName()
    ->setOrganizationName('Hogwarts School of Witchcraft and Wizardry')
    ->setCountryName('SK')
    ->setOrganizationalUnitName('Hogwarts houses')
    ->setCommonName('Slytherin HSoWaW House');

$cf->setType('intermediate')
    ->setName('Hogwarts/Slytherin')
    ->setCaFrom(new FileLoader('test-ca'))
    ->sign()->writeTo(FileWriter::class);
```

3. Sign User or server certificate

- User Certificate

```
use MayMeow\Writers\FileWriter;
use MayMeow\Loaders\FileLoader;

$cf->domainName()
    ->setCommonName('Hermione Granger')
    ->setEmailAddress('hermione.granger@g.hogwarts.local')
    ->setOrganizationName('Hogwarts School of Witchcraft and Wizardry')
    ->setOrganizationalUnitName('Hogwarts Students');

$cf->setType('user')
    ->setName('Hogwarts/Students/hermione-granger')
    ->setCaFrom(new FileLoader('test-ca'))
    ->sign()->writeTo(FileWriter::class);
```

- Server Certificate

```
use MayMeow\Writers\FileWriter;
use MayMeow\Loaders\FileLoader;

$cf->domainName()
    ->setCommonName("gryffindor.hogwarts.local")
    ->setOrganizationalUnitName("Hogwarts Webpages")
    ->setOrganizationName("Hogwarts School of Witchcraft and Wizardry");

$cf->getAltNames()
    ->setDns("gryffindor.hogwarts.local")
    ->setDns("*.gryffindor.hogwarts.local")
    ->setIp("10.0.20.2");

$cf->setType("server")
    ->setName("Hogwarts/Webpages/griffindor-hogwarts-local")
    ->setCaFrom(new FileLoader('test-ca'))
    ->sign()->writeTo(FileWriter::class);
```

4. Each certificatess are located in `webroot/`. Certificate Names can be set with `->setName()` function.
5. To load CA for signing certificate you will use `->setCa(, )`. **Certificate Key pass** is located in `code.txt` file in each certificate folder.

### PKCS12 file format

[](#pkcs12-file-format)

Windows users need certificate in PKCS12 format, `.pfx` file extension. To create this type of file use

```
// public function write($decryptPK = false, $pcks12 = false);
...->write(false, true);
```

### Creating key pairs

[](#creating-key-pairs)

If you dont need certificate you can create key pair `from v2018.4` updated in `v2019.5`

```
use MayMeow\RSA\RSACryptoServiceProvider;

$this->csp = new RSACryptoServiceProvider();
$keypair = $this->csp->generateKeyPair('yourSuperStrongPas$$phrase'); // returns RSAParameters

// privateKey & public key
$keypair->getPrivateKey();
$keypair->getPublicKey();
```

### Loaders \[DEPRECATED\]

[](#loaders-deprecated)

Are now deprecated and will be removed in nex major release

```
use MayMeow\Loaders\FileLoader;

$kp = new FileLoader('test-ca');
$kp->getPublicKey();
$kp->getPrivateKey();
```

Crypto Service Providers
------------------------

[](#crypto-service-providers)

### RSA Crypto Service Provider

[](#rsa-crypto-service-provider)

RSACSP is replace Security factory. It's used for asymetric encryption. Asymetric encryption is using two keys, public for encrypt and private key for decrypt data;

```
// Generate keypPairs
use MayMeow\Cryptography\RSA\RSACryptoServiceProvider;
use MayMeow\Cryptography\Filesystem\RsaParametersFileLoader;

$this->csp = new RSACryptoServiceProvider();

// generate new keypairs
$keypair = $this->csp->generateKeyPair('yourSuperStrongPas$$phrase'); // returns RSAParameter

// OR Load keypairs from file
$fileLoader = new RsaParametersFileLoader();
$this->csp->setRsaParameters($fileLoader->load('name_of_certificate'));

// Ecrypt and decrypt
$plainText = 'Hello World!';
$encryptedText = $this->csp->encrypt($plainText);
$decrypted = $this->csp->decrypt($encryptedText);

// Signing
$signature = $this->csp->sign($plainText);
$this->csp->verify($plainText, $signature); // true or false

// md5 fingerprint
$this->csp->getFingerPrint();
```

### AES Crypto Service Provider

[](#aes-crypto-service-provider)

AESCSP is using for aes encryption. Aes is symetric encryption, is using only one key for encrypt/decrypt data. For more security it can be used together with asymetric encryption.

```
use MayMeow\Cryptography\AES\AESCryptoServiceProvider;

//initialize CSP, generate key and IV
$csp = new AESCryptoServiceProvider();
$csp->generateIV();
$key = $csp->generateKey();

//encrypt data
$plainText = "This is going to be encrypted!";
$encryptedText = $this->csp->encrypt($plainText);

// inistialize another CSP
// sure you can use same instance to decrypt but in most cases you only ancrypting
// and then storing to database to decrypt it later
$csp2 = new AESCryptoServiceProvider();
$csp2->setKey($key); // et key you generated before

//decrypt text
$originalText = $csp2->decrypt($encryptedText);
```

Contributing
------------

[](#contributing)

This repository is mirror from my own git server. If you want to contribute you will need email.

1. Create new branch

```
it checkout -b
```

2. Create new commit from your changes and make patch.

```
git add
git commit
git format-patch -o /tmp/ HEAD^
```

3. Send you patch to my email.

**DO NOT** make changes right inside master branch. I will not accept that.

History
-------

[](#history)

SEE changelog

Credits
-------

[](#credits)

- [MayMeow (Emma)](https://github.com/MayMeow)

Stargazers
----------

[](#stargazers)

[![Stargazers repo roster for @MayMeow/php-encrypt](https://camo.githubusercontent.com/355af2783d4484721e011a91a2abe5677c67a4bdca48950a25c45911d279a541/68747470733a2f2f7265706f726f737465722e636f6d2f73746172732f4d61794d656f772f7068702d656e6372797074)](https://github.com/MayMeow/php-encrypt/stargazers)

License
-------

[](#license)

MIT

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor1

Top contributor holds 97% 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

Every ~107 days

Recently: every ~129 days

Total

16

Last Release

1718d ago

Major Versions

v2017.8 → v2018.32018-03-22

v2018.8.2 → v2020.6.rc12020-05-17

v2020.6 → v2021.2.02021-02-05

PHP version history (2 changes)v2020.6.rc1PHP 7.\*

v2021.2.0PHP 7.4.\*

### Community

Maintainers

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

---

Top Contributors

[![MayMeow](https://avatars.githubusercontent.com/u/3164256?v=4)](https://github.com/MayMeow "MayMeow (97 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")

---

Tags

certificatesencryptionhacktoberfesthacktoberfest2020libraryopensslphpsecurity

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/maymeow-php-encrypt/health.svg)

```
[![Health](https://phpackages.com/badges/maymeow-php-encrypt/health.svg)](https://phpackages.com/packages/maymeow-php-encrypt)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M2.9k](/packages/craftcms-cms)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1175.2k](/packages/rcsofttech-audit-trail-bundle)[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

101466.4k45](/packages/friendsoftypo3-content-blocks)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1615.6k12](/packages/2lenet-crudit-bundle)

PHPackages © 2026

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