PHPackages                             webnarmin/cryptor - 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. webnarmin/cryptor

ActiveLibrary[Security](/categories/security)

webnarmin/cryptor
=================

Authenticated encryption helper with versioned payloads and legacy decrypt support.

v2.0.0(1w ago)001MITPHPPHP ^8.2CI passing

Since Jun 22Pushed 1w agoCompare

[ Source](https://github.com/webnarmin/cryptor)[ Packagist](https://packagist.org/packages/webnarmin/cryptor)[ RSS](/packages/webnarmin-cryptor/feed)WikiDiscussions main Synced yesterday

READMEChangelogDependencies (2)Versions (5)Used By (1)

Cryptor
=======

[](#cryptor)

`webnarmin/cryptor` is a small PHP encryption helper.

Version `2.x` writes authenticated, versioned AES-256-GCM payloads and keeps read support for legacy `1.x` AES-256-CBC payloads to make migrations possible.

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

[](#installation)

```
composer require webnarmin/cryptor
```

Version Contract
----------------

[](#version-contract)

- `1.x` wrote legacy AES-256-CBC payloads.
- `2.x` writes `cryptor:v2:` AES-256-GCM payloads.
- `2.x` can decrypt legacy `1.x` payloads.
- `2.x` is a major version because encrypted output format changes.

Security Model
--------------

[](#security-model)

`Cryptor` is a symmetric encryption helper. The `$privateKey` and `$publicKey` names are kept from the `1.x` API, but this library does not implement public-key encryption. Both values are used as key material for deriving the encryption key.

Usage
-----

[](#usage)

```
